Binary Moon Posted August 27, 2014 Share Posted August 27, 2014 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 More sharing options...
Orbital Game Studios Posted August 27, 2014 Share Posted August 27, 2014 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 More sharing options...
Videlais Posted August 28, 2014 Share Posted August 28, 2014 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.) Binary Moon 1 Link to comment Share on other sites More sharing options...
Videlais Posted August 30, 2014 Share Posted August 30, 2014 @Binary Moon: Phaser (2.1) should now detect CocoonJS.App and the 'onSuspended' and 'onActivated' events. Binary Moon 1 Link to comment Share on other sites More sharing options...
Binary Moon Posted August 31, 2014 Author Share Posted August 31, 2014 Awesome - thanks, I'll have to check that out! We just need to fix the bug with the canvas being mirrored in every direction first though Link to comment Share on other sites More sharing options...
Recommended Posts