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 / Need more Timers???

Author
Message
Colin Hart
21
Years of Service
User Offline
Joined: 28th Apr 2003
Location: United Kingdom
Posted: 26th Jun 2005 23:22
Good Afternoon All.

Thought I could sneek on here and ask afew questions whilst the relitives are downstairs chatting away...

I am using the timer() function to randomise starting positions of object in my game.. Howefer I also need to use the time function as a clock as well (or do I)?

The game is a session based shooting gallery. Each turn lasts for 30 seconds. I would like to disply a count down timer on the screen to show seconds remaining. Is there a simple way to do this? And if so how can I get teh time to appear in a digial numbering style? I know this is two q's in one.. but saves two posts...

Thank you to all who have read this far..

Cheers

Col.
James Morgan
19
Years of Service
User Offline
Joined: 17th Apr 2005
Location: Behind you
Posted: 27th Jun 2005 09:10
It wont matter how many times you use timer(), this is a set value that changes every milliseconds (wow does that make sense)
What I mean is, Timer() is 0 when you first start the computer, as the computer runs, timer increments. No matter what command you use in DB or DBPro timer will always state how long the computer has been running for with every 1000 units equaling 1 second.

When you use the command Randomize Timer(), you are not randomizing the timer but rather your are given a seed to the randomize command.
The way the command Randomize work is you give it a seed and that seed has a set of values, for example seed 1 may produce the numbers
1, 3, 7, 11, 2....
As timer() will be different EVERY loop, by using timer() as a seed, the value will ALWAYS be different.

So, to answer your question, all you need to do is create another variable:

Timer1 = timer() + 1000 - will give a timer of 1seconds, whilst
Timer2 = timer() + 2000 - will give a timer of 2seconds at the same time.

Hope this helps!

James

Hello!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Jun 2005 19:33
Quote: "And if so how can I get the time to appear in a digital numbering style?"


You need to convert the value into a string, then make the counter out of Sprites or Plains. Rather than reinvent the wheel, look in Program Announcements at Geecee's fonts contributions. In there, you will see some sample code on how to acheive this.

BatVink

Login to post a reply

Server time is: 2024-11-27 22:25:48
Your offset time is: 2024-11-27 22:25:48