Main Menu

timers

Started by Bustaballs, February 21, 2006, 10:38:32 PM

Previous topic - Next topic

Bustaballs

Is there anyway to program a timer similar to the VB timer?
QuoteOh please

kevin

No you can't create events.


What are trying to do ?

Bustaballs

I'm basically trying to port my code for a game I was working on (www.bigbagofthings.bravehost.com) to playbasic.  I was planning on using some kind of timer for movement animations.
QuoteOh please

Digital Awakening

There should be a way to check the internal clock in miliseconds if I'm not mistaking (I'm not on my PB computer). Try Time() and by checking the difference between the current and the previous sync you know how much time has passed.
Wisit my site at: DigitalAwakening.net

Bustaballs

ok I found the timer command.. it gave this example code:

; Get the current internal system time
 time = Timer()
 Do
    Box 0, 1, Progress, 20, 1
 ; If 1000 ms have passed increase the variable Progress
    If Timer() - time >= 1000
       Progress = Progress + 5
    ; set the variable time to the current time
       time = Timer()
    EndIf
    Sync
 Loop


seems simple enough to use for animations =)

Are there anymore simple games I can learn from (like the pong one)?
QuoteOh please

Bustaballs

I'm sorry that I keep asking questions and then answering my own questions from reading the help files.  I'll be sure to look more carefully from now on.
QuoteOh please

Tracy

QuoteI'm sorry that I keep asking questions and then answering my own questions from reading the help files.  I'll be sure to look more carefully from now on.

Happens to me ALL the time. We newbies are lucky Kevin's as patient as he is. (And that there are a buch of other really cool people on these forums)

Good Luck.