Page 1 of 1

### Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 3:15 pm
Hi guys,

I am currently working on a platform game, where a player gains points when he is moving. The faster he moves, the more points he gains. (points = distance you traveled)

Variable X defines the current Speed, so ""Every 300/X seconds -> add 1 to score"" works just fine. But when I fail/die, go back to menu and then go back to the level, the event simple wont work anymore.

I can't explain myself why. I debuged everything and all the conditions are fine. X is not 0. Any advice? So many problems~~~ ty

### Re: Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 3:17 pm
Every X seconds is based on the game start time, not the layout start, so any restart won't work the way you want. Use a Timer instead for consistent results.

### Re: Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 3:19 pm
why won't it work? I understand what you are saying but "Every 2 seconds" works aswell without any mistakes. 300/X is just another value ... I don't rlly understand

### Re: Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 3:42 pm
Every 2 seconds won't work any better, but it's harder to see the difference, since it's relatively quick, and is only off that first cycle.

### Re: Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 3:47 pm
hm okay. I dont quite get the logic but i am working with timers now. thank you tho

### Re: Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 4:20 pm
Keep in mind every x seconds starts at the beginning of the count, not the end.
So it's, do foo, wait x seconds, do foo.
Not, wait x seconds, do foo.

### Re: Every "300/Variable seconds" is somewhat buggy

Posted: Fri Jun 17, 2016 10:11 pm
Did you divide by zero ? Making the previous 'every' wait forever?

The 'every' accepts a new time after the previous one has expired, i think. Should be logic, because it skips ticks when its not true, not true means that it is not time yet to fire.