Frames per second

Blitz3D Forums/Blitz3D Beginners Area/Frames per second

Hi, can someone please help me make this so no matter what you change the fps to, the box always covers the same distance in a second? That way, at lower fps it will move several pixels each frame to make up for movement that wasn't shown.

; SETUP

AppTitle ""
Graphics 640,480,32,1
SetBuffer BackBuffer()
SeedRnd MilliSecs()
ArialBold=LoadFont("arial",14,True,False,False)
SetFont ArialBold
Color 127,127,127
AutoMidHandle 1

fps=1
x=100





; LOOP

While Not MouseHit(1)

RealTimer=CreateTimer(60)
WaitTimer(RealTimer)
x=x+1
FreeTimer RealTimer
; Add to the box's variable sixty times a second.

FpsTimer=CreateTimer(fps)
WaitTimer(FpsTimer)
ClsColor 7,7,7 
Cls
Rect x,200,100,100,1
FreeTimer FpsTimer
; Update the screen only once a second.

If KeyDown(205)
fps=fps+1
ElseIf KeyDown(203)
fps=fps-1
; Make it so the fps can be changed.

ElseIf x=700
x=-100
EndIf

Text 7,3,"Press left and right to change the fps."
Text 7,18,"Current fps " +fps
Color 127,127,127
Text 564,463,"Click to exit."
Color 31,31,31
Rect 0,0,640,480,0
Rect 1,1,638,478,0
Color 127,127,127
Flip

Wend





; END

FreeFont ArialBold
End


Search on the forums for deltatime or rendertweening. Waittimer and createtimer are not the commands you want to be using here.