spinnerbox Posted May 11, 2016 Share Posted May 11, 2016 I found there are two different approaches on how to pause game. game.pause = true; efectively pauses all subsystems in the game including the buttons, so I cannot press on them if this property is set to true. Yes I found this example http://phaser.io/examples/v2/misc/pause-menu which calculates where you pressed and if the click was on the pause btn it unpauses the game. I have just two sprites with two text objects above them. They move as text boxes togheter and fall down to the ground. Once they reach(hit) the ground the game is over. I also found this property Physics.Arcade.isPaused which I cannot find in Phaser 2.2.2 documentation and my browser as well tells me that this property does not exits. What is the best way to stop two text boxes to fall down when I press a pause button but being able to press that button again? Should I use some hacks like remove update function and then add it again or something like set sprite velocity to 0 and then revert it back again to 100.? Link to comment Share on other sites More sharing options...
spinnerbox Posted May 11, 2016 Author Share Posted May 11, 2016 pauseUnpauseGame: function () { if (leftLetterBox.paused) { leftLetterBox.unpause(); rightLetterBox.unpause(); } else { leftLetterBox.pause(); rightLetterBox.pause(); } } letterBox.paused = false; letterBox.pause = function () { letterBox.graphics.body.velocity.y = 0; letterBox.paused = true; }; letterBox.unpause = function () { letterBox.graphics.body.velocity.y = si.Const.SPEED_EASY; letterBox.paused = false; }; Where leftLetterBox and rightLetterBox are of type letterBox. This did the job Link to comment Share on other sites More sharing options...
Recommended Posts