If Events(QS_INPUT) Then
DoEvents
If Frame = 0 Then
If KeyPressed(DIK_UP) Then
Let Moving = Player.Move(Map, DirectionUp)
ElseIf KeyPressed(DIK_RIGHT) Then
Let Moving = Player.Move(Map, DirectionRight)
ElseIf KeyPressed(DIK_DOWN) Then
Let Moving = Player.Move(Map, DirectionDown)
ElseIf KeyPressed(DIK_LEFT) Then
Let Moving = Player.Move(Map, DirectionLeft)
End If
End If
End If
If Moving Then
If DX.TickCount - LastFrames >= 150 Then
Let Frame = Frame + 1
If Frame > 4 Then
Let Frame = 0
Let Moving = Not True
End If
Select Case Player.Direction
Case DirectionDown
Let xPlr = xPlr - TileStepWidth
Let yPlr = yPlr + TileStepHeight
Case DirectionUp
Let xPlr = xPlr + TileStepWidth
Let yPlr = yPlr - TileStepHeight
Case DirectionRight
Let xPlr = xPlr + TileStepWidth
Let yPlr = yPlr + TileStepHeight
Case DirectionLeft
Let xPlr = xPlr - TileStepWidth
Let yPlr = yPlr - TileStepHeight
End Select
Let LastFrames = DX.TickCount
End If
End If