How do I reset the ingame timer?

Get help using Construct 2

Post » Sun May 31, 2015 10:36 am

Hello,

I have a game where every x seconds a random enemy spawns.

every 5 seconds - set local variable x to choose(1,2);
if(x == 1) spawn unitA
else spawn unitB

If you die u have the option to restart by clicking on a button. The button basically does nothing more than "Restart Layout". Let's say I died within the first 3 seconds, and then press restart, the monster will spawn within the next 2 seconds instead of 5 again.
I have no idea why but I guess its bc it somehow doesnt reset the timer?

thank you
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Sun May 31, 2015 10:51 am

try adding before restart layout also reset global variables see if that works, if not set the local variable to 0 upon restart or start of layout!
B
77
S
23
G
69
Posts: 1,353
Reputation: 43,958

Post » Sun May 31, 2015 10:56 am

Doesnt work both ways :/
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Sun May 31, 2015 11:05 am

Every x seconds counts from the moment you start your program..
What you describe above is consistent with that..

Instead you might consider using a timer-bevaviour, set it to 5 seconds

on timer
> create
> set timer for five seconds
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 32 guests