How do I stop my timer on player death?

Get help using Construct 2

Post » Fri Jun 06, 2014 5:27 pm

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.
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 2
Reputation: 211

Post » Fri Jun 06, 2014 6:28 pm

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 .
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Sun Jun 15, 2014 4:49 pm

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 :P

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.
B
4
Posts: 2
Reputation: 211


Return to How do I....?

Who is online

Users browsing this forum: jasontoups, raptor0555 and 1 guest