Pause System
The Pause System provides a flexible way to pause and resume entities in your game. This system allows you to selectively pause certain entities while allowing others to continue updating, giving you fine-grained control over your game's pause behavior.
Overview
The Pause System consists of two main components:
PauseComponent- A component that already is attached to ActorsPauseSystem- A system that manages pause state across all entities in a scene
Quick Start
ts// Create an actor that can be pausedconstplayer = newex .Actor ({x : 100,y : 100,canPause : true });scene .add (player );// Pause the scenescene .pauseScene ();// Resume the scenescene .resumeScene ();
ts// Create an actor that can be pausedconstplayer = newex .Actor ({x : 100,y : 100,canPause : true });scene .add (player );// Pause the scenescene .pauseScene ();// Resume the scenescene .resumeScene ();
PauseComponent
The PauseComponent tracks whether an entity is currently paused and whether it can be paused.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
paused | boolean | false | Whether the entity is currently paused (read-only, managed by the system) |
canPause | boolean | false | Whether this entity can be paused by the scene |
Scene Events
Scenes now have pauseScene() and resumeScene() methods that emit out the pause state of the scene.
If you have UI elements, like a Pause Menu for example, that you want to respond to those events, you can listen to the scene's events emitter.