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.

Newcomers DBPro Corner / timers in games

Author
Message
Kingy
20
Years of Service
User Offline
Joined: 25th Oct 2004
Location:
Posted: 9th Nov 2004 21:16
Hi can anyone tell me how to get a timer to count down in a program. I want a 1 min time limit on my game. Cheers
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Nov 2004 21:30
Timer() increments in 1/1000 second intervals.
So, 1 minute = 60,000 timer increments.

To start your timer, create a variable:

startTime = Timer()

Your game time at any given point, in seconds is now:

currentTime# = (Timer() - startTime) / 1000.0

If you want to count down, just subtract currenttime from 60.

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 9th Nov 2004 21:34
well in my first game i used a pretty simple one.


here is it:




fell free to use it in you game or program
you do NOT have to put my in the credits.

this source can be use in DBC and DBPRO.


hope i helped you


Waggames

wanna join Waggames?
then visit our site at : http://www.freewebs.com/waggames
my old forum name was: The Nerd
Kingy
20
Years of Service
User Offline
Joined: 25th Oct 2004
Location:
Posted: 9th Nov 2004 22:10
Cheers Great Help,
X_MEN
21
Years of Service
User Offline
Joined: 14th Sep 2003
Location:
Posted: 10th Nov 2004 09:41
hope this help



You can do it if you try
VietDao
20
Years of Service
User Offline
Joined: 30th Oct 2004
Location: Earth, Lovely Earth
Posted: 13th Nov 2004 15:11
Hi,
@ Waggames and Kingy:
The SLEEP() command soes not help in this case, since using it, the programme will halt, you cannot do anything in that 500 milliseconds.
And because it is a game with a time limit, how can you do anything if most of the time, the programme halts? I suggest M_MEN one, I also use that one.
That's it,
Bye then,

Login to post a reply

Server time is: 2024-11-27 15:37:38
Your offset time is: 2024-11-27 15:37:38