Ninjadoodle Posted June 8, 2018 Share Posted June 8, 2018 Hi @enpu This is a strange question and completely cool if this is impossible, but just want to double check. Currently, I am pausing my game by setting game.Timer.speed = 0; This pause happens, when I tap the settings button. I'm wondering if there is any way yo have certain objects exempt from this 'pause'. For example, I would like to pause the whole game besides the settings buttons, which I would still like to animate. This might be a complex question, and I'm happy to keep the button stationery, just wondering if there is a way to still get tweens etc. on some objects when the game timer is 0. Thank you in advance for any ideas Quote Link to comment Share on other sites More sharing options...
enpu Posted June 8, 2018 Share Posted June 8, 2018 You should use game.scene.pause and game.scene.resume functions. game.scene.pause(); This will pause all objects, tweens, timers etc and save them, and once you call game.scene.resume, it will resume all those paused elements. That means while everything is paused, you can still animate your pause/settings screen etc. Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted June 8, 2018 Author Share Posted June 8, 2018 Hi @enpu Thank you for the tip, but after trying game.scene.pause(), it doesn't seem to have an effect. When I use game.Timer.speed = 0; it stops everything, yet game.scene.pause(); doesn't seem to work. Quote Link to comment Share on other sites More sharing options...
enpu Posted June 8, 2018 Share Posted June 8, 2018 @Ninjadoodle Hmm works ok here. Can you show your code where you use game.scene.pause() ? Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted June 8, 2018 Author Share Posted June 8, 2018 @enpu - I think it might just be sprite animations that don't get paused. Pausing a tween seems to work. I think this might be a bug, but here is the code, just in case game.scene.buttonSettings.mousedown = function() { game.scene.pause(); game.scene.buttonSettings.visible = false; game.scene.ui.visible = true; game.scene.settingsBg.interactive = true; game.scene.buttonSettingsBack.interactive = true; game.scene.buttonSettingsMusic.interactive = true; game.scene.buttonSettingsAudio.interactive = true; game.scene.buttonSettingsStage.interactive = true; }; Quote Link to comment Share on other sites More sharing options...
enpu Posted June 8, 2018 Share Posted June 8, 2018 You are right, that was a bug in the pause function. I just pushed fix, let me know if it works now, thanks! Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted June 8, 2018 Author Share Posted June 8, 2018 @enpu - Perfect! Thanks heaps for the fix and the tip on using game.scene.pause() - I didn't realize that's how it worked PS. Just had to add - what an awesome feature! 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.