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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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