Binary Moon

CocoonJS - pause game on app switch

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

Share this post


Link to post
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/

Share this post


Link to post
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.)

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.