Most of us are pretty familiar with the System expression called time
Simply, time stores a value, "The number of seconds since the game started, taking in to account the time scale."
Show the number of seconds the user has been playing
Create an Event, every 1 second
Action: Set Text to time
Show the Minutes and Seconds
Create an Event, every 1 second
Action: Set Text to zeropad(int(time/60% 60), 1) & ":" & zeropad(int(time%60), 2)
Reset the timer when Layout is Started or Restarted
Now comes the hard part. The timer is always counting since the game was launched. How can you restart the counter if the game is restarted?
1) Create a global variable in the layout TimeStartLayout
2) Add the following to the Event sheet
Event: On Start Of Layout
Action: System Set Variable TimeStartLayout to time
3) Whenever you want to use the time since the layout was started or restarted, simply subtract...
Show the number of seconds the user has been playing since start/restart of layout:
Create an Event, every 1 second
Action: Set Text to time-TimeStartLayout
Show the Minutes and Seconds the user has been playing since start/restart of layout:
Create an Event, every 1 second
Action: Set Text to zeropad(int((time-TimeStartLayout)/60% 60), 1) & ":" & zeropad(int((time-TimeStartLayout)%60), 2)