Pause physics timer

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Pause physics timer

Post by DarkDragon »

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:

Code: Select all

Global timer3Dphysics

Procedure Pause3DPhysicsTimer()
  Shared pauseTime
  pauseTime = ElapsedMilliseconds()
EndProcedure

Procedure Resume3DPhysicsTimer()
  Shared pauseTime
  timer3Dphysics + (ElapsedMilliseconds() - pauseTime)
EndProcedure
bye,
Daniel
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

sounds perfectly reasonable!
oh... and have a nice day.
Post Reply