I'm sortof confused on this. I got a delta time routine on this site. I'm not even sure if delta is the best way to go. I've only found a thousand topics on it. Like in allegro the way I set up the time the keyboard and logic was seperate from the drawing. So im wandering if I do the same with delta. Its very jumpy now with both of them in the same loop.. Its set up like this.
its just what im working with now. Not sure if this is even the best method. Thanks for any help.
While (Not KeyHit(KEY_ESCAPE)) DLT_RefreshDLT() DLT_MyAppDelta.SetNewFPS(65.0) If (DLT_MyScreenUpdate > DLT_MyAppRefresh) Then Cls() DLT_UpdateScreen(DLT_MyScreenUpdate , player) DLT_MyScreenUpdate = DLT_MyScreenUpdate - DLT_MyAppRefresh Flip(False) EndIf Wend Function DLT_UpdateScreen(DeltaTime:Float = 1 , pl:Player_T) Local DLT_GetDeltaFPS = DLT_MyAppDelta.GetDeltaFPS() Local DLT_GetRealFPS = DLT_MyAppDelta.GetRealFPS() pl.UpdateDraw() pl.UpdateLogic(DeltaTime) pl.UpdateKeyboard(DeltaTime) DrawText("FPS : "+DLT_GetRealFPS , 0 , 0) End Function
Type Player_T Field x: Float Field y: Float Field img: TImage Field frame: Int Field animTimer: Int = MilliSecs() Field animSpeed: Int = 150 Field walk: Byte Field stand: Byte = 0 Field walkFwd: Byte = 1 Field walkBack: Byte = 2 Field walkRight: Byte = 3 Field walkLeft: Byte = 4 Method CreatePlayer(x:Float , y:Float) self.x = x self.y = y self.walk = walkFwd End Method Method UpdateDraw() self.AnimateUpdate() DrawImage(self.img , x , y , self.frame) End Method Method UpdateLogic(deltTime:Float) End Method Method UpdateKeyboard(deltTime:Float) Select self.walk Case (KeyDown(KEY_UP)) self.walk = walkFwd self.y :- (1.5 * deltTime) Case (KeyDown(KEY_DOWN)) self.walk = walkBack self.y :+ (1.5 * deltTime) Case (KeyDown(KEY_RIGHT)) self.walk = walkRight self.x :+ (1.5 * deltTime) Case (KeyDown(KEY_LEFT)) self.walk = walkLeft self.x :- (1.5 * deltTime) Default self.walk = stand End Select End Method Method AnimateUpdate() Select self.walk Case walkFwd self.WalkFwdAnimate() Case walkBack Case walkRight Case walkLeft Default self.frame = 0 End Select End Method Method WalkFwdAnimate() If ((MilliSecs() - animTimer) > animSpeed) animTimer = MilliSecs() self.frame :+ 1 EndIf If (self.frame > 1) self.frame = 0 End Method End Type
its just what im working with now. Not sure if this is even the best method. Thanks for any help.