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.

Author
Message
Nameless
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: U.S.A.
Posted: 4th Aug 2004 23:40
In my game I want to make a minigame that involves having a timer that counts down. If anyone knows how to make a timer that counts down please tell me.thanks
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 5th Aug 2004 00:58 Edited at: 5th Aug 2004 01:00
It is really simple once you see it in action.

In your start timer section:
myTime = timer() + (mySeconds * 1000)

In your timer display section:
timeLeft = myTime - timer()
if timeLeft < 0 then timeLeft = 0
text 10,10, "Time remaining: "+str$(int(timeLeft/1000))


You can get fancier by adding tenths or hundredths of a second. But, that's all there is to it. BTW, mySeconds is a variable that you set to tell the program how long to run the counter.
--
TAZ

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1
Physics coder
20
Years of Service
User Offline
Joined: 25th May 2004
Location: United States
Posted: 5th Aug 2004 14:45
I'm using this timer function for my game, it converts a number of milliseconds into a 00:00:00 format.



-----------------------------------
To delete the bug, delete the code.
Specs: Sony VAIO Laptop, Windows XP, P4 2.8Ghz, 512MB RAM, ATI Radeon 64MB video memory, DBP Upgrade 5.3.

Login to post a reply

Server time is: 2024-11-27 04:48:11
Your offset time is: 2024-11-27 04:48:11