Every "300/Variable seconds" is somewhat buggy

Get help using Construct 2

Post » 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
B
12
S
3
Posts: 211
Reputation: 1,477

Post » 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.
ImageImageImage
B
71
S
21
G
230
Posts: 3,687
Reputation: 128,845

Post » 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
B
12
S
3
Posts: 211
Reputation: 1,477

Post » 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.
ImageImageImage
B
71
S
21
G
230
Posts: 3,687
Reputation: 128,845

Post » 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
B
12
S
3
Posts: 211
Reputation: 1,477

Post » 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.
Image ImageImage
B
168
S
50
G
169
Posts: 8,281
Reputation: 108,191

Post » 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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: Fradno, odiusfly and 21 guests