Phaser API Documentation

  Version: 
Filter
Namespace: GameObjects
Phaser.GameObjects
Source: src/gameobjects/index.js (Line 7)

Classes

Namespace

Methods

<static> BuildGameObject(scene, gameObject, config)
Focus
Focus

Description:

Builds a Game Object using the provided configuration object.

Parameters:

name type description
scene Phaser.Scene

A reference to the Scene.

gameObject Phaser.GameObjects.GameObject

The initial GameObject.

config Phaser.Types.GameObjects.GameObjectConfig

The config to build the GameObject with.

Returns:
Description:

The built Game Object.

Since: 3.0.0
Focus
Focus
<static> BuildGameObjectAnimation(sprite, config)
Focus
Focus

Description:

Adds an Animation component to a Sprite and populates it based on the given config.

Parameters:

name type description
sprite Phaser.GameObjects.Sprite

The sprite to add an Animation component to.

config object

The animation config.

Returns:
Description:

The updated Sprite.

Since: 3.0.0
Focus
Focus
<static> GetCalcMatrix(src, camera, [parentMatrix])
Focus
Focus

Description:

Calculates the Transform Matrix of the given Game Object and Camera, factoring in the parent matrix if provided.

Note that the object this results contains references to the Transform Matrices, not new instances of them. Therefore, you should use their values immediately, or copy them to your own matrix, as they will be replaced as soon as another Game Object is rendered.

Parameters:

name type arguments description
src Phaser.GameObjects.GameObject

The Game Object to calculate the transform matrix for.

camera Phaser.Cameras.Scene2D.Camera

The camera being used to render the Game Object.

parentMatrix Phaser.GameObjects.Components.TransformMatrix <optional>

The transform matrix of the parent container, if any.

Returns:
Description:

The results object containing the updated transform matrices.

Since: 3.50.0
Focus
Focus
<static> GetTextSize(text, size, lines)
Focus
Focus

Description:

Returns an object containing dimensions of the Text object.

Parameters:

name type description
text Phaser.GameObjects.Text

The Text object to calculate the size from.

size Phaser.Types.GameObjects.Text.TextMetrics

The Text metrics to use when calculating the size.

lines Array.<string>

The lines of text to calculate the size from.

Returns:
Description:

An object containing dimensions of the Text object.

Since: 3.0.0
Focus
Focus
<static> MeasureText(textStyle)
Focus
Focus

Description:

Calculates the ascent, descent and fontSize of a given font style.

Parameters:

name type description
textStyle Phaser.GameObjects.TextStyle

The TextStyle object to measure.

Returns:
Description:

An object containing the ascent, descent and fontSize of the TextStyle.

Since: 3.0.0
Focus
Focus