Namespace: Scenes

Phaser.Types. Scenes

Type Definitions


CreateSceneFromObjectConfig

Type:
  • object
Properties:
Name Type Argument Description
init Phaser.Types.Scenes.SceneInitCallback <optional>

The scene's init callback.

preload Phaser.Types.Scenes.ScenePreloadCallback <optional>

The scene's preload callback.

create Phaser.Types.Scenes.SceneCreateCallback <optional>

The scene's create callback.

update function <optional>

The scene's update callback. See Phaser.Scene#update.

extend any <optional>

Any additional properties, which will be copied to the Scene after it's created (except data or sys).

Properties
Name Type Argument Description
data any <optional>

Any values, which will be merged into the Scene's Data Manager store.

Since: 3.17.0
Source: src/scene/typedefs/CreateSceneFromObjectConfig.js (Line 1)

SceneCreateCallback(data)

Can be defined on your own Scenes. Use it to create your game objects. This method is called by the Scene Manager when the scene starts, after init() and preload(). If the LoaderPlugin started after preload(), then this method is called only after loading is complete.

Parameters:
Name Type Description
data object

Any data passed via ScenePlugin.add() or ScenePlugin.start(). Same as Scene.settings.data.

Since: 3.0.0
Source: src/scene/typedefs/SceneCreateCallback.js (Line 1)

SceneInitCallback(data)

Can be defined on your own Scenes. This method is called by the Scene Manager when the scene starts, before preload() and create().

Parameters:
Name Type Description
data object

Any data passed via ScenePlugin.add() or ScenePlugin.start(). Same as Scene.settings.data.

Since: 3.0.0
Source: src/scene/typedefs/SceneInitCallback.js (Line 1)

ScenePreloadCallback()

Can be defined on your own Scenes. Use it to load assets. This method is called by the Scene Manager, after init() and before create(), only if the Scene has a LoaderPlugin. After this method completes, if the LoaderPlugin's queue isn't empty, the LoaderPlugin will start automatically.

Since: 3.0.0
Source: src/scene/typedefs/ScenePreloadCallback.js (Line 1)

SceneTransitionConfig

Type:
  • object
Properties:
Name Type Argument Default Description
target string

The Scene key to transition to.

duration number <optional>
1000

The duration, in ms, for the transition to last.

sleep boolean <optional>
false

Will the Scene responsible for the transition be sent to sleep on completion (true), or stopped? (false)

remove boolean <optional>
false

Will the Scene responsible for the transition be removed from the Scene Manager after the transition completes?

allowInput boolean <optional>
false

Will the Scenes Input system be able to process events while it is transitioning in or out?

moveAbove boolean <optional>

Move the target Scene to be above this one before the transition starts.

moveBelow boolean <optional>

Move the target Scene to be below this one before the transition starts.

onUpdate function <optional>

This callback is invoked every frame for the duration of the transition.

onUpdateScope any <optional>

The context in which the callback is invoked.

data any <optional>

An object containing any data you wish to be passed to the target scene's init / create methods (if sleep is false) or to the target scene's wake event callback (if sleep is true).

Since: 3.5.0
Source: src/scene/typedefs/SceneTransitionConfig.js (Line 1)

SettingsConfig

Type:
  • object
Properties:
Name Type Argument Default Description
key string <optional>

The unique key of this Scene. Must be unique within the entire Game instance.

active boolean <optional>
false

Does the Scene start as active or not? An active Scene updates each step.

visible boolean <optional>
true

Does the Scene start as visible or not? A visible Scene renders each step.

pack false | Phaser.Types.Loader.FileTypes.PackFileSection <optional>
false

Files to be loaded before the Scene begins.

cameras Phaser.Types.Cameras.Scene2D.JSONCamera | Array.<Phaser.Types.Cameras.Scene2D.JSONCamera> <optional>
<nullable>
null

An optional Camera configuration object.

map Object.<string, string> <optional>

Overwrites the default injection map for a scene.

mapAdd Object.<string, string> <optional>

Extends the injection map for a scene.

physics Phaser.Types.Core.PhysicsConfig <optional>
{}

The physics configuration object for the Scene.

loader Phaser.Types.Core.LoaderConfig <optional>
{}

The loader configuration object for the Scene.

plugins false | * <optional>
false

The plugin configuration object for the Scene.

Since: 3.0.0
Source: src/scene/typedefs/SettingsConfig.js (Line 1)

SettingsObject

Type:
  • object
Properties:
Name Type Argument Description
status number

The current status of the Scene. Maps to the Scene constants.

key string

The unique key of this Scene. Unique within the entire Game instance.

active boolean

The active state of this Scene. An active Scene updates each step.

visible boolean

The visible state of this Scene. A visible Scene renders each step.

isBooted boolean

Has the Scene finished booting?

isTransition boolean

Is the Scene in a state of transition?

transitionFrom Phaser.Scene <nullable>

The Scene this Scene is transitioning from, if set.

transitionDuration number

The duration of the transition, if set.

transitionAllowInput boolean

Is this Scene allowed to receive input during transitions?

data object

a data bundle passed to this Scene from the Scene Manager.

pack false | Phaser.Types.Loader.FileTypes.PackFileSection

Files to be loaded before the Scene begins.

cameras Phaser.Types.Cameras.Scene2D.JSONCamera | Array.<Phaser.Types.Cameras.Scene2D.JSONCamera> <nullable>

The Camera configuration object.

map Object.<string, string>

The Scene's Injection Map.

physics Phaser.Types.Core.PhysicsConfig

The physics configuration object for the Scene.

loader Phaser.Types.Core.LoaderConfig

The loader configuration object for the Scene.

plugins false | *

The plugin configuration object for the Scene.

Since: 3.0.0
Source: src/scene/typedefs/SettingsObject.js (Line 1)