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.

DarkBASIC Discussion / help with pausing time

Author
Message
muphesto
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 26th Nov 2003 11:27
hey i am using a timer in my game and when i pause the game the timer keeps counting down. it will pause on the screen ( i.e stay at 30 secs ) but say i pause for 5 secs, when i unpause it jumps down to 25 secs...i was thinking i would have to record the old time before pause then restart the timer at the unpause

any help wll be thanked

(i got the timer of this website somewhere but i couldnt find it again)
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 26th Nov 2003 12:16
your using the timer() function right, ok, you have to introduce a variable to count while the game is paused 'cus the timer keeps on going regardless of what's happening in your game. then when you un-pause you subtract the pause time from your original time to get back to where you where before.

HIH

muphesto
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 26th Nov 2003 14:37
yeh i get what u mean but im not sure how to do it

thanks
muphesto
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 26th Nov 2003 15:08
can someone help with with this?
hexGEAR
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Naytonia
Posted: 26th Nov 2003 16:55 Edited at: 26th Nov 2003 17:07
k, check this out (using DBClassic):



there could be a shorter way to do this, maybe with less variables but this is off the top of my head the code should work though!

HIH

p.s. tell me if it works, i'll probably post it on the codebase incase another person has a simillar problem.

muphesto
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 26th Nov 2003 18:44
i tryed ur program in my program and the original count down timer stopped counting down and just stayed at 60 seconds..your program also printed another time on my screen but it was counting up from 0..when paused the new timer stopped and then unpaused it would jump up to wotever it should be at... ie start at 0..pause at 10..pause for 15 secs..when unpaused it jumps from 10 - 15

hmmmm...
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 26th Nov 2003 20:46
try this hope it help

You can do it if you try
muphesto
21
Years of Service
User Offline
Joined: 30th Oct 2003
Location:
Posted: 27th Nov 2003 02:34
excellent that worked
thanks alot

very apprieciated

Login to post a reply

Server time is: 2025-05-21 16:10:08
Your offset time is: 2025-05-21 16:10:08