How do I stop my timer on player death?

0 favourites
  • 3 posts
From the Asset Store
Player's Follower
$7 USD
30% off
Players follower. use it for anything which follows the player
  • Hey all,

    I'm working on a gamejam entry and have a timer in my game. It counts seconds and milliseconds, timer starts when the layout begins and I want the timer to pause at the end of my level(aka when the player crashes the plane). I want this time to be kept at the end of the level, so the player can clearly see what his time was for the run before starting the next attempt. Can anyone suggest something that would make this happen? I'm having trouble adding this, and I feel its vital to my game. Ultimately I'd want a "high score" feature, but mostly for now, I just want my timer to stop when the player crashes and retain its value until the next restart.

    I've attached a screenshot that shows you how my timer works.

    Appreciate any help. Thanks.

  • There are several ways that you could do this , first take the add timer action out of the every tick event . If the player disappears then put the add to timer action under a is visible event or any other event that relates to the player being active , then the timer would not increment when the player is invisible or has crashed .

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Appreciate the info.

    I was able to stop the timer by adding a 'gameOver' variable to the Every Tick event. When I crash, I set the variable to 1. Every Tick no longer applies because it only runs if that variable is set to 0. After much testing, it works the way I hoped it would. I think

    For anyone else interested in timers: this post was a HUGE help! Especially the .capx file posted by Ramones. Of course the official document for CS2 timers was also a help. EDIT: my URL was removed due to low rep, just google "construct 2 milliseconds" for a thread called "Convert milliseconds to.."

    Thanks.

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