0 Favourites

How do I Fix certain issues that shouldn't happen?

  • I know this question is very vague, but sometimes things in my game go inexplicably wrong, even when everything else goes right. Like for instance if one enemy doesn't behave the same way all the others do, even though all of the variables are the same and all the behaviours are set to the exact same settings. Things like this have happened several times to me, and if you understand where I'm coming from and could give me some pointers on fixing issues like this, I would greatly appreciate the help!

    Thanks in advance!

  • The best advice I can offer is to keep a close eye on your profiler. I almost always run in debugging mode, so that I can individually check variables on instances and so-on. Whenever I find unexpected behaviours, I generally find incorrectly set instance variables, bad calculations, NaNs and floating point errors - which are entirely my fault!

    I know it sucks, but the mantra should be to 'fail faster' - then fix the fails.

  • lol, I've got that kind of stuff going for me all the time. Sometimes it's because I don't quite understand it all yet, but most of the time they're errors made by myself. For example, you forgot to add an instance variable or forgot to change it after cloning. Or replace errors after replacing objects in the code.

  • The best advice I can offer is to keep a close eye on your profiler. I almost always run in debugging mode, so that I can individually check variables on instances and so-on. Whenever I find unexpected behaviours, I generally find incorrectly set instance variables, bad calculations, NaNs and floating point errors - which are entirely my fault!

    I know it sucks, but the mantra should be to 'fail faster' - then fix the fails.

    That's good advice. I don't always run it in debugger, unless this kind of thing happens. I have already done this, though, but I can't for the life of me fix this issue. Here's the issue I'm having right now, and maybe you can give me some more advice. I'm trying to make a shooting enemy that shoots at you every 1.5 seconds, and everything works for the most part, but for some reason when you are on the left side of one, and there are more than one, things go haywire. He shoots in the wrong direction, then he just stops, but all the ones on the left side keep shooting.

    I've checked my events, and none of them have anything to do with what side you are on. I thought maybe there was a problem in having them become active at the same time so I set a variable to make them only be active when they get on-screen, but that fixed nothing. I'll supply pictures of my code, but it'll take me a bit to make a capx.

    https://www.dropbox.com/s/1lr6ywhhv2dl6 ... 1.png?dl=0

    https://www.dropbox.com/s/7ywvbwy3v5w2l ... 2.png?dl=0

  • > The best advice I can offer is to keep a close eye on your profiler. I almost always run in debugging mode, so that I can individually check variables on instances and so-on. Whenever I find unexpected behaviours, I generally find incorrectly set instance variables, bad calculations, NaNs and floating point errors - which are entirely my fault!

    >

    > I know it sucks, but the mantra should be to 'fail faster' - then fix the fails.

    >

    That's good advice. I don't always run it in debugger, unless this kind of thing happens. I have already done this, though, but I can't for the life of me fix this issue. Here's the issue I'm having right now, and maybe you can give me some more advice. I'm trying to make a shooting enemy that shoots at you every 1.5 seconds, and everything works for the most part, but for some reason when you are on the left side of one, and there are more than one, things go haywire. He shoots in the wrong direction, then he just stops, but all the ones on the left side keep shooting.

    I've checked my events, and none of them have anything to do with what side you are on. I thought maybe there was a problem in having them become active at the same time so I set a variable to make them only be active when they get on-screen, but that fixed nothing. I'll supply pictures of my code, but it'll take me a bit to make a capx.

    https://www.dropbox.com/s/1lr6ywhhv2dl6 ... 1.png?dl=0

    https://www.dropbox.com/s/7ywvbwy3v5w2l ... 2.png?dl=0

    Nevermind, I fixed it by changing the trigger for the shooting. Now it works.

    Thanks for the advice, though. I should definitely use the debugger more often! <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • If I have specific issues like this I'll write my own specific debugger. Usually this consists of a TextBox (set its Type to 'Textarea' so it can display scrolling multi-lines) on a 0,0 parallax layer and an action that sets its text to a readout under specific circumstances. I don't tend to make mousey-games so I'll use the mouse as my 'debugging tool' - set it so that when you click an instance the text in the textarea is set to show a readout of all the relevant values to your issue. Something like that anyway. I was inspired by learning that cheat-codes were originally just developer shortcuts for debugging.

  • If I have specific issues like this I'll write my own specific debugger. Usually this consists of a TextBox (set its Type to 'Textarea' so it can display scrolling multi-lines) on a 0,0 parallax layer and an action that sets its text to a readout under specific circumstances. I don't tend to make mousey-games so I'll use the mouse as my 'debugging tool' - set it so that when you click an instance the text in the textarea is set to show a readout of all the relevant values to your issue. Something like that anyway. I was inspired by learning that cheat-codes were originally just developer shortcuts for debugging.

    Wow! I've done something like this, but not to this extent. This is great info! Thanks

  • It's a lot easier than you'd expect, and a lot more useful. Of course, it's only limited to telling you what you explicitly ask it to tell you - but sometimes that limitation is a blessing. I usually implement some sort of home-brew debugger early on in any project that might need it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
300 118,434
blackhornet's avatar
blackhornet
Unread hot topic
0 Favourites
Spam issue
201 16,841
Tom's avatar
Tom Construct Team Founder
Unread hot topic
175 32,652
clifton11221's avatar
clifton11221