Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Enable
Phaser.Physics.Arcade.Components.Enable

Methods

enableBody(reset, x, y, enableGameObject, showGameObject)
Focus
Focus

Description:

Enables this Game Object's Body.

Parameters:

name type description
reset boolean

Also reset the Body and place it at (x, y).

x number

The horizontal position to place the Game Object and Body.

y number

The horizontal position to place the Game Object and Body.

enableGameObject boolean

Also activate this Game Object.

showGameObject boolean

Also show this Game Object.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
disableBody([disableGameObject], [hideGameObject])
Focus
Focus

Description:

Stops and disables this Game Object's Body.

Parameters:

name type arguments Default description
disableGameObject boolean <optional> false

Also deactivate this Game Object.

hideGameObject boolean <optional> false

Also hide this Game Object.

Returns:
Description:

This Game Object.

Examples:
Since: 3.0.0
Focus
Focus
refreshBody()
Focus
Focus

Description:

Syncs the Body's position and size with its parent Game Object. You don't need to call this for Dynamic Bodies, as it happens automatically. But for Static bodies it's a useful way of modifying the position of a Static Body in the Physics World, based on its Game Object.

Returns:
Description:

This Game Object.

Examples:
Since: 3.1.0
Focus
Focus