Introvert Studios Posted December 16, 2013 Share Posted December 16, 2013 Using the Phaser states, I would like to be able to pause the game while retaining the ability to click onother buttons in that state. At the moment, when the game is paused it seems the engine takes over and prevents input to other buttons and such.An alternative solution for me, would be to just pause physics updates, but can't find anything that lets me do this (The end result will be a pause screen that I can input to, before un-pausing again). - Thanks'! Link to comment Share on other sites More sharing options...
Zeterain Posted December 16, 2013 Share Posted December 16, 2013 Quick fix is to just wrap all of your update calculations in an if-statement and create a custom paused variable that you set every time the paused button is pressed. I believe the more elegant solution is to use game states, and change states every time the game is paused rather than setting game.paused to true. function update() { if (!gameIsPaused) { //custom paused variable //All of your update calculations }} Link to comment Share on other sites More sharing options...
Introvert Studios Posted December 16, 2013 Author Share Posted December 16, 2013 That is something I have been trying to do, but the physics engine running prevents a pause from truly pausing I am using the Body.velocities and such, using a pause flag won't stop that part of Phaser from running Link to comment Share on other sites More sharing options...
Zeterain Posted December 16, 2013 Share Posted December 16, 2013 Oh, I see what you mean. In that case I'm not sure. You could always make your buttons html elements and have them interact with the game externally, but that might not be ideal. Link to comment Share on other sites More sharing options...
Introvert Studios Posted December 16, 2013 Author Share Posted December 16, 2013 External HTML is not a viable option for me at the moment, has to be in game Hopefully someone from the Phaser team could help me out! Link to comment Share on other sites More sharing options...
Introvert Studios Posted December 18, 2013 Author Share Posted December 18, 2013 As there was no way to do it (which is surprising as that is essential to most frameworks!) I edited the source. If anyone else is having this issue, I will happily walk through the steps! Link to comment Share on other sites More sharing options...
nicotr014 Posted February 20, 2014 Share Posted February 20, 2014 Hi Introvert, I'm having the same problem too. I use a state machine to toggle "screens" in my game. So the "Game screen" will be running, then i pause it and change it to "menu screen". When i return to "game screen", the positions of all my physics bodies jump to a position in time as if the engine was still calculating velocities. Maybe I can reset the game time to right when I paused? Or is it possible to pause all of the bodies velocities? What was your solution? Link to comment Share on other sites More sharing options...
hpcodecraft Posted February 20, 2014 Share Posted February 20, 2014 Hi, this hopefully will be available in 1.2 - see Richs post here: http://www.html5gamedevs.com/topic/2898-pause-menu/?p=18774 Link to comment Share on other sites More sharing options...
presidenten Posted April 20, 2014 Share Posted April 20, 2014 Introvert studios, Here is a way you can make a pause menu without using the DOM: https://github.com/presidenten/phaser-examples/blob/7c0befd068b99bc653a492c61519a46ce532a188/examples/misc/pause%20menu.js Link to comment Share on other sites More sharing options...
Recommended Posts