How do I create a countdown timer upon collision?

0 favourites
  • 4 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • So, I want to collide with an item, and then it will start a countdown timer on my UI.

    I already have the timer that works on collision - but the problem is that it doesn't restart when I collide again - and it doesn't stop when it gets to 0.

    I'm basically turning a light on, and I need the player to know how long is left before the light turns off.

  • Are you using Timer behavior? You can add it to the LightSwitch for example.

    Player on collision with LightSwitch -> turn light on; LightSwitch start timer "TurnOff" for 5 seconds

    LightSwitch on Timer "TurnOff" -> turn light off

    If you collide with the LightSwitch again while the timer is still running, it will be restarted for 5 seconds again.

  • I see - that works - but now my timer countdown doesn't work. Is there a simple way to add a text countdown?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use Timer expressions CurrentTume and Duration:

    remainingTime = LightSwitch.Timer.Duration("TurnOff") - LightSwitch.Timer.CurrentTime("TurnOff")

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