Dark Bit Factory & Gravity
PROGRAMMING => Other languages => Blitz => Topic started by: Hotshot on March 16, 2007
-
Graphics 640,480,16,2
SetBuffer BackBuffer()
Time=MilliSecs()
Repeat
Text 0,0,time
Until MilliSecs() < Time + 20000 ; 20 seconds
I got the demo up and running but I want to know how do in 20 seconds timer?
I am getting abit mixed up!
cheers
-
Should work, dunno I don't have Blitz on this computer :D
Graphics 640,480,16,2
SetBuffer BackBuffer()
Time=MilliSecs()
Repeat
Text 0,0,MilliSecs()-time
Flip
Cls
Until (MilliSecs() - Time) >= 20000 ; 20 seconds
-
@Hotshot you just got the < the wrong way round ;)
Graphics 640,480,16,2
SetBuffer BackBuffer()
Time=MilliSecs()
Repeat
Text 0,0,time
Until MilliSecs() > Time + 20000 ; 20 seconds
-
I nearly got it right but thank for helping and also I put
delay(1000) to slow the timer down.
that great
cheers
-
When you put your delay of 1000 in you will slow your whole program down..
There is also a problem with the code you and paul posted, you won't be able to see the timer because you never cleared the screen...
Use this instead; (not tested but if I don't know how to write a blitz program by now I should be ashamed :P )
;----------------
; Open Screen;
;----------------
Graphics 640,480,16,2
SetBuffer BackBuffer()
Global Time=MilliSecs()
;----------------
; Main Loop Repeats until 20 seconds is over or escape pressed.
;----------------
Repeat
clock()
Flip
Cls
Until (MilliSecs() - Time) >= 20000 Or KeyDown(1)
;----------------
; Display How Many Seconds Have Passed.
;----------------
Function clock()
elapsed = (MilliSecs()-time) /1000
Text 0,0,elapsed
End Function
-
Damn shockwave beat me to it....
And yeah, if you are using delay(1000), then it will also delay the rest of your program so you will only get 1 frame per second.
By dividing the time by 1000, you can chop off the milliseconds :)
-
works like a charm SW!
-
Thanks :)
Lol, sorry Mike. I didn't realise you were replying to him.
Let's hope that Hotshot saw the code otherwise he will have an intro with an.. erm.. Choppy frame rate ;)