How do I create a timer for my game?

Get help using Construct 2

Post » Wed Jul 09, 2014 3:47 am

I'm trying to add a timer which counts the minutes and seconds to the UI layer of my game. For testing purposes, I'm just trying to get the time do display as the system counts it (without formatting it to minutes or seconds). I'm trying to use the following events to get it to at least display incrementing numbers on the screen :

Image

However when I load up the layout, the text object does not display anything at all.

How do I go about resolving this?
B
3
Posts: 8
Reputation: 191

Post » Wed Jul 09, 2014 4:12 am

Don't use quotes in Set text to timer.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Wed Jul 09, 2014 4:55 am

blackhornet wrote:Don't use quotes in Set text to timer.

Thank you, its working now.

My game displays the timer until the player dies. Is there any way to get the last timer value shown into my ScoreScreen layout?
B
3
Posts: 8
Reputation: 191

Post » Wed Jul 09, 2014 6:09 am

timer is a global variable. It can be accessed from any layout.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Wed Jul 09, 2014 6:13 am

blackhornet wrote:timer is a global variable. It can be accessed from any layout.

I want the timer to stop counting and then be displayed as a static number (final timer reading is high score).
B
3
Posts: 8
Reputation: 191

Post » Wed Jul 09, 2014 6:15 am

If you switch to a different layout with a separate event-sheet, the current timer code won't be running anymore.
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Wed Jul 09, 2014 6:59 am

blackhornet wrote:If you switch to a different layout with a separate event-sheet, the current timer code won't be running anymore.

Thanks that worked out perfectly!
B
3
Posts: 8
Reputation: 191


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, mindragon73 and 20 guests