Nxs's Forum Posts

  • 11 posts
  • i would like too add something to moving enemies individually. however please keep in mind that i am very new to coding in general and I've never actually stepped outside of construct 2. I'm sure you have a lot more knowledge then me in anything however I've taught myself my own ways around problems and i use this specific solution in almost all of my games in some way or another.

    i tend to get around having my enemies all the same coding with statements like "if enemy is withing distance of player then aim and shoot" that way all of my enemies will have the same coding but only the ones that are close (in this example) will shoot.

    then i add onto this with instance variables. the enemy might have a "range" variable, which i might set to 200 and then only when the player is under 200 pixels away, will it work. that way i can change specifics between the same objects such as one having a range of 200 and another having a range of 300.

    there's also the type of logic like "if a bullet is overlapping enemy, destroy enemy" and although this is a broad statement that targets all sprites named "enemy" it will only target the one sprite that the bullet is overlapping.

    now if you want random movements from the same enemy type it would be easiest to set up its movement AI with space for a variable such as speed or direction. so you could say something like "on object created choose initial direction: random(left,right)" of course you would use the actual words left right. a more accurate statement could be:

    on object created choose enemy.direction: choose(0,1)

    if enemy.direction = 0

    enemy simulate control: left

    if enemy direction = 1

    enemy simulate control: right

    [and then although this sets the initial direction, if you run into a wall you could just say]

    enemy on collision with wall: add 1 to enemy.direction

    if enemy.direction is > 1: set enemy.direction to 0

    [this just makes a simple toggle]

    I'm positive that this isn't the best way to do things like this (again, not a professional game dev) however I've definitely found good use out of things like this especially because it really helps reduce the amount of lines used in coding which is important with that 100 line cap forever looming overhead.

    I'm sure you already knew a lot of these things but maybe you never knew you could do them specifically in construct 2, so things to look out for are the instance variables found in each sprite above the behaviors, and things such as "random(smallest number, largest number)" which will pick a number in between those values and "choose(1,2,3,4,5,etc.)" which will choose one of the specified options

  • Have a look at this:

    sorry but I've solved my problem while also actually cutting down on my coding but thanks so much for helping! i have to admit, your definitely better at coding than me XD. I found it quite hard to get my head around your coding but its very ingenious!

  • Problem Description

    ____ i am creating a text based adventure but somehting really strange it happening to one of my global variables. ill need to explain a few thing to give the context so here we go... so i was attempting to create a system that could write out lines of text letter by letter, after many hours of frustration and researching i finally came up with a solution where i stored my text in a global variable called outputTextWriting, and then i would use the mid() function to pick out each letter one at a time. now the problem with this is that if i wanted a new line usually you would just type in: ""&newline&"" but because its stored in a global variable it would just type that out instead of recognising it a function. to counter this problem i would enter only the first paragraph into outputTextWriting and then set it up so that whenever it has finished writing, it would start a newline and then replace what was in the global variable to the next paragraph. i created a new global variable called eventMarker. the idea was that whenever a paragraph ended, it would add 0.01 to the variable. for example: if eventmarker = 1.11 then set outputtextwriting to"[insert something here]" . this meant that i could use this new global variable to write a paragraph then ad a newline then start the next paragraph. now... the stupid thing that i hope is just a bug and not an error in my code is that every now and then instead of transitioning from 1.11 to 1.12 for example it will instead got to 1.12000000000000001.......... which is a real problem as you can imagine..... just to add on to this it isn't completely random. there are 3 specific times that this happens as you will see in my capx.. please help____

    Attach a Capx

    ____ https://www.dropbox.com/s/xfqfcplmpl2l8 ... .capx?dl=0 ____

    Observed Result

    ____ well instead of adding to the global variable in intervals of 0.01 but instead at very specific points it doesn't go up at an interval ____ of 0.01 but instead it will ad something like 0.010000000000001..... or 0.09999999999996.......

    Expected Result

    ____ the global variable should just count up in intervals of 0.01 ____

  • hey all! first al of, thank you for everybody replying with solutions and help. I really appreciate the kindness from this community.

    all of you are talking about backups, the problem is that I was backing it all up onto a USB and yeah I know uploading it onto the cloud or a drop box would have been better but im to stubborn XD. as I said before, my hard drive is practically dead, so my guess was that my computer just couldn't even bother to save anything properly throughout that session of construct.

    basically, the game plan for me now is to fix my pc then download drop box onto my pc straight away XD. once again, thanks for all the responses!

  • This isn't really something anyone can help with but im kind of pissed off and I want to talk about it....

    so basically, my hard drive is half dead, and im still trying to get it in for repairs, but in the meanwhile I decide continue working on a game. as you do!

    the game itself is actually quite simple, but from a coding perspective its tedious and annoying (but really worth it in the end). so I get to the first problem in the coding, and im working on a solution... then BAM, my computer get the blue screen.

    so not really thinking, a couple days later I get up my computer to try again and at this point I already know that all of my work from last time wasn't saved, so I was back to square one!!! anyway, I went through the most tedious parts, I was making some real progress... and then... BAM, it happened again and all my progress was lost!

    at this stage my computer was getting really bad and I didn't really want to even attempt to do it again.

    about 4 days later, I have to do some research for a science task and I decide to use my laptop (thinking in my head : this isn't gonna last more then 20 minutes before it crashes again). 2 hours later and I have 2 full pages of information that I have printed out and no crashes!!

    at this point im pretty confident in my computer and im really motivated to do some game making so I got back to the old game save and try one more time to make it! 3 - 4 hours later, no crashes, and I've got a game that I was proud of, it was just an all round feeling of satisfaction.

    throughout the entire process, im saving every second thing I do!! so I knew for a fact that even if it crashed, it would be okay!!

    now.... after all this.... all the saving that I did..... I exited out of construct2..... I copied over the game to a USB so it was safe and backed up...... I go back in to look at something.... AAAAAAANNNNDDDDDDDDDD BACK TO SQUARE ONE!!!!! After all that!!! it didn't even save!!!!!!!!!

    no backups, no AutoSaves, nothing!

    I say this isn't something that you can help with because im 99% sure that its my hard drive's fault!

    hhhhhhhhhhhhhhhhhhhhhhhhhh...... im not gonna try this until I have a working computer!

    thanks for listening to my stupid rant XD.

    leave a comment if you've had a similar experience!

  • well. wtf, now its works.... maybe the servers were having a hard time uploading it when I first tried to play it cause I waited a couple days and now I can get into it fine!!! oh well, at least it works now!

  • well. wtf, now its works.... maybe the servers were having a hard time uploading it when I first tried to play it cause I waited a couple days and now I can get into it fine!!! oh well, at least it works now!

  • with only being able to track the first event, could you do "every x seconds" instead of "on start of layout" ???

  • Ok, so basically, I created a simple game, (as you do) and then I uploaded it, (as you do!!)

    a bit after uploading it, everything was working smoothly, no problems at all, until I decided I wanted to change a couple things. after changing some things in construct 2 I re uploaded it just like I did before and what do ya know, its a black screen!!!!

    all I know is that after re-uploading my game it just goes to a black screen in the box where my game should be.

    sometimes though it doesn't come up with a black screen but instead a wall of text on a yellow background basically saying that it cant find the file... I haven't moved the file from the place where I re-uploaded it either...

    here's the link to the game to see for yourself

    https://www.scirra.com/arcade/other-gam ... on=updated

    so to recap, the error seems to be based off of Scirra not being able to find my file when I upload

  • I am trying to export a game that I made but when ever I try to export the game, halfway through the process, it will stop loading and it says:

    "error During Export: Cannot open file"

    "C:\Users\Lachlan\Desktop\A.J\A.j.\A.j..Windows\index-win.html"

    how do I fix this?!?!?!?!!?!?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • How do I make a looping background music?

    at the moment, I have it so that the main background music plays on a loop throughout all of my layouts. it is activated on start of layout (main menu) and its in the "music" folder so it only plays one at a time. the only problem is that whenever I go back into the main menu, it will abruptly stop the music and make it start from the start again.

    so how do I make my background music play in a continuous loop no matter what layout your on at the time without it restarting the song half way through it whenever I go back to the main menu??

  • 11 posts