Reset global variables

Get help using Construct 2

Post » Tue Feb 14, 2012 3:51 pm

Hi Just wondering if anyone might know a solution for this:

I have this set up:

Event: System/Time=1 Minute
Action: System/Go to layout1
Action: System/Reset global variables to default

So after 1 minute of game play it goes back to layout1 (beginning of game) and the globals are reset so you can play again.

The problem is it only works one time. after the second round it dose not reset or time out.

Is there a way to make it happen every time you play?

Thanks for any help
B
6
S
2
G
4
Posts: 12
Reputation: 2,810

Post » Tue Feb 14, 2012 4:04 pm

Try "Every 60 seconds" instead of "Time = 1 minute". Alternatively try storing 'time' in a global variable on start of layout and checking if the time is 'time + 60'. The game time is from the very beginning of the game, so the second time around the time will be 2 minutes and counting, which will not satisfy the "time = 1 minute" event ever again.Ashley2012-02-14 16:05:45
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,528

Post » Tue Feb 14, 2012 4:19 pm

Thank you! Changing it to "Every 60 seconds" works perfect!!
B
6
S
2
G
4
Posts: 12
Reputation: 2,810

Post » Tue Feb 14, 2012 4:23 pm

I think this would work too
Event(compare two values): time%60 = 0
And you don't need any extra events
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Tue Feb 14, 2012 9:08 pm

thanks! Is there a way to see the timer or countdown on the screen visually somehow tied to the methods mentioned above?

Also, is there a way to start the timer on a mouse click?
I have a start page (layout) with a "play" button on it and when that is clicked I'd like the timer to start.Chuck Glenn2012-02-14 21:12:32
B
6
S
2
G
4
Posts: 12
Reputation: 2,810

Post » Sat Nov 23, 2013 2:25 am

Yeah me too....
Check out my latest game RAPID-TAPIT. Get your Fingercise on with this one. A steady Tap is all you need to score points. Lift a finger and see what you can do...

Image

ALLMarkMade Designs
B
23
S
9
G
1
Posts: 326
Reputation: 3,349


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests