Namespace: To

Phaser.Display.Align. To

Methods


<static> BottomCenter(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the bottom center position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/BottomCenter.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> BottomLeft(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the bottom left position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/BottomLeft.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> BottomRight(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the bottom right position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/BottomRight.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> LeftBottom(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the left bottom position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/LeftBottom.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> LeftCenter(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the left center position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/LeftCenter.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> LeftTop(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the left top position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/LeftTop.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> QuickSet(child, alignTo, position [, offsetX] [, offsetY])

Takes a Game Object and aligns it next to another, at the given position. The alignment used is based on the position argument, which is a Phaser.Display.Align property such as LEFT_CENTER or TOP_RIGHT.

Parameters:
Name Type Argument Default Description
child Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

position number

The position to align the Game Object with. This is an align constant, such as Phaser.Display.Align.LEFT_CENTER.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.22.0
Source: src/display/align/to/QuickSet.js (Line 24)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> RightBottom(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the right bottom position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/RightBottom.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> RightCenter(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the right center position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/RightCenter.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> RightTop(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the right top position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/RightTop.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> TopCenter(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the top center position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/TopCenter.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> TopLeft(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the top left position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/TopLeft.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject

<static> TopRight(gameObject, alignTo [, offsetX] [, offsetY])

Takes given Game Object and aligns it so that it is positioned next to the top right position of the other.

Parameters:
Name Type Argument Default Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be positioned.

alignTo Phaser.GameObjects.GameObject

The Game Object to base the alignment position on.

offsetX number <optional>
0

Optional horizontal offset from the position.

offsetY number <optional>
0

Optional vertical offset from the position.

Since: 3.0.0
Source: src/display/align/to/TopRight.js (Line 12)
Returns:

The Game Object that was aligned.

Type
Phaser.GameObjects.GameObject