stop game at countdown reaching zero?

  • 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).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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!

  • Ill post my fix when I get home tonight unless someone beats me to it.

  • 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

  • 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.

  • 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 ~

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)