Every X Seconds + Restart Layout

Get help using Construct 2

Post » Thu Mar 27, 2014 7:57 pm

nono, what i meant was that you
1) make a Global Variable called "timer" or wathever, which you set to 240
2) then you tell the system to subtract 1 every 1*st (60*dt = 1 second) while "timer" is greater than 0 (this event has 2 conditions)
3) and when "timer" is less or equal than 0; set the variable back to 240. so the timer loops. and also do what you want to do at this point. (I recommend that you add a "trigger once while true" to this event")

so, you don't really need to create any invisible objects for this, get used to the global variables. unless you need to have distinctive timers for different instances of the same object, in which case give the timer variable to the object instance variables.
then, if you need to display the "timer"'s value, you set the text to ("text"&timer) <--- the word "timer" refers to the variable "timer"
you could, in fact, make the variables inside the text object, but personally, i prefer to have variables like that in plain sight in the event sheet.


however... i'm sensing that you want the system to start spawning things after a certain amount of time has elapsed since the start of the layout? you can create a variable timer for that too =P
and in that case, use what i told you before, except don't restart that timer.
and in the following events you can use the "every x seconds" along with the "variable = 0" condition. So the every X seconds will only become active after the first variable is done. And it will reset every time you restart the layout.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sun Mar 30, 2014 3:27 am

The forum has online sorry about the delay! I just really wanted to thank you! I didn't have to use the TImer behaviour and just use my own general dt timer for the whole game and even keep my "Every x" seconds. Thanks so much!!
B
6
S
1
Posts: 18
Reputation: 413

Post » Sun Mar 30, 2014 5:01 am

@technofou no problem!
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Tue Mar 08, 2016 3:00 pm

ArcadEd wrote:Every X seconds is based on the system timer, not the running time of a layout.


Stuff like this should really be in the documentation.
B
26
S
9
G
2
Posts: 78
Reputation: 2,524

Previous

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, blissfulwizard, Malhog and 14 guests