Phaser.Physics.Arcade.Components.Size

Scope: static

Source: src/physics/arcade/components/Size.js#L7
Since: 3.0.0

Methods:

Public Members

setBodySize

<instance> setBodySize(width, height, [center])

Description:

Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.

Parameters:

nametypeoptionaldefaultdescription
widthnumberNoThe new width of the physics body, in pixels.
heightnumberNoThe new height of the physics body, in pixels.
centerbooleanYestrueShould the body be re-positioned so its center aligns with the parent Game Object?

Returns: Phaser.Physics.Arcade.Components.Size - This Game Object.

Source: src/physics/arcade/components/Size.js#L57
Since: 3.24.0


setCircle

<instance> setCircle(radius, [offsetX], [offsetY])

Description:

Sets this physics body to use a circle for collision instead of a rectangle.

Parameters:

nametypeoptionaldescription
radiusnumberNoThe radius of the physics body, in pixels.
offsetXnumberYesThe amount to offset the body from the parent Game Object along the x-axis.
offsetYnumberYesThe amount to offset the body from the parent Game Object along the y-axis.

Returns: Phaser.Physics.Arcade.Components.Size - This Game Object.

Source: src/physics/arcade/components/Size.js#L76
Since: 3.0.0


setOffset

<instance> setOffset(x, [y])

Description:

Sets the body offset. This allows you to adjust the difference between the center of the body and the x and y coordinates of the parent Game Object.

Parameters:

nametypeoptionaldefaultdescription
xnumberNoThe amount to offset the body from the parent Game Object along the x-axis.
ynumberYes"x"The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis.

Returns: Phaser.Physics.Arcade.Components.Size - This Game Object.

Source: src/physics/arcade/components/Size.js#L16
Since: 3.0.0


setSize

<instance> setSize(width, height, [center])

Description:

DEPRECATED: Please use setBodySize instead.

Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.

Parameters:

nametypeoptionaldefaultdescription
widthnumberNoThe new width of the physics body, in pixels.
heightnumberNoThe new height of the physics body, in pixels.
centerbooleanYestrueShould the body be re-positioned so its center aligns with the parent Game Object?

Returns: Phaser.Physics.Arcade.Components.Size - This Game Object.

Source: src/physics/arcade/components/Size.js#L35
Since: 3.0.0


Private Members

Updated on