brejep Posted January 30, 2014 Share Posted January 30, 2014 I notice with a lot of events, like focus/blur or clicking the game, games are automatically unpaused. For example, this issue: https://github.com/photonstorm/phaser/issues/36 was resolved by unpausing when the game receives a click event. This means that if I set game.paused to true, the next time a player clicks the game the game unpauses. I was wondering what is my best option if I want to force the game to be paused regardless of whether the user clicks the game? For example, player clicks a pause button and I want to keep the game showing in the background. Should I just listen for the onPause and onResume signals and reset to game.paused = true; or is there a better way to override the default behaviour? Link to comment Share on other sites More sharing options...
rich Posted January 30, 2014 Share Posted January 30, 2014 It no longer un-pauses on click events. I forget which version I fixed this in, sorry! But it definitely doesn't do it any more. Link to comment Share on other sites More sharing options...
brejep Posted January 30, 2014 Author Share Posted January 30, 2014 I think I was doing game.paused = true in a create function for the game. Then when a visibilityChanged event happened, when the game regained focus, the game unpaused. However, I realised if I put game.paused = true in the update loop it paused until I changed it to game.paused = false. Link to comment Share on other sites More sharing options...
Recommended Posts