Phaser API Documentation

  Version: 
Filter
Namespace: Enable
Phaser.Physics.Arcade.Components.Enable

Methods

setDirectControl([value])
Focus
Focus

Description:

Sets whether this Body should calculate its velocity based on its change in position every frame. The default, which is to not do this, means that you make this Body move by setting the velocity directly. However, if you are trying to move this Body via a Tween, or have it follow a Path, then you should enable this instead. This will allow it to still collide with other bodies, something that isn't possible if you're just changing its position directly.

Parameters:

name type arguments Default description
value boolean <optional> true

true if the Body calculate velocity based on changes in position, otherwise false.

Returns:
Description:

This Game Object.

Since: 3.70.0
Focus
Focus
enableBody([reset], [x], [y], [enableGameObject], [showGameObject])
Focus
Focus

Description:

Enables this Game Object's Body. If you reset the Body you must also pass x and y.

Parameters:

name type arguments description
reset boolean <optional>

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

x number <optional>

The horizontal position to place the Game Object, if reset is true.

y number <optional>

The horizontal position to place the Game Object, if reset is true.

enableGameObject boolean <optional>

Also set this Game Object's active to true.

showGameObject boolean <optional>

Also set this Game Object's visible to true.

Returns:
Description:

This Game Object.

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 set this Game Object's active to false.

hideGameObject boolean <optional> false

Also set this Game Object's visible to false.

Returns:
Description:

This Game Object.

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.

Since: 3.1.0
Focus
Focus