Pause physics timer
Posted: Sun Jan 04, 2009 1:03 pm
Hello,
If you use MoveEntity with enabled physics it will calculate the movement through currentMovingTime - lastTimeMoved. It would be nice if we could pause this somehow, e.g. for making a pause function in the game without loosing speed or making big jumps after returning to the game.
This functions can be implemented like this:
If you use MoveEntity with enabled physics it will calculate the movement through currentMovingTime - lastTimeMoved. It would be nice if we could pause this somehow, e.g. for making a pause function in the game without loosing speed or making big jumps after returning to the game.
This functions can be implemented like this:
Code: Select all
Global timer3Dphysics
Procedure Pause3DPhysicsTimer()
Shared pauseTime
pauseTime = ElapsedMilliseconds()
EndProcedure
Procedure Resume3DPhysicsTimer()
Shared pauseTime
timer3Dphysics + (ElapsedMilliseconds() - pauseTime)
EndProcedure