Double Decrement Problem


  • Posts: 142
Good Morningish...

I am working on a "burn enemy" logic, and I'm just trying to figure out what the problem is.  It's only supposed to decrement the health/timer by 1, but it does it by 2.

I took out the health portion, and now i'm just trying to get the decrement to work by one, but debug keeps showing it decrementing in 2's for the counter as well.

This is the only place for this specific logic.  No other behavior has a counter or uses the "OnFire" attribute.

Thanks in advance!


  • Posts: 142
LOL so once again, stepping away for a minute was helpful.  Keep that in mind, Stencylers!

The reason it wasn't working properly was because this logic was all part of a collision. 

Now, I have the collision set the color effect, and OnFire to true.  Then I have a "Do every" event that only counts every second If "OnFire", then an Always/Updating for "OnFire?" to check the decrement every second. 

It was doing doubles for an odd reason, that I'm not sure... probably because it was two collisions, but the problem is that I was trying to control the doubles with a boolean, as is standard... still did weird double count down.

However, it was never going to remove the effect unless it was collided and firecount was 0... which would never happen.


  • *
  • Posts: 1228
Oh I typed something, but glad you got it sorted.

But if you want it perfect you shouldn't be using the seconds-based timers like "do every x seconds" and the others for gameplay, because if you're game's fps drops low enough to slow your game or if the window goes out of focus, the timers will de-sync with the rest of the game. Because it counts real-life seconds, not just when the game's frames are advancing.