new ScenePlugin(scene)
name | type | description |
---|---|---|
scene | Phaser.Scene |
The Scene that this ScenePlugin belongs to. |
The key of the Scene this ScenePlugin belongs to.
The settings of the Scene this ScenePlugin belongs to.
The Scene Systems instance of the Scene that this ScenePlugin belongs to.
If this Scene is currently transitioning to another, this holds the current percentage of the transition progress, between 0 and 1.
Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene key. |
|
sceneConfig | function | Phaser.Scene | Phaser.Types.Scenes.SettingsConfig | Phaser.Types.Scenes.CreateSceneFromObjectConfig |
The config for the Scene. |
|
autoStart | boolean |
Whether to start the Scene after it's added. |
|
data | object | <optional> |
Optional data object. This will be set as Scene.settings.data and passed to |
An instance of the Scene that was added to the Scene Manager.
Brings a Scene to the top of the Scenes list.
This means it will render above all other Scenes.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to move. |
This ScenePlugin object.
Retrieve a Scene.
name | type | description |
---|---|---|
key | string |
The Scene to retrieve. |
The Scene.
Retrieves the numeric index of a Scene in the Scenes list.
name | type | arguments | description |
---|---|---|---|
key | string | Phaser.Scene | <optional> |
The Scene to get the index of. |
The index of the Scene.
Checks if the given Scene is running or not?
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to check. |
Whether the Scene is running.
Checks if the given Scene is paused or not?
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to check. |
Whether the Scene is paused.
Checks if the given Scene is sleeping or not?
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to check. |
Whether the Scene is sleeping.
Checks if the given Scene is visible or not?
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to check. |
Whether the Scene is visible.
Launch the given Scene and run it in parallel with this one.
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to launch. |
|
data | object | <optional> |
The Scene data. |
This ScenePlugin object.
Swaps the position of two scenes in the Scenes list, so that Scene B is directly above Scene A.
This controls the order in which they are rendered and updated.
name | type | arguments | description |
---|---|---|---|
keyA | string |
The Scene that Scene B will be moved to be above. |
|
keyB | string | <optional> |
The Scene to be moved. If none is given it defaults to this Scene. |
This ScenePlugin object.
Swaps the position of two scenes in the Scenes list, so that Scene B is directly below Scene A.
This controls the order in which they are rendered and updated.
name | type | arguments | description |
---|---|---|---|
keyA | string |
The Scene that Scene B will be moved to be below. |
|
keyB | string | <optional> |
The Scene to be moved. If none is given it defaults to this Scene. |
This ScenePlugin object.
Moves a Scene down one position in the Scenes list.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to move. |
This ScenePlugin object.
Moves a Scene up one position in the Scenes list.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to move. |
This ScenePlugin object.
Pause the Scene - this stops the update step from happening but it still renders.
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to pause. |
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted in its pause event. |
This ScenePlugin object.
Removes a Scene from the SceneManager.
The Scene is removed from the local scenes array, it's key is cleared from the keys cache and Scene.Systems.destroy is then called on it.
If the SceneManager is processing the Scenes when this method is called it will queue the operation for the next update sequence.
name | type | arguments | description |
---|---|---|---|
key | string | Phaser.Scene | <optional> |
The Scene to be removed. |
This SceneManager.
Restarts this Scene.
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
data | object | <optional> |
The Scene data. |
This ScenePlugin object.
Resume the Scene - starts the update loop again.
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to resume. |
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted in its resume event. |
This ScenePlugin object.
Runs the given Scene, but does not change the state of this Scene.
This will happen at the next Scene Manager update, not immediately.
If the given Scene is paused, it will resume it. If sleeping, it will wake it. If not running at all, it will be started.
Use this if you wish to open a modal Scene by calling pause
on the current
Scene, then run
on the modal Scene.
name | type | arguments | description |
---|---|---|---|
key | string |
The Scene to run. |
|
data | object | <optional> |
A data object that will be passed to the Scene and emitted in its ready, wake, or resume events. |
This ScenePlugin object.
Sends a Scene to the back of the Scenes list.
This means it will render below all other Scenes.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to move. |
This ScenePlugin object.
Sets the active state of the given Scene.
name | type | arguments | description |
---|---|---|---|
value | boolean |
If |
|
key | string | <optional> |
The Scene to set the active state of. |
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted with its events. |
This ScenePlugin object.
Sets the visible state of the given Scene.
name | type | arguments | description |
---|---|---|---|
value | boolean |
The visible value. |
|
key | string | <optional> |
The Scene to set the visible state for. |
This ScenePlugin object.
Makes the Scene sleep (no update, no render) but doesn't shutdown.
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to put to sleep. |
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted in its sleep event. |
This ScenePlugin object.
Shutdown this Scene and run the given one.
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to start. |
data | object | <optional> |
The Scene data. |
This ScenePlugin object.
Shutdown the Scene, clearing display list, timers, etc.
This happens at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to stop. |
data | any | <optional> |
Optional data object to pass to Scene.Systems.shutdown. |
This ScenePlugin object.
Swaps the position of two scenes in the Scenes list.
This controls the order in which they are rendered and updated.
name | type | arguments | description |
---|---|---|---|
keyA | string |
The first Scene to swap. |
|
keyB | string | <optional> |
The second Scene to swap. If none is given it defaults to this Scene. |
This ScenePlugin object.
Makes this Scene sleep then starts the Scene given.
This will happen at the next Scene Manager update, not immediately.
name | type | description |
---|---|---|
key | string |
The Scene to start. |
This ScenePlugin object.
This will start a transition from the current Scene to the target Scene given.
The transition will last for the duration specified in milliseconds.
You can have the target Scene moved above or below this one in the display list.
You can specify an update callback. This callback will be invoked every frame for the duration of the transition.
This Scene can either be sent to sleep at the end of the transition, or stopped. The default is to stop.
There are also 5 transition related events: This scene will emit the event transitionout
when
the transition begins, which is typically the frame after calling this method.
The target Scene will emit the event transitioninit
when that Scene's init
method is called.
It will then emit the event transitionstart
when its create
method is called.
If the Scene was sleeping and has been woken up, it will emit the event transitionwake
instead of these two,
as the Scenes init
and create
methods are not invoked when a Scene wakes up.
When the duration of the transition has elapsed it will emit the event transitioncomplete
.
These events are cleared of all listeners when the Scene shuts down, but not if it is sent to sleep.
It's important to understand that the duration of the transition begins the moment you call this method. If the Scene you are transitioning to includes delayed processes, such as waiting for files to load, the time still counts down even while that is happening. If the game itself pauses, or something else causes this Scenes update loop to stop, then the transition will also pause for that duration. There are checks in place to prevent you accidentally stopping a transitioning Scene but if you've got code to override this understand that until the target Scene completes it might never be unlocked for input events.
name | type | description |
---|---|---|
config | Phaser.Types.Scenes.SceneTransitionConfig |
The transition configuration object. |
true
is the transition was started, otherwise false
.
Makes the Scene wake-up (starts update and render)
This will happen at the next Scene Manager update, not immediately.
name | type | arguments | description |
---|---|---|---|
key | string | <optional> |
The Scene to wake up. |
data | object | <optional> |
An optional data object that will be passed to the Scene and emitted in its wake event. |
This ScenePlugin object.