Namespace: GameObjects

Phaser. GameObjects

Classes

Arc
BitmapText
Blitter
Bob
Container
Curve
DisplayList
DOMElement
DynamicBitmapText
Ellipse
Extern
GameObject
GameObjectCreator
GameObjectFactory
Graphics
Grid
Group
Image
IsoBox
IsoTriangle
Layer
Light
LightsManager
LightsPlugin
Line
Mesh
PathFollower
PointLight
Polygon
Rectangle
RenderTexture
Rope
Shader
Shape
Sprite
Sprite3D
Star
Text
TextStyle
TileSprite
Triangle
UpdateList
Video
Zone

Namespaces

Components
Events
Particles
RetroFont

Methods


<static> BuildGameObject(scene, gameObject, config)

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.

Since: 3.0.0
Source: src/gameobjects/BuildGameObject.js (Line 10)
Returns:

The built Game Object.

Type
Phaser.GameObjects.GameObject

<static> BuildGameObjectAnimation(sprite, config)

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.

Since: 3.0.0
Source: src/gameobjects/BuildGameObjectAnimation.js (Line 9)
Returns:

The updated Sprite.

Type
Phaser.GameObjects.Sprite

<static> GetCalcMatrix(src, camera [, parentMatrix])

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 Argument 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.

Since: 3.50.0
Source: src/gameobjects/GetCalcMatrix.js (Line 15)
Returns:

The results object containing the updated transform matrices.

Type
Phaser.Types.GameObjects.GetCalcMatrixResults

<static> GetTextSize(text, size, lines)

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.

Since: 3.0.0
Source: src/gameobjects/text/GetTextSize.js (Line 7)
Returns:

An object containing dimensions of the Text object.

Type
Phaser.Types.GameObjects.Text.GetTextSizeObject

<static> MeasureText(textStyle)

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

Parameters:
Name Type Description
textStyle Phaser.GameObjects.TextStyle

The TextStyle object to measure.

Since: 3.0.0
Source: src/gameobjects/text/MeasureText.js (Line 9)
Returns:

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

Type
Phaser.Types.GameObjects.Text.TextMetrics