delay example?

Blitz3D Forums/Blitz3D Beginners Area/delay example?

Ruz(Posted 2004) [#1]
can sdoemone gove me an example of the best/easiest way to do a delay.
for example an animated character does something , pauses then does something else.


DarkNature(Posted 2004) [#2]
Here you go:
;outside of main loop
delayTime=1500 ; 1 1/2 secs
time_to_wait=millisecs()+delayTime ; use 0 for no initial delay

;in main loop
if millisecs()>=time_to_wait

 doThings()
 time_to_wait=millisecs()+delayTime

end if


Have fun.


Ruz(Posted 2004) [#3]
hmm delayed answer( just kidding)


Agamer(Posted 2004) [#4]
here u go

delay 1



Zethrax(Posted 2004) [#5]
Using 'delay 1' would delay the entire program though, Agamer. The timeout method that Darknature described is the best way to do controlled delays.


Agamer(Posted 2004) [#6]
I know I was been sarcastic sorrt to stear you wrong but it can have its uses


Ruz(Posted 2004) [#7]
Yeah I know about delay Agamer, I tried that a while ago . I delayed my program while I went for a 'tom tit'

Thanks Dark nature. I will try that out, cheers man