I think this is right

Blitz3D Forums/Blitz3D Beginners Area/I think this is right

Agamer(Posted 2004) [#1]
oldtime = millisecs()

millisecs - oldtime

that will give me the amount of time passesn right



Zethrax(Posted 2004) [#2]
The value of 'oldtime' should be set to the current millisecs time after the 'millisecs - oldtime' line above rather than before it.

It's also a good idea to grab the value of the 'MilliSecs()' timer and stick it in a Global at the start of your main loop so you're not making repetitive calls to 'MilliSecs()'.

eg.

Global current_time
Global oldtime

;-----

current_time = MilliSecs()

time_elapsed = current_time - oldtime
oldtime = current_time


_PJ_(Posted 2004) [#3]
Always remember the () after Millisecs, otherwise it returns 0 or something!


cermit(Posted 2004) [#4]
yeah :) once i forgot to put () after GraphicsHeight and width in Cameraviewport command. i spent hours on trying to find out what was wrong :)

never do this
 Cameraviewport camera, 0, 0, GraphicsWidth, GraphicsHeight 



Agamer(Posted 2004) [#5]
kk


Zethrax(Posted 2004) [#6]
Another thing to remember is to set the value of 'oldtime' to the current 'MilliSecs()' time both before starting your main loop, and also after returning from a pause.