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: Acceleration
Phaser.Physics.Arcade.Components.Acceleration

Methods

setAcceleration(x, [y])
Focus
Focus

Description:

Sets the body's horizontal and vertical acceleration. If the vertical acceleration value is not provided, the vertical acceleration is set to the same value as the horizontal acceleration.

Parameters:

name type arguments Default description
x number

The horizontal acceleration

y number <optional> x

The vertical acceleration

Returns:
Description:

This Game Object.

Examples:
Focus
Focus
setAccelerationX(value)
Focus
Focus

Description:

Sets the body's horizontal acceleration.

Parameters:

name type description
value number

The horizontal acceleration

Returns:
Description:

This Game Object.

Examples:
Focus
Focus
setAccelerationY(value)
Focus
Focus

Description:

Sets the body's vertical acceleration.

Parameters:

name type description
value number

The vertical acceleration

Returns:
Description:

This Game Object.

Examples:
Focus
Focus