Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Pause timer and resume anytime?

Author
Message
2D Analyst
AGK Developer
19
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 24th Oct 2012 04:04 Edited at: 24th Oct 2012 04:16
I am able to display a timer count, but am having a tough time getting it to pause. When user hit continue, the timer count should continue where it left off.

How can I accomplish this?

Never mind I've figured it out by creating a new getSeconds() when user click on continue.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Oct 2012 09:57
Another way is to create your own timers and update them each loop (when the game is not paused).




this.mess = abs(sin(times#))
MarcoBruti
12
Years of Service
User Offline
Joined: 20th Nov 2011
Location: Caput Mundi
Posted: 24th Oct 2012 15:12
or simply meausure the pause time with a dedicated timer, and then add it to the startTime# (or similar) variable that you have set to the initial time.

startTime#=timer()
do
if "pause"
startPauseTimer#=timer()
"do pause"
pauseTime#=timer()-startPauseTimer#
startTime#=startTime#+pauseTime#
endif
timeToDisplay#=timer()-startTime#
"display timeToDisplay# in a suitable format"
sync()
loop
[quote]
That's all folks!

Login to post a reply

Server time is: 2024-04-28 06:02:39
Your offset time is: 2024-04-28 06:02:39