Class: Scene

Phaser. Scene

A base Phaser.Scene class which can be extended for your own use.

You can also define the optional methods init(), preload(), and create().


new Scene(config)

Parameters:
Name Type Description
config string | Phaser.Types.Scenes.SettingsConfig

Scene specific configuration settings.

Since: 3.0.0
Source: src/scene/Scene.js (Line 10)

Members


add :Phaser.GameObjects.GameObjectFactory

A scene level Game Object Factory. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 118)

anims :Phaser.Animations.AnimationManager

A reference to the global Animation Manager. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 48)

cache :Phaser.Cache.CacheManager

A reference to the global Cache. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 58)

cameras :Phaser.Cameras.Scene2D.CameraManager

A scene level Camera System. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 108)

children :Phaser.GameObjects.DisplayList

A scene level Game Object Display List. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 148)

data :Phaser.Data.DataManager

A scene level Data Manager Plugin. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 168)

events :Phaser.Events.EventEmitter

A scene level Event Emitter. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 98)

facebook :Phaser.FacebookInstantGamesPlugin

A scene level Facebook Instant Games Plugin. This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.

Type:
Since: 3.12.0
Source: src/scene/Scene.js (Line 240)

game :Phaser.Game

A reference to the Phaser.Game instance. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 38)

input :Phaser.Input.InputPlugin

A scene level Input Manager Plugin. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 178)

lights :Phaser.GameObjects.LightsManager

A scene level Lights Manager Plugin. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 158)

load :Phaser.Loader.LoaderPlugin

A scene level Loader Plugin. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 188)

make :Phaser.GameObjects.GameObjectCreator

A scene level Game Object Creator. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 128)

matter :Phaser.Physics.Matter.MatterPhysics

A scene level Matter Physics Plugin. This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 228)

physics :Phaser.Physics.Arcade.ArcadePhysics

A scene level Arcade Physics Plugin. This property will only be available if defined in the Scene Injection Map, the plugin is installed and configured.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 218)

plugins :Phaser.Plugins.PluginManager

A reference to the Plugin Manager.

The Plugin Manager is a global system that allows plugins to register themselves with it, and can then install those plugins into Scenes as required.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 261)

registry :Phaser.Data.DataManager

A reference to the game level Data Manager. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 68)

renderer :Phaser.Renderer.Canvas.CanvasRenderer|Phaser.Renderer.WebGL.WebGLRenderer

A reference to the renderer instance Phaser is using, either Canvas or WebGL.

Type:
Since: 3.50.0
Source: src/scene/Scene.js (Line 273)

scale :Phaser.Scale.ScaleManager

A reference to the global Scale Manager. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.16.2
Source: src/scene/Scene.js (Line 251)

scene :Phaser.Scenes.ScenePlugin

A reference to the Scene Manager Plugin. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 138)

sound :Phaser.Sound.BaseSoundManager

A reference to the Sound Manager. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 78)

sys :Phaser.Scenes.Systems

The Scene Systems. You must never overwrite this property, or all hell will break lose.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 29)

textures :Phaser.Textures.TextureManager

A reference to the Texture Manager. This property will only be available if defined in the Scene Injection Map.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 88)

time :Phaser.Time.Clock

A scene level Time and Clock Plugin. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 198)

tweens :Phaser.Tweens.TweenManager

A scene level Tween Manager Plugin. This property will only be available if defined in the Scene Injection Map and the plugin is installed.

Type:
Since: 3.0.0
Source: src/scene/Scene.js (Line 208)

Methods


update(time, delta)

Should be overridden by your own Scenes. This method is called once per game step while the scene is running.

Parameters:
Name Type Description
time number

The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.

delta number

The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

Since: 3.0.0
Source: src/scene/Scene.js (Line 283)