stop game at countdown reaching zero?

Get help using Construct 2

Post » Fri Feb 21, 2014 4:46 am

Hello. New here.

I'm working on a game in which a high score must be achieved in a certain amount of time. At the moment my timer keeps ticking after it's reached 0, going into -1, -2, -3 and so on.

I tried a stop loop function, but then the timer didn't tick down at all.

What I'm trying to achieve:
Timer to stop at "0"
Accruing of points no longer available after timer reaches "0"

Thank you very much! (Been trying to figure this out for around an hour, and it's proving very frustrating).
B
8
S
1
Posts: 11
Reputation: 472

Post » Fri Feb 21, 2014 12:51 pm

You can just add a condition to the event that count down the timer, so if timer > 0 then it will do the count down.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,848

Post » Fri Feb 21, 2014 4:01 pm

I had to do something like that, what I did was made Global Number and set it to what ever I wanted, For the game i'm working on it's at 5 (IE hp) when the HP reach's Zero is end's the level and loads up a second one.

For my end its this.
System Tower_1Health=0 + System Tower_2Healther=0 Then Audio Stop all and System goto Level 2

If this makes sense.
B
14
S
4
G
1
Posts: 61
Reputation: 1,459

Post » Sat Feb 22, 2014 9:05 am

Thanks, but that's not QUITE what I'm after. Let me clarify:

What I have:
Global Number Timer = X
Subtract 1.0 from Timer every 1.0 second.

What I'm trying to achieve:
When Timer = 0, stop timer.
(Also, When Timer = 0, Add 0 to Score) <- Would that have to be done on a per object basis?

What I've tried:
Timer = Zero, Stop loop (does nothing)
Timer = Zero, subtract 0 from Timer (does nothing).

Thanks again!
B
8
S
1
Posts: 11
Reputation: 472

Post » Sat Feb 22, 2014 6:59 pm

Ill post my fix when I get home tonight unless someone beats me to it.
B
14
S
4
G
1
Posts: 61
Reputation: 1,459

Post » Sat Feb 22, 2014 7:26 pm

setting the timer to "clamp(value to be clamped,lowest possible value,highest possible vlaue)"
short: always -> set global'timer' to: clamp(global'timer',0,60). The global value 'timer' won't get higher then 60 or lower then 0.
After that: global'timer' = 0? -> do something.
https://www.scirra.com/manual/126/system-expressions
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sat Feb 22, 2014 8:58 pm

Just set the timescale to =0 when counter reaches Zero... That will stop everything and just add a restart button (making sure you reset the timescale to=1.
B
33
S
16
G
3
Posts: 358
Reputation: 5,398

Post » Mon Feb 24, 2014 2:56 am

Thanks everyone. I've actually made it so when the timer reaches zero, it just goes to "Game Over/Time's Up" layout, with a "Try again?" option.

Even though I had System Timer = 0, Subtract 0 from Timer, it had no effect. I tried every variation I could think of (including everything suggested here).

If there's ever a Construct 3, I hope they have some kind of separate 'timer'/'stop watch'/'time counter' instance or something.

I have another question, but that's going to require another post ~
B
8
S
1
Posts: 11
Reputation: 472


Return to How do I....?

Who is online

Users browsing this forum: AllanR, BackendFreak, brunopalermo, farsen, ST314 and 29 guests