I want to create an onscreen pause button in andengine
What I do now is add an sprite and when I touch it, I do engine.stop(), the problem with this, is that the engine doesn't handle more touchevents till I resume the game (now I use the menu button for this), so is there a way to achieve it?
Thanks!
Look at the AndEngine's examples, there is a project that shows the use of menus in AndEngine, you'll find a better way of implementing a menu other than stopping the engine. Good luck!
I found the best way to do it is creating an scene, and when paused, set override the onManagedUpdate this way
@Override
onManagedUpdate(float pSecondsElapsed){
if(mPaused) super.onManagedUpdate(0);
else super.onManagedUpdate(pSecondsElapsed);
}
This way everything works perfectly, and you can do it on a game layer and have the menu layer updated as usual,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With