### install(key, plugin, [start], [mapping], [data]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/plugins-pluginmanager Installs a new Global Plugin into the Plugin Manager and optionally starts it running. A global plugin belongs to the Plugin Manager, rather than a specific Scene, and can be accessed and used by all Scenes in your game. The `key` property is what you use to access this plugin from the Plugin Manager. This method is called automatically by Phaser if you install your plugins using either the Game Configuration object, or by preloading them via the Loader. The same plugin can be installed multiple times into the Plugin Manager by simply giving each instance its own unique key. ```APIDOC ## Method: install(key, plugin, [start], [mapping], [data]) ### Description Installs a new Global Plugin into the Plugin Manager and optionally starts it running. A global plugin belongs to the Plugin Manager, rather than a specific Scene, and can be accessed and used by all Scenes in your game. The `key` property is what you use to access this plugin from the Plugin Manager. ``` this.plugins.install('powerupsPlugin', pluginCode); // and from within the scene: this.plugins.get('powerupsPlugin'); ``` This method is called automatically by Phaser if you install your plugins using either the Game Configuration object, or by preloading them via the Loader. The same plugin can be installed multiple times into the Plugin Manager by simply giving each instance its own unique key. ### Parameters - **key** (string) - Required - The unique handle given to this plugin within the Plugin Manager. - **plugin** (function) - Required - The plugin code. This should be the non-instantiated version. - **start** (boolean) - Optional - Default: false - Automatically start the plugin running? This is always `true` if you provide a mapping value. - **mapping** (string) - Optional - If this plugin is injected into the Phaser.Scene class, this is the property key to use. - **data** (any) - Optional - A value passed to the plugin's `init` method. ### Returns Phaser.Plugins.BasePlugin - The plugin that was started, or `null` if `start` was false, or game isn't yet booted. ``` -------------------------------- ### install(key, plugin, [start], [mapping], [data]) Source: https://docs.phaser.io/api-documentation/class/plugins-pluginmanager Installs a new Global Plugin into the Plugin Manager and optionally starts it running. A global plugin belongs to the Plugin Manager, rather than a specific Scene, and can be accessed and used by all Scenes in your game. The 'key' property is what you use to access this plugin from the Plugin Manager. ```APIDOC ## install(key, plugin, [start], [mapping], [data]) ### Description Installs a new Global Plugin into the Plugin Manager and optionally starts it running. A global plugin belongs to the Plugin Manager, rather than a specific Scene, and can be accessed and used by all Scenes in your game. The `key` property is what you use to access this plugin from the Plugin Manager. ### Parameters #### Path Parameters - **key** (string) - Required - The unique handle given to this plugin within the Plugin Manager. - **plugin** (function) - Required - The plugin code. This should be the non-instantiated version. - **start** (boolean) - Optional - Default: false - Automatically start the plugin running? This is always `true` if you provide a mapping value. - **mapping** (string) - Optional - If this plugin is injected into the Phaser.Scene class, this is the property key to use. - **data** (any) - Optional - A value passed to the plugin's `init` method. ### Response #### Success Response - **Phaser.Plugins.BasePlugin** (object) - The plugin that was started, or `null` if `start` was false, or game isn't yet booted. ``` -------------------------------- ### start(key, [runAs]) Source: https://docs.phaser.io/api-documentation/class/plugins-pluginmanager Starts a global plugin running. If the plugin was previously active then calling `start` will reset it to an active state and then call its `start` method. If the plugin has never been run before a new instance of it will be created within the Plugin Manager, its active state set and then both of its `init` and `start` methods called, in that order. If the plugin is already running under the given key then nothing happens. ```APIDOC ## start(key, [runAs]) ### Description Starts a global plugin running. If the plugin was previously active then calling `start` will reset it to an active state and then call its `start` method. If the plugin has never been run before a new instance of it will be created within the Plugin Manager, its active state set and then both of its `init` and `start` methods called, in that order. If the plugin is already running under the given key then nothing happens. ### Method start ### Parameters - **key** (string) - Required - The key of the plugin to start. - **runAs** (string) - Optional - Run the plugin under a new key. This allows you to run one plugin multiple times. ### Response #### Success Response - **Phaser.Plugins.BasePlugin** (object) - The plugin that was started, or `null` if invalid key given or plugin is already stopped. ``` -------------------------------- ### start() Source: https://docs.phaser.io/api-documentation/4.0.0/class/cameras-controls-fixedkeycontrol Starts the Key Control running, enabling camera movement via linked keys. ```APIDOC ## start() ### Description Starts the Key Control running, providing it has been linked to a camera. ### Signature start(): Phaser.Cameras.Controls.FixedKeyControl ### Returns Phaser.Cameras.Controls.FixedKeyControl - This Key Control instance. ``` -------------------------------- ### start() Source: https://docs.phaser.io/api-documentation/4.0.0/class/loader-loaderplugin Starts the Loader running. This will reset the progress and totals and then emit a `start` event. If there is nothing in the queue the Loader will immediately complete, otherwise it will start loading the first batch of files. The Loader is started automatically if the queue is populated within your Scenes `preload` method. However, outside of this, you need to call this method to start it. If the Loader is already running this method will simply return. ```APIDOC ## start() ### Description Starts the Loader running. This will reset the progress and totals and then emit a `start` event. If there is nothing in the queue the Loader will immediately complete, otherwise it will start loading the first batch of files. The Loader is started automatically if the queue is populated within your Scenes `preload` method. However, outside of this, you need to call this method to start it. If the Loader is already running this method will simply return. ### Method Signature start() ### Fires Phaser.Loader.Events#event:START ``` -------------------------------- ### START Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/scenes Scene is starting up. The create method has not yet been called. ```APIDOC ## START ### Description Scene is starting up. The create method has not yet been called. ### Type number ``` -------------------------------- ### install(target) Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/input-inputplugincache Installs all of the registered Input Plugins into the given target. ```APIDOC ## install(target) ### Description Installs all of the registered Input Plugins into the given target. ### Method (Static function) ### Parameters #### Path Parameters - **target** (Phaser.Input.InputPlugin) - Required - The target InputPlugin to install the plugins into. ``` -------------------------------- ### start Source: https://docs.phaser.io/api-documentation/4.0.0/class/plugins-pluginmanager Starts a global plugin running. If the plugin was previously active then calling `start` will reset it to an active state and then call its `start` method. If the plugin has never been run before a new instance of it will be created within the Plugin Manager, its active state set and then both of its `init` and `start` methods called, in that order. If the plugin is already running under the given key then nothing happens. ```APIDOC ## Method: start(key, [runAs]) ### Description Starts a global plugin running. If the plugin was previously active then calling `start` will reset it to an active state and then call its `start` method. If the plugin has never been run before a new instance of it will be created within the Plugin Manager, its active state set and then both of its `init` and `start` methods called, in that order. If the plugin is already running under the given key then nothing happens. ### Parameters - **key** (string) - Required - The key of the plugin to start. - **runAs** (string) - Optional - Run the plugin under a new key. This allows you to run one plugin multiple times. ### Returns - **Phaser.Plugins.BasePlugin** - The plugin that was started, or `null` if invalid key given or plugin is already stopped. ``` -------------------------------- ### start(callback) Source: https://docs.phaser.io/api-documentation/4.0.0/class/core-timestep Starts the Time Step running, if it is not already doing so. Called automatically by the Game Boot process. ```APIDOC ## start(callback) ### Description Starts the Time Step running, if it is not already doing so. Called automatically by the Game Boot process. ### Parameters - **callback** (Phaser.Types.Core.TimeStepCallback) - Required - The callback to be invoked each time the Time Step steps. ``` -------------------------------- ### start() Source: https://docs.phaser.io/api-documentation/4.0.0/class/cameras-scene2d-effects-fade Starts the camera fade effect. ```APIDOC ## start() ``` -------------------------------- ### START Source: https://docs.phaser.io/api-documentation/4.0.0/constant/input Start button ```APIDOC ## START ### Type number ### Description Start button ``` -------------------------------- ### start(key, [data]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/scenes-scenemanager Starts the given Scene, if it is not starting, loading, or creating. If the Scene is running, paused, or sleeping, it will be shutdown and then started. ```APIDOC ## start(key, [data]) ### Description Starts the given Scene, if it is not starting, loading, or creating. If the Scene is running, paused, or sleeping, it will be shutdown and then started. ### Parameters - **key** (string | Phaser.Scene) - Required - The Scene to start. - **data** (object) - Optional - Optional data object to pass to `Scene.Settings` and `Scene.init`, and `Scene.create`. ### Returns - **Phaser.Scenes.SceneManager** - This Scene Manager instance. ### Since 3.0.0 ### Source src/scene/SceneManager.js#L1179 ``` -------------------------------- ### start(data) Source: https://docs.phaser.io/api-documentation/4.0.0/class/scenes-systems Start this Scene running and rendering. Called automatically by the SceneManager. ```APIDOC ## start(data) ### Description Start this Scene running and rendering. Called automatically by the SceneManager. ### Parameters - **data** (object) - Required - Optional data object that may have been passed to this Scene from another. ``` -------------------------------- ### Install and Get a Global Plugin in Phaser Source: https://docs.phaser.io/api-documentation/4.0.0/class/plugins-pluginmanager Installs a new global plugin into the Plugin Manager and demonstrates how to retrieve it from within a scene using its unique key. ```javascript this.plugins.install('powerupsPlugin', pluginCode); // and from within the scene: this.plugins.get('powerupsPlugin'); ``` -------------------------------- ### add(key, sceneConfig, [autoStart], [data]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/scenes-sceneplugin Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set. ```APIDOC ## add(key, sceneConfig, [autoStart], [data]) ### Description Add the Scene into the Scene Manager and start it if 'autoStart' is true or the Scene config 'active' property is set. ### Parameters - **key** (string) - Required - A unique key used to reference the Scene, i.e. `MainMenu` or `Level1`. - **sceneConfig** (Phaser.Types.Scenes.SceneType) - Required - The config for the Scene. - **autoStart** (boolean) - Optional - Default: `false` - If `true` the Scene will be started immediately after being added. - **data** (object) - Optional - Optional data object. This will be set as `Scene.settings.data` and passed to `Scene.init`, and `Scene.create`. ### Returns Phaser.Scene - The added Scene, if it was added immediately, otherwise `null`. ``` -------------------------------- ### getPointAt(u, [out]) Source: https://docs.phaser.io/api-documentation/class/curves-line Gets a point at a given position on the line, where 0 is the start and 1 is the end. ```APIDOC ## INSTANCE METHOD getPointAt(u, [out]) ### Description Gets a point at a given position on the line. ### Parameters #### Request Body - **u** (number) - Required - The position along the curve to return. Where 0 is the start and 1 is the end. - **out** (Phaser.Math.Vector2) - Optional - A Vector2 object to store the result in. If not given will be created. ### Response #### Success Response (200) - **(Phaser.Math.Vector2)** - The coordinates of the point on the curve. If an `out` object was given this will be returned. ``` -------------------------------- ### init() Source: https://docs.phaser.io/api-documentation/4.0.0/class/renderer-canvas-canvasrenderer Sets up the event listeners required by the renderer. Specifically, it listens for the Game BOOT event to fill the background color on the canvas, and waits for the Texture Manager's READY event before completing the boot sequence and registering the Scale Manager resize handler. ```APIDOC ## init() ### Description Sets up the event listeners required by the renderer. Specifically, it listens for the Game BOOT event to fill the background color on the canvas, and waits for the Texture Manager's READY event before completing the boot sequence and registering the Scale Manager resize handler. ``` -------------------------------- ### Listen for Sound Play Event in JavaScript Source: https://docs.phaser.io/api-documentation/4.0.0/event/sound-events Attach a listener to a sound instance to react when it starts playing. This example shows adding a sound and then playing it. ```javascript var music = this.sound.add('key'); music.on('play', listener); music.play(); ``` -------------------------------- ### getStartPoint([out]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/curves-cubicbezier Gets the starting point on the curve. This method allows you to retrieve the coordinates of the curve's origin, optionally storing the result in a provided Vector2 object. ```APIDOC ## getStartPoint([out]) ### Description Gets the starting point on the curve. ### Parameters - **out** (Phaser.Math.Vector2) - Optional - A Vector2 object to store the result in. If not given will be created. ### Returns - **Phaser.Math.Vector2** - The coordinates of the point on the curve. If an `out` object was given this will be returned. ``` -------------------------------- ### getPointAt(u, [out]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/curves-line Gets a point at a given position on the line. The position 'u' is normalized between 0 (start) and 1 (end). An optional 'out' Vector2 object can be provided to store the result. ```APIDOC ## getPointAt(u, [out]) ### Description Gets a point at a given position on the line. ### Method getPointAt ### Parameters - **u** (number) - Required - The position along the curve to return. Where 0 is the start and 1 is the end. - **out** (Phaser.Math.Vector2) - Optional - A Vector2 object to store the result in. If not given will be created. ### Returns - **Phaser.Math.Vector2** - The coordinates of the point on the curve. If an 'out' object was given this will be returned. ``` -------------------------------- ### start([duration], [red], [green], [blue], [force], [callback], [context]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/cameras-scene2d-effects-flash Initiates the Flash effect, flashing the Camera to or from the given color over the specified duration. This method fires `FLASH_START` and `FLASH_COMPLETE` events. ```APIDOC ## start([duration], [red], [green], [blue], [force], [callback], [context]) ### Description Flashes the Camera to or from the given color over the duration specified. Fires: Phaser.Cameras.Scene2D.Events#event:FLASH_START, Phaser.Cameras.Scene2D.Events#event:FLASH_COMPLETE ### Parameters - **duration** (number) - Optional - Default: 250 - The duration of the effect in milliseconds. - **red** (number) - Optional - Default: 255 - The amount to flash the red channel towards. A value between 0 and 255. - **green** (number) - Optional - Default: 255 - The amount to flash the green channel towards. A value between 0 and 255. - **blue** (number) - Optional - Default: 255 - The amount to flash the blue channel towards. A value between 0 and 255. - **force** (boolean) - Optional - Default: false - Force the effect to start immediately, even if already running. - **callback** (Phaser.Types.Cameras.Scene2D.CameraFlashCallback) - Optional - This callback will be invoked every frame for the duration of the effect. It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - **context** (any) - Optional - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. ### Returns Phaser.Cameras.Scene2D.Camera - The Camera on which the effect was started. ``` -------------------------------- ### Loading a Binary File with Configuration Object Source: https://docs.phaser.io/api-documentation/4.0.0/class/loader-loaderplugin This example demonstrates loading a binary file using a configuration object, allowing for more detailed settings like specifying the `dataType`. ```javascript this.load.binary({ key: 'doom', url: 'files/Doom.wad', dataType: Uint8Array }); ``` -------------------------------- ### getDataSourceImage([name]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/textures-texture Given a Frame name, return the data source image it uses to render with. You can use this to get the normal map for an image for example. This will return the actual DOM Image. ```APIDOC ## getDataSourceImage([name]) ### Description Given a Frame name, return the data source image it uses to render with. You can use this to get the normal map for an image for example. This will return the actual DOM Image. ### Method getDataSourceImage ### Parameters - **name** (string | number) - Optional - The string-based name, or integer based index, of the Frame to get from this Texture. ### Returns - **HTMLImageElement, HTMLCanvasElement** - The DOM Image or Canvas Element. ``` -------------------------------- ### start([duration], [intensity], [force], [callback], [context]) Source: https://docs.phaser.io/api-documentation/class/cameras-scene2d-effects-shake Shakes the Camera by the given intensity over the duration specified. ```APIDOC ## Method: start ### Description Shakes the Camera by the given intensity over the duration specified. ### Signature start([duration], [intensity], [force], [callback], [context]) ### Parameters - **duration** (number) - Optional - Default: 100 - The duration of the effect in milliseconds. - **intensity** (number | Phaser.Math.Vector2) - Optional - Default: 0.05 - The intensity of the shake. - **force** (boolean) - Optional - Default: false - Force the shake effect to start immediately, even if already running. - **callback** (Phaser.Types.Cameras.Scene2D.CameraShakeCallback) - Optional - This callback will be invoked every frame for the duration of the effect. It is sent two arguments: A reference to the camera and a progress amount between 0 and 1 indicating how complete the effect is. - **context** (any) - Optional - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. ### Returns Phaser.Cameras.Scene2D.Camera - The Camera on which the effect was started. ### Fires Events - Phaser.Cameras.Scene2D.Events#event:SHAKE_START - Phaser.Cameras.Scene2D.Events#event:SHAKE_COMPLETE ``` -------------------------------- ### Staggering Tween Delay with Grid Configuration Source: https://docs.phaser.io/api-documentation/class/tweens-tweenmanager This example shows how to use `this.tweens.stagger` with a configuration object to create a 500ms staggered delay based on a 10x6 grid, starting from the center with a cubic ease. ```javascript this.tweens.add({ targets: [ ... ], scale: 0.2, ease: 'linear', duration: 1000, delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) }); ``` -------------------------------- ### Staggering Tween Delay with Grid and Ease Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/tweens-builders This example shows how to stagger a tween's delay using a 10x6 grid, starting from the center, and applying a cubic ease for more complex visual effects. ```javascript this.tweens.add({ targets: [ ... ], scale: 0.2, ease: 'linear', duration: 1000, delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) }); ``` -------------------------------- ### startAnimation(key) Source: https://docs.phaser.io/api-documentation/4.0.0/class/animations-animationstate Load the animation based on the key and set-up all of the internal values needed for playback to start. If there is no delay, it will also fire the start events. ```APIDOC ## startAnimation ### Description Load the animation based on the key and set-up all of the internal values needed for playback to start. If there is no delay, it will also fire the start events. ### Method startAnimation ### Parameters #### Path Parameters - **key** (string | Phaser.Types.Animations.PlayAnimationConfig) - Required - The string-based key of the animation to play, or a `PlayAnimationConfig` object. ### Response #### Success Response (200) - **return** (Phaser.GameObjects.GameObject) - The Game Object that owns this Animation Component. ``` -------------------------------- ### Phaser Stagger Tween Delay with Grid and Ease Source: https://docs.phaser.io/api-documentation/4.0.0/function/tweens This example shows how to stagger a tween's delay by 500ms across targets using a 10x6 grid, starting from the center, with a cubic ease out. ```javascript this.tweens.add({ targets: [ ... ], scale: 0.2, ease: 'linear', duration: 1000, delay: this.tweens.stagger(500, { grid: [ 10, 6 ], from: 'center', ease: 'cubic.out' }) }); ``` -------------------------------- ### play(key, [ignoreIfPlaying], [startFrame]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/gameobjects-rope Start playing the given animation. ```APIDOC ## play(key, [ignoreIfPlaying], [startFrame]) ### Description Start playing the given animation. ### Parameters - **key** (string) - Required - The string-based key of the animation to play. - **ignoreIfPlaying** (boolean) - Optional - Default: `false` - If an animation is already playing then ignore this call. - **startFrame** (number) - Optional - Default: `0` - Optionally start the animation playing from this frame index. ### Returns - **Phaser.GameObjects.Rope** - This Game Object. ``` -------------------------------- ### VIDEO_PLAYING Source: https://docs.phaser.io/api-documentation/4.0.0/event/gameobjects-events The Video Game Object Playing Event. The playing event is fired after playback is first started, and whenever it is restarted. For example it is fired when playback resumes after having been paused or delayed due to lack of data. ```APIDOC ## Event: VIDEO_PLAYING ### Description The Video Game Object Playing Event. The playing event is fired after playback is first started, and whenever it is restarted. For example it is fired when playback resumes after having been paused or delayed due to lack of data. ### Usage Listen for it from a Video Game Object instance using `Video.on('playing', listener)`. ### Listener Arguments - **video** (Phaser.GameObjects.Video) - Required - The Video Game Object which started playback. ``` -------------------------------- ### Get Eased Points on a Line (JavaScript) Source: https://docs.phaser.io/api-documentation/4.0.0/class/geom-line Uses `Phaser.Geom.Line.GetEasedPoints` to generate an array of points along a line, spaced according to a specified ease function. The example uses 'sine.out' to distribute 32 points. ```javascript const line = new Phaser.Geom.Line(100, 300, 700, 300); const points = Phaser.Geom.Line.GetEasedPoints(line, 'sine.out', 32) ``` -------------------------------- ### Video.on('playing', listener) Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/gameobjects-events The Video Game Object Playing Event. The playing event is fired after playback is first started, and whenever it is restarted. For example it is fired when playback resumes after having been paused or delayed due to lack of data. ```APIDOC ## Event: playing ### Description The Video Game Object Playing Event. The playing event is fired after playback is first started, and whenever it is restarted. For example it is fired when playback resumes after having been paused or delayed due to lack of data. ### Method `Video.on('playing', listener)` ### Parameters #### Event Parameters - **video** (Phaser.GameObjects.Video) - Required - The Video Game Object which started playback. ``` -------------------------------- ### Floor(value, gap, [start], [divide]) Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/math-snap Snap a value to the nearest lower grid slice, using floor. Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. As will `14` snap to `10`... but `16` will snap to `15`. ```APIDOC ## Floor(value, gap, [start], [divide]) ### Description Snap a value to the nearest lower grid slice, using floor. Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10`. As will `14` snap to `10`... but `16` will snap to `15`. ### Parameters - **value** (number) - Required - The value to snap. - **gap** (number) - Required - The interval gap of the grid. - **start** (number) - Optional - Default: 0 - Optional starting offset for gap. - **divide** (boolean) - Optional - Default: false - If `true` it will divide the snapped value by the gap before returning. ### Returns - **number** - The snapped value. ``` -------------------------------- ### start(zoom, [duration], [ease], [force], [callback], [context]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/cameras-scene2d-effects-zoom Initiates the zoom effect on the Camera, animating it to the target zoom value over a specified duration with an optional easing function. ```APIDOC ## Method: start(zoom, [duration], [ease], [force], [callback], [context]) ### Description This effect will zoom the Camera to the given scale, over the duration and with the ease specified. ### Parameters - **zoom** (number) - Required - The target Camera zoom value. - **duration** (number) - Optional - Default: 1000 - The duration of the effect in milliseconds. - **ease** (string | function) - Optional - Default: 'Linear' - The ease to use for the Zoom. Can be any of the Phaser Easing constants or a custom function. - **force** (boolean) - Optional - Default: false - Force the zoom effect to start immediately, even if already running. - **callback** (Phaser.Types.Cameras.Scene2D.CameraZoomCallback) - Optional - This callback will be invoked every frame for the duration of the effect. It is sent three arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, and the current camera zoom value. - **context** (any) - Optional - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. ### Returns - **Camera** (Phaser.Cameras.Scene2D.Camera) - The Camera on which the effect was started. ``` -------------------------------- ### GetAll(array, [property], [value], [startIndex], [endIndex]) Source: https://docs.phaser.io/api-documentation/4.0.0/function/utils Returns all elements in the array. You can optionally specify a matching criteria using the `property` and `value` arguments. For example: `GetAll('visible', true)` would return only elements that have their visible property set to `true`. Optionally you can specify a start and end index. For example if the array had 100 elements, and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only the first 50 elements. ```APIDOC ## GetAll(array, [property], [value], [startIndex], [endIndex]) ### Description Returns all elements in the array. You can optionally specify a matching criteria using the `property` and `value` arguments. For example: `GetAll('visible', true)` would return only elements that have their visible property set to `true`. Optionally you can specify a start and end index. For example if the array had 100 elements, and you set `startIndex` to 0 and `endIndex` to 50, it would return matches from only the first 50 elements. ### Parameters - **array** (array) - Required - The array to search. - **property** (string) - Optional - The property to test on each array element. - **value** (*) - Optional - The value to test the property against. Must pass a strict (`===`) comparison check. - **startIndex** (number) - Optional - An optional start index to search from. - **endIndex** (number) - Optional - An optional end index to search to. ### Returns array - All matching elements from the array. ``` -------------------------------- ### setupTextures(controller, textures, _drawingContext) Source: https://docs.phaser.io/api-documentation/4.0.0/class/renderer-webgl-rendernodes-filterwipe Binds the wipe reveal texture to texture slot 1, making it available to the fragment shader as the secondary sampler that will be blended in as the wipe progresses. ```APIDOC ## setupTextures ### Description Binds the wipe reveal texture to texture slot 1, making it available to the fragment shader as the secondary sampler that will be blended in as the wipe progresses. ### Parameters #### Function Parameters - **controller** (Phaser.Filters.Wipe) - Required - The filter controller providing the wipe texture. - **textures** (Array.) - Required - The texture array for this render node. Index 1 is set to the reveal texture. - **_drawingContext** (Phaser.Renderer.WebGL.DrawingContext) - Required - The current drawing context (unused). ``` -------------------------------- ### getFrameBounds([sourceIndex]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/textures-texture Based on the given Texture Source Index, this method will get all of the Frames using that source and then work out the bounds that they encompass, returning them in an object. This is useful if this Texture is, for example, a sprite sheet within an Atlas, and you need to know the total bounds of the sprite sheet. ```APIDOC ## getFrameBounds([sourceIndex]) ### Description Based on the given Texture Source Index, this method will get all of the Frames using that source and then work out the bounds that they encompass, returning them in an object. This is useful if this Texture is, for example, a sprite sheet within an Atlas, and you need to know the total bounds of the sprite sheet. ### Method getFrameBounds ### Parameters - **sourceIndex** (number) - Optional - Default: 0 - The index of the TextureSource to get the Frame bounds from. ### Returns - **Phaser.Types.Math.RectangleLike** - An object containing the bounds of the Frames using the given Texture Source Index. ``` -------------------------------- ### start() Source: https://docs.phaser.io/api-documentation/4.0.0/class/cameras-controls-smoothedkeycontrol Starts the Key Control running, provided it has been linked to a camera. This activates the control, enabling it to process key presses and apply camera movements. ```APIDOC ## start() ### Description Starts the Key Control running, providing it has been linked to a camera. ### Method start ### Response #### Success Response - **Returns** (Phaser.Cameras.Controls.SmoothedKeyControl) - This Key Control instance. ``` -------------------------------- ### renderDebug(graphics, [styleConfig]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/tilemaps-tilemaplayerbase Draws a debug representation of the layer to the given Graphics. This is helpful when you want to get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation wherever you want on the screen. ```APIDOC ## renderDebug ### Description Draws a debug representation of the layer to the given Graphics. This is helpful when you want to get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation wherever you want on the screen. ### Method Signature renderDebug(graphics, [styleConfig]) ### Parameters - **graphics** (Phaser.GameObjects.Graphics) - Required - The target Graphics object to draw upon. - **styleConfig** (Phaser.Types.Tilemaps.StyleConfig) - Optional - An object specifying the colors to use for the debug drawing. ### Returns Phaser.Tilemaps.TilemapLayerBase - This Tilemap Layer object. ``` -------------------------------- ### start(x, y, [duration], [ease], [force], [callback], [context]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/cameras-scene2d-effects-pan This effect will scroll the Camera so that the center of its viewport finishes at the given destination, over the duration and with the ease specified. ```APIDOC ## Method: start(x, y, [duration], [ease], [force], [callback], [context]) ### Description This effect will scroll the Camera so that the center of its viewport finishes at the given destination, over the duration and with the ease specified. ### Parameters - **x** (number) - Required - The destination x coordinate to scroll the center of the Camera viewport to. - **y** (number) - Required - The destination y coordinate to scroll the center of the Camera viewport to. - **duration** (number) - Optional - Default: 1000 - The duration of the effect in milliseconds. - **ease** (string | function) - Optional - Default: "'Linear'" - The ease to use for the pan. Can be any of the Phaser Easing constants or a custom function. - **force** (boolean) - Optional - Default: false - Force the pan effect to start immediately, even if already running. - **callback** (Phaser.Types.Cameras.Scene2D.CameraPanCallback) - Optional - This callback will be invoked every frame for the duration of the effect. It is sent four arguments: A reference to the camera, a progress amount between 0 and 1 indicating how complete the effect is, the current camera scroll x coordinate and the current camera scroll y coordinate. - **context** (any) - Optional - The context in which the callback is invoked. Defaults to the Scene to which the Camera belongs. ### Returns Phaser.Cameras.Scene2D.Camera - The Camera on which the effect was started. ``` -------------------------------- ### RenderDebug(graphics, styleConfig, layer) Source: https://docs.phaser.io/api-documentation/4.0.0/function/tilemaps Draws a debug representation of the layer to the given Graphics. This is helpful when you want to get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation wherever you want on the screen. ```APIDOC ## RenderDebug(graphics, styleConfig, layer) ### Description Draws a debug representation of the layer to the given Graphics. This is helpful when you want to get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation wherever you want on the screen. ### Method static ### Parameters #### Function Parameters - **graphics** (Phaser.GameObjects.Graphics) - Required - The target Graphics object to draw upon. - **styleConfig** (Phaser.Types.Tilemaps.DebugStyleOptions) - Required - An object specifying the colors to use for the debug drawing. - **layer** (Phaser.Tilemaps.LayerData) - Required - The Tilemap Layer to act upon. ``` -------------------------------- ### getPoint(particle) Source: https://docs.phaser.io/api-documentation/4.0.0/class/gameobjects-particles-zones-edgezone Get the next point in the Zone and set its coordinates on the given Particle. Points are stepped through sequentially. When the end of the point list is reached, the counter wraps back to the start, or reverses direction if `yoyo` is enabled. Called automatically by the Particle Emitter each time a new particle is emitted. ```APIDOC ## getPoint(particle) ### Description Get the next point in the Zone and set its coordinates on the given Particle. Points are stepped through sequentially. When the end of the point list is reached, the counter wraps back to the start, or reverses direction if `yoyo` is enabled. Called automatically by the Particle Emitter each time a new particle is emitted. ### Parameters - **particle** (Phaser.GameObjects.Particles.Particle) - Required - The Particle. ``` -------------------------------- ### startFollow([config], [startAt]) Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/gameobjects-components-pathfollower Initiates the PathFollower to begin following its assigned Path, with optional configuration and a starting position. ```APIDOC ## startFollow([config], [startAt]) ### Description Starts this PathFollower following its given Path. ### Method startFollow ### Parameters - **config** (number | Phaser.Types.GameObjects.PathFollower.PathConfig | Phaser.Types.Tweens.NumberTweenBuilderConfig) - Optional - Default: "{}" - - **startAt** (number) - Optional - Default: 0 - Optional start position of the follow, between 0 and 1. ### Returns - **Phaser.GameObjects.Components.PathFollower** - This Game Object. ``` -------------------------------- ### To(value, gap, [start], [divide]) Source: https://docs.phaser.io/api-documentation/4.0.0/namespace/math-snap Snaps a value to the nearest grid slice, using rounding. Values that fall exactly halfway between two slices will snap to the higher slice. Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. ```APIDOC ## To(value, gap, [start], [divide]) ### Description Snaps a value to the nearest grid slice, using rounding. Values that fall exactly halfway between two slices will snap to the higher slice. Example: if you have an interval gap of `5` and a position of `12`... you will snap to `10` whereas `14` will snap to `15`. ### Parameters - **value** (number) - Required - The value to snap. - **gap** (number) - Required - The interval gap of the grid. - **start** (number) - Optional - Default: 0 - Optional starting offset for the grid, allowing grid alignment to begin at a value other than zero. - **divide** (boolean) - Optional - Default: false - If `true` it will divide the snapped value by the gap before returning. ### Returns - **number** - The snapped value. ``` -------------------------------- ### start([key], [data]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/scenes-sceneplugin Shutdown this Scene and run the given one. This will happen at the next Scene Manager update, not immediately. ```APIDOC ## start([key], [data]) ### Description Shutdown this Scene and run the given one. This will happen at the next Scene Manager update, not immediately. ### Method start ### Parameters #### Method Parameters - **key** (string | Phaser.Scene) - Optional - The Scene to start. - **data** (object) - Optional - The Scene data. If no value is given it will not overwrite any previous data that may exist. ### Returns - **Phaser.Scenes.ScenePlugin** - This Scene Plugin instance. ``` -------------------------------- ### GetPoints(line, quantity, [stepRate], [out]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/geom-line Get a number of evenly-spaced points along a line, starting from the first endpoint (x1, y1). The last endpoint (x2, y2) is not included in the returned points. Provide a `quantity` to get an exact number of points along the line. Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when providing a `stepRate`. See also `GetEasedPoints` for a way to distribute the points across the line according to an ease type or input function. ```APIDOC ## GetPoints(line, quantity, [stepRate], [out]) ### Description Get a number of evenly-spaced points along a line, starting from the first endpoint (x1, y1). The last endpoint (x2, y2) is not included in the returned points. Provide a `quantity` to get an exact number of points along the line. Provide a `stepRate` to ensure a specific distance between each point on the line. Set `quantity` to `0` when providing a `stepRate`. See also `GetEasedPoints` for a way to distribute the points across the line according to an ease type or input function. ### Method Signature GetPoints(line, quantity, [stepRate], [out]) ### Parameters - **line** (Phaser.Geom.Line) - Required - The line. - **quantity** (number) - Required - The number of points to place on the line. Set to `0` to use `stepRate` instead. - **stepRate** (number) - Optional - The distance between each point on the line. When set, `quantity` is calculated as the line length divided by this value; `quantity` should be set to `0`. - **out** (Array.) - Optional - An optional array of Vector2 objects to store the coordinates of the points on the line. ### Returns Array. - An array of Vector2 objects containing the coordinates of the points on the line. ``` -------------------------------- ### Queueing a Text File with Configuration Object Source: https://docs.phaser.io/api-documentation/4.0.0/class/loader-loaderplugin This example demonstrates loading a text file by passing a configuration object to `this.load.text`, providing an alternative to positional arguments. Refer to `Phaser.Types.Loader.FileTypes.TextFileConfig` for more options. ```javascript this.load.text({ key: 'story', url: 'files/IntroStory.txt' }); ``` -------------------------------- ### snapshot(callback, [type], [encoderOptions]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/renderer-canvas-canvasrenderer Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then calling this method will override it. Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. ```APIDOC ## snapshot(callback, [type], [encoderOptions]) ### Description Schedules a snapshot of the entire game viewport to be taken after the current frame is rendered. To capture a specific area see the `snapshotArea` method. To capture a specific pixel, see `snapshotPixel`. Only one snapshot can be active _per frame_. If you have already called `snapshotPixel`, for example, then calling this method will override it. Snapshots work by creating an Image object from the canvas data, this is a blocking process, which gets more expensive the larger the canvas size gets, so please be careful how you employ this in your game. ### Method Signature snapshot(callback, [type], [encoderOptions]) ### Parameters - **callback** (Phaser.Types.Renderer.Snapshot.SnapshotCallback) - Required - The Function to invoke after the snapshot image is created. - **type** (string) - Optional - The format of the image to create, usually `image/png` or `image/jpeg`. [Default: 'image/png'] - **encoderOptions** (number) - Optional - The image quality, between 0 and 1. Used for image formats with lossy compression, such as `image/jpeg`. [Default: 0.92] ### Returns Phaser.Renderer.Canvas.CanvasRenderer - This Canvas Renderer. ``` -------------------------------- ### get(key, [autoStart]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/plugins-pluginmanager Gets a global plugin from the Plugin Manager based on the given key and returns it. If it cannot find an active plugin based on the key, but there is one in the Plugin Cache with the same key, then it will create a new instance of the cached plugin and return that. ```APIDOC ## Method: get(key, [autoStart]) ### Description Gets a global plugin from the Plugin Manager based on the given key and returns it. If it cannot find an active plugin based on the key, but there is one in the Plugin Cache with the same key, then it will create a new instance of the cached plugin and return that. ### Parameters - **key** (string) - Required - The key of the plugin to get. - **autoStart** (boolean) - Optional - Default: true - Automatically start a new instance of the plugin if found in the cache, but not actively running. ### Returns Phaser.Plugins.BasePlugin, function - The plugin, or `null` if no plugin was found matching the key. ``` -------------------------------- ### renderDebugFull(graphics, [styleConfig]) Source: https://docs.phaser.io/api-documentation/4.0.0/class/tilemaps-tilemap Draws a debug representation of all layers within this Tilemap to the given Graphics object. This is helpful when you want to get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation wherever you want on the screen. ```APIDOC ## renderDebugFull(graphics, [styleConfig]) ### Description Draws a debug representation of all layers within this Tilemap to the given Graphics object. This is helpful when you want to get a quick idea of which of your tiles are colliding and which have interesting faces. The tiles are drawn starting at (0, 0) in the Graphics, allowing you to place the debug representation wherever you want on the screen. ### Parameters - **graphics** (Phaser.GameObjects.Graphics) - Required - The target Graphics object to draw upon. - **styleConfig** (Phaser.Types.Tilemaps.StyleConfig) - Optional - An object specifying the colors to use for the debug drawing. ### Returns Phaser.Tilemaps.Tilemap - This Tilemap instance. ```