Countdown example

Show us your completed creations made in Construct 2

Post » Sat Jun 02, 2012 6:14 pm

Hi! After almost 40 minutes I figured out that, for a countdown to work, the variable should be global. Why is that? Why the variable can't be local for this to work?

www.antylope.com.ar/countdowntrouble.zip
B
9
S
3
G
3
Posts: 39
Reputation: 3,112

Post » Sun Jun 03, 2012 10:12 am

Because local variables reset every tick.
See http://www.scirra.com/manual/83/variables

Either use global or private variables (on objects).
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun Jun 03, 2012 11:13 am

:)) 2 line of events , smartest way to do !! nice, mate !
B
50
S
12
G
7
Posts: 259
Reputation: 10,371

Post » Wed Jun 13, 2012 9:32 pm

Hi, thanks for the timer, however how could i repeat it ...as my level resets in 20 secs then it starts counting in - numbers
B
16
S
4
G
4
Posts: 179
Reputation: 4,688

Post » Thu Jun 14, 2012 9:26 am

You just have to reset the counter. In my example, it starts 3 seconds after the layout has started. You can use a different condition and reset the timer, then it'll work anytime you want it to.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Jun 21, 2012 6:16 am

Thanks for the tip - it' pretty elegant. I was just wondering if Construct had a way to display a leading zero - ex 1:03, 1:02, 1:01,....
B
12
S
3
G
4
Posts: 55
Reputation: 3,186

Post » Thu Jun 21, 2012 8:43 am

From here: http://www.scirra.com/manual/126/system-expressions

zeropad(number, digits)
Pad number out to a certain number of digits by adding zeroes in front of the number, then returning the result as a string. For example, zeropad(45, 5) returns the string "00045".

So you want zeropad(timer,2)
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Tue Sep 04, 2012 2:19 pm

In r100 and firefox it only counts down to 19.. :-/
B
5
Posts: 37
Reputation: 840

Post » Wed Oct 09, 2013 9:10 pm

Hey Mipey,

i got my counter to work...how do I have it stop at zero, as well as stop the game...and have a text that says Times Up...
B
9
S
2
Posts: 272
Reputation: 1,632

Post » Wed Oct 09, 2013 10:08 pm



so this is what I have so far..but when it gets to -1 it goes to 0 and back and forth..so it keeps on hitting -1 and 0..-1 and zero...

not sure how to get it to stop at 0
http://i93.photobucket.com/albums/l74/spawn85027/timer_zpse14bf41a.jpg
snake850272013-10-09 22:14:13
B
9
S
2
Posts: 272
Reputation: 1,632

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 0 guests