Jump to content

Question about game.paused


brejep
 Share

Recommended Posts

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...