Hey peeps... ive created a general tween function, but it doesnt work its best...
Now, ive played and played and played, and tweening has always done my head in, this function was like a godsend when i created it...
This is just the "include".
instead of "renderworld:flip", call "Renderworldtween(frames per second)
Can anyone help fix this so that it is actually the same speed on everyones computer?
Cheers
Damien
Now, ive played and played and played, and tweening has always done my head in, this function was like a godsend when i created it...
This is just the "include".
instead of "renderworld:flip", call "Renderworldtween(frames per second)
Can anyone help fix this so that it is actually the same speed on everyones computer?
Cheers
Damien
Global rendertweenskipframes#,oldrendertime# Function RenderWorldTween(fps#) Local tween#,Beforerender#,Afterrender#,tw#,framespd#,renderspd#,afps#,TWEENVAL# If rendertweenskipframes>1 Then rendertweenskipframes=0 If rendertweenskipframes>0.99999999999 Then rendertweenskipframes#=rendertweenskipframes#-1:Goto skiprendertween tween#=0 Repeat If tween#=0 Then beforerender=oldrendertime TWEENVAL#=TWEEN# ;If tween#>1 Then Goto Dontrenderthisbit If rendertweenskipframes<1 Then tweenVAL#=tween#+rendertweenskipframes:rendertweenskipframes=0 om=MilliSecs() ;If tweenval=0 Then RenderWorld tweenVAL# If debugtext=1 Then ;---------------------------------------------------------------------------- ;---PLACE DEBUG AND DRAWING STUFF HERE---- ;-----Note, 2D stuff will NOT be tweened for obvious---- ;-----reasons ---- ;--------------------------------------------------------------------------- EndIf Flip 0 If tween#=0 Then afterrender=MilliSecs() renderspd#=afterrender-beforerender:framespd#=1000.0/fps# tw#=renderspd#/framespd# If tw#<.000001 Then tw#=1 If tw>5 Then tw=5 ;To stop endless loops EndIf DebugLog tween#+" "+tw# tween#=tween#+tw# If twEEN>1 Then rendertweenskipframes#=rendertweenskipframes#+TWEEN#-1 .Dontrenderthisbit Until tween#>=1 .skiprendertween CaptureWorld oldrendertime#=MilliSecs() End Function