Ninjadoodle Posted November 7, 2014 Share Posted November 7, 2014 Hi guys Is there a simple way to pause the entire game (like it does when leaving the window), then resume play, by clicking / tapping a button? Just wondering whether this is possible or whether it needs to be done manually. Thank you in advance! Quote Link to comment Share on other sites More sharing options...
enpu Posted November 7, 2014 Share Posted November 7, 2014 try game.system.pause();game.system.resume(); Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 7, 2014 Author Share Posted November 7, 2014 Wow, thats awesome ... I though this was a long-shot! Panda is amazing Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 7, 2014 Share Posted November 7, 2014 If you use setInterval in your game, remember to clear the interval before resume the game.clearInterval(timerVar);game.system.resume();regards ^^ Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 7, 2014 Author Share Posted November 7, 2014 Hi @Phempt Thanks for that, I'll remember to do that Quote Link to comment Share on other sites More sharing options...
enpu Posted November 7, 2014 Share Posted November 7, 2014 It's not good idea to use setTimeout or setInterval in Panda, because they are not connected to the engine's run cycle, instead use timers. Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 7, 2014 Author Share Posted November 7, 2014 Cool, thanks for the heads up! I mostly use tweens, and onComplete, but I will make sure that I avoid setTimeout and setInterval. Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 7, 2014 Share Posted November 7, 2014 can I use timers instead setInterval? I used timers for setTimeout but not for interval, that's good, it's really annoying take care about external functions/component. Thank you enpu! Quote Link to comment Share on other sites More sharing options...
enpu Posted November 7, 2014 Share Posted November 7, 2014 Sure! Just add third parameter 'true' to addTimer:game.scene.addTimer(1000, function() {}, true); // This is same as setInterval Quote Link to comment Share on other sites More sharing options...
Phempt Posted November 7, 2014 Share Posted November 7, 2014 COOL! (unfortunately bubbles party used setInterval for game timer) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.