In my game, when I pause the game using mEngine.stop() it works perfectly but when I press resume button that has code mEngine.start() it provide some movement to the physics body. So the created body does not stand at its desire position after the resuming the game. That fault I have found in other game developed by other developer also. So please provide some guidance for it. I also tried with mScene.onUpdate(0) and mScene.onUpdate(1) but I does not able to found anything new from it.
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
I think it is caused by a spike in CPU usage when you resume the game. Box2D works on a best-effort basis so when the CPU is being overloaded momentarily, the Box2D execution drops to too small a number of steps per second. This causes problems. There are two things you can do to improve the situation. a) Let the engine sleep for a while after the resume button is pressed. b) Implement MaxStepPhysicsWorld, you will find it on the AndEngine forums. It allows you to set a minimum steps the engine has to calculate each second and if it cannot keep up, the execution will slow down but it will not break down like this. |
|||||
|
