Jump to content

CocoonJS - pause game on app switch


Binary Moon
 Share

Recommended Posts

I am making a Phaser game that I will publish with cocoonjs and it doesn't behave very well when I switch apps. The timer keeps counting and sounds go a bit crazy. I'd really like to be able to use some sort of callback within CocoonJS to pause the game - but I have searched and can't find anything. Does anyone have any experience of this or know how I could do it?

 

Thanks

Link to comment
Share on other sites

There are a couple of ways to deal with this, however, one of them is a little strange as far as Phaser goes. I've been trying to fix a bug in my game that is related to what you are describing here. 

 

You may find this thread insightful: http://www.html5gamedevs.com/topic/8561-timers-not-pausing-when-window-loses-focus/

Link to comment
Share on other sites

Something we might have to do is watch CocoonJS.App.onSuspended and CocoonJS.App.onActivated as part of that same checkVisibilitityChange() function within game.stage.

 

However, before we can do that, someone probably needs to put a check within the Phaser.Device code for the global variable CocoonJS.App. (And there's a conversation to be had if the current check is enough, or if it should be combined or separated into two different checks: one for the CocoonJS environment and another for if CocoonJS.App exists.)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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