Jump to content

Question about game.Timer.speed


Ninjadoodle
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

@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;
};

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

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