Namespace: Acceleration

Phaser.Physics.Arcade.Components. Acceleration

Provides methods used for setting the acceleration properties of an Arcade Physics Body.

Since: 3.0.0
Source: src/physics/arcade/components/Acceleration.js (Line 7)

Methods


setAcceleration(x [, y])

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 Argument Default Description
x number

The horizontal acceleration

y number <optional>
x

The vertical acceleration

Since: 3.0.0
Source: src/physics/arcade/components/Acceleration.js (Line 15)
Returns:

This Game Object.

Type
Phaser.Physics.Arcade.Components.Acceleration

setAccelerationX(value)

Sets the body's horizontal acceleration.

Parameters:
Name Type Description
value number

The horizontal acceleration

Since: 3.0.0
Source: src/physics/arcade/components/Acceleration.js (Line 33)
Returns:

This Game Object.

Type
Phaser.Physics.Arcade.Components.Acceleration

setAccelerationY(value)

Sets the body's vertical acceleration.

Parameters:
Name Type Description
value number

The vertical acceleration

Since: 3.0.0
Source: src/physics/arcade/components/Acceleration.js (Line 50)
Returns:

This Game Object.

Type
Phaser.Physics.Arcade.Components.Acceleration