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

Get help using Construct 2

Post » Mon Jan 23, 2017 1:15 pm

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! :mrgreen: :mrgreen: :mrgreen:
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Mon Jan 23, 2017 1:34 pm

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.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Mon Jan 23, 2017 1:38 pm

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.
B
13
S
7
G
4
Posts: 143
Reputation: 3,581

Post » Mon Jan 23, 2017 2:15 pm

mrtumbles wrote: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
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Mon Jan 23, 2017 4:28 pm

Aquanex2 wrote:
mrtumbles wrote: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! :mrgreen:
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Tue Jan 24, 2017 11:29 am

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.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306

Post » Tue Jan 24, 2017 4:47 pm

mrtumbles wrote: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 :mrgreen:
B
24
S
9
Posts: 109
Reputation: 2,002

Post » Tue Jan 24, 2017 5:13 pm

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.
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 242
Reputation: 2,306


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests