You’re reading the docs for Phaser v3.88.2. The latest is Phaser v4.1.0.

Phaser.Display.Align.In

Scope: static

Source: src/display/align/in/index.js#L7

Static functions

BottomCenter

staticBottomCenter(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/BottomCenter.js#L12
Since: 3.0.0


BottomLeft

staticBottomLeft(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/BottomLeft.js#L12
Since: 3.0.0


BottomRight

staticBottomRight(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/BottomRight.js#L12
Since: 3.0.0


Center

staticCenter(gameObject, alignIn, [offsetX], [offsetY])

Description:

Takes given Game Object and aligns it so that it is positioned in the center of the other.

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/Center.js#L11
Since: 3.0.0


LeftCenter

staticLeftCenter(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/LeftCenter.js#L12
Since: 3.0.0


QuickSet

staticQuickSet(child, alignIn, position, [offsetX], [offsetY])

Description:

Takes given Game Object and aligns it so that it is positioned relative to the other.

The alignment used is based on the position argument, which is an ALIGN_CONST value, such as LEFT_CENTER or TOP_RIGHT.

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
childPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
positionnumberNoThe position to align the Game Object with. This is an align constant, such as ALIGN_CONST.LEFT_CENTER.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/QuickSet.js#L25
Since: 3.0.0


RightCenter

staticRightCenter(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/RightCenter.js#L12
Since: 3.0.0


TopCenter

staticTopCenter(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/TopCenter.js#L12
Since: 3.0.0


TopLeft

staticTopLeft(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/TopLeft.js#L12
Since: 3.0.0


TopRight

staticTopRight(gameObject, alignIn, [offsetX], [offsetY])

Description:

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

Tags:

  • generic

Parameters:

nametypeoptionaldefaultdescription
gameObjectPhaser.GameObjects.GameObjectNoThe Game Object that will be positioned.
alignInPhaser.GameObjects.GameObjectNoThe Game Object to base the alignment position on.
offsetXnumberYes0Optional horizontal offset from the position.
offsetYnumberYes0Optional vertical offset from the position.

Returns: Phaser.GameObjects.GameObject - The Game Object that was aligned.

Source: src/display/align/in/TopRight.js#L12
Since: 3.0.0