Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pausing a game by stopping Pixi's tickers #4

Closed
CosmoMyzrailGorynych opened this issue Aug 12, 2019 · 0 comments
Closed

Pausing a game by stopping Pixi's tickers #4

CosmoMyzrailGorynych opened this issue Aug 12, 2019 · 0 comments

Comments

@CosmoMyzrailGorynych
Copy link
Collaborator

In GitLab by @Comigo on Feb 24, 2019, 21:57

The code to pause the game is as following:

PIXI.ticker.shared.speed = 0;
ct.pixiApp.ticker.speed = 0;

And, to unpause:

PIXI.ticker.shared.speed = 1;
ct.pixiApp.ticker.speed = 1;

But it should be documented as a quick tip/tutorial in the docs, because one will never guess on how to do that, even with Pixi.js docs.

From Discord server:

If you are using ct.delta all over your game code, a simple line [...] must effectively disable motion of everything that uses that ct.delta. Default movement system with this.speed and this.direction is included here as well. At this point, the game loop will still work, meaning that UI and stuff will be responsible.
To set ct.delta back to normal, run [...].
So you need to:

  1. Spawn a pause menu;
  2. Set both tickers to 0;
  3. Set them back to 1 when a player presses the "unpause" button
@CosmoMyzrailGorynych CosmoMyzrailGorynych transferred this issue from ct-js/ct-js-old Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant