Skip to main content
Version: Phaser v4.0.0

Phaser.Display.Align.In

Scope: static

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

Static functions

BottomCenter

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

Description:

Takes a given Game Object and aligns it so that its bottom edge matches the bottom edge of the alignIn Game Object, with its horizontal center aligned to the horizontal center of alignIn.

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

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

Description:

Takes a 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

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

Description:

Takes a given Game Object and aligns it so that it is positioned inside the bottom-right corner of the alignIn Game Object. The right edge of gameObject is matched to the right edge of alignIn, and the bottom edge of gameObject is matched to the bottom edge of alignIn.

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

<static> Center(gameObject, alignIn, [offsetX], [offsetY])

Description:

Takes a 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

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

Description:

Takes a given Game Object and aligns it so that its left edge is flush with the left edge of the alignIn Game Object, and its vertical center matches the vertical center of alignIn. This places the Game Object at the left-center interior position of the reference object. An optional offset can be applied to adjust the final position along either axis.

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

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

Description:

Takes a given Game Object and aligns it so that it is positioned relative to another Game Object. 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

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

Description:

Takes a given Game Object and aligns it so that its right edge is flush with the right edge of the alignIn Game Object, and its vertical center is aligned with the vertical center of the alignIn Game Object.

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

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

Description:

Takes a given Game Object and aligns it so that its top edge is flush with the top edge of the alignIn Game Object, centered horizontally.

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

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

Description:

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

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

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

Description:

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

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