Namespace: Bounds

Phaser.Display. Bounds

Methods


<static> CenterOn(gameObject, x, y)

Positions the Game Object so that it is centered on the given coordinates.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

x number

The horizontal coordinate to position the Game Object on.

y number

The vertical coordinate to position the Game Object on.

Since: 3.0.0
Source: src/display/bounds/CenterOn.js (Line 10)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject

<static> GetBottom(gameObject)

Returns the bottom coordinate from the bounds of the Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetBottom.js (Line 7)
Returns:

The bottom coordinate of the bounds of the Game Object.

Type
number

<static> GetBounds(gameObject [, output])

Returns the unrotated bounds of the Game Object as a rectangle.

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

The Game Object to get the bounds value from.

output Phaser.Geom.Rectangle | object <optional>

An object to store the values in.

Since: 3.24.0
Source: src/display/bounds/GetBounds.js (Line 12)
Returns:
  • The bounds of the Game Object.
Type
Phaser.Geom.Rectangle | object

<static> GetCenterX(gameObject)

Returns the center x coordinate from the bounds of the Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetCenterX.js (Line 7)
Returns:

The center x coordinate of the bounds of the Game Object.

Type
number

<static> GetCenterY(gameObject)

Returns the center y coordinate from the bounds of the Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetCenterY.js (Line 7)
Returns:

The center y coordinate of the bounds of the Game Object.

Type
number

<static> GetLeft(gameObject)

Returns the left coordinate from the bounds of the Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetLeft.js (Line 7)
Returns:

The left coordinate of the bounds of the Game Object.

Type
number

<static> GetOffsetX(gameObject)

Returns the amount the Game Object is visually offset from its x coordinate. This is the same as width * origin.x. This value will only be > 0 if origin.x is not equal to zero.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetOffsetX.js (Line 7)
Returns:

The horizontal offset of the Game Object.

Type
number

<static> GetOffsetY(gameObject)

Returns the amount the Game Object is visually offset from its y coordinate. This is the same as width * origin.y. This value will only be > 0 if origin.y is not equal to zero.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetOffsetY.js (Line 7)
Returns:

The vertical offset of the Game Object.

Type
number

<static> GetRight(gameObject)

Returns the right coordinate from the bounds of the Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetRight.js (Line 7)
Returns:

The right coordinate of the bounds of the Game Object.

Type
number

<static> GetTop(gameObject)

Returns the top coordinate from the bounds of the Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to get the bounds value from.

Since: 3.0.0
Source: src/display/bounds/GetTop.js (Line 7)
Returns:

The top coordinate of the bounds of the Game Object.

Type
number

<static> SetBottom(gameObject, value)

Positions the Game Object so that the bottom of its bounds aligns with the given coordinate.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

value number

The coordinate to position the Game Object bounds on.

Since: 3.0.0
Source: src/display/bounds/SetBottom.js (Line 7)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject

<static> SetCenterX(gameObject, x)

Positions the Game Object so that the center top of its bounds aligns with the given coordinate.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

x number

The coordinate to position the Game Object bounds on.

Since: 3.0.0
Source: src/display/bounds/SetCenterX.js (Line 7)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject

<static> SetCenterY(gameObject, y)

Positions the Game Object so that the center top of its bounds aligns with the given coordinate.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

y number

The coordinate to position the Game Object bounds on.

Since: 3.0.0
Source: src/display/bounds/SetCenterY.js (Line 7)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject

<static> SetLeft(gameObject, value)

Positions the Game Object so that the left of its bounds aligns with the given coordinate.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

value number

The coordinate to position the Game Object bounds on.

Since: 3.0.0
Source: src/display/bounds/SetLeft.js (Line 7)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject

<static> SetRight(gameObject, value)

Positions the Game Object so that the left of its bounds aligns with the given coordinate.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

value number

The coordinate to position the Game Object bounds on.

Since: 3.0.0
Source: src/display/bounds/SetRight.js (Line 7)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject

<static> SetTop(gameObject, value)

Positions the Game Object so that the top of its bounds aligns with the given coordinate.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object that will be re-positioned.

value number

The coordinate to position the Game Object bounds on.

Since: 3.0.0
Source: src/display/bounds/SetTop.js (Line 7)
Returns:

The Game Object that was positioned.

Type
Phaser.GameObjects.GameObject