Yes, that's right. The Box2D update call (b2.World.step) would also be in "update", so in pause mode, update doesn't call that and all physics objects are suspended in mid air. Of course touch listeners will still operate allowing the player to resume the game.
In a real game, you probably don't just want to pause the game like that, you probably want to have some sort of menu perhaps with its own animation. In that case, you could remove the "update" event listener and start another update listener.
@Tom2012 I am in same trouble because i am lazy pumpkin and I forgot to put the code in update subroutines in all my actor objects and when i stop box2d, ships stop moving and shooting but some non box2d weapons like flamethrower and Tesla coils still do their dirty job. Was so in a hurry to see all actors alive and forgot the base function of pausing the game.
If you use sceneManager you can just transition to a "paused" scene. Although normally as mentioned above it requires the use of a state based system - basically you have a variable with one value to represent the normal game and a second to represent the paused state, then based on the value of that variable you can choose to execute your game code or not.
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@plamen one more reason to not have too many enterframe listeners however if you keep a list of all objects, couldn't you just write a single function that removes the enterframe listeners for each object (onEnterPause) and then add's them again after (onExitPause)
WhiteTree Games - Home, home on the web, where the bits and bytes they do play! #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
@techdojo i have no problem to swap the enter frame listeners with simple update function. My objects are many but classes are not so many , its not really of a problem. I am thinking of updating logic with half of graphics update rate.
Comments
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
And with Box2D, I'm guessing you just stop it doing the step each frame?
In a real game, you probably don't just want to pause the game like that, you probably want to have some sort of menu perhaps with its own animation. In that case, you could remove the "update" event listener and start another update listener.
https://github.com/gideros/gideros
https://www.youtube.com/c/JohnBlackburn1975
Although normally as mentioned above it requires the use of a state based system - basically you have a variable with one value to represent the normal game and a second to represent the paused state, then based on the value of that variable you can choose to execute your game code or not.
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill