Phaser.Physics.Arcade.Components.Velocity

Scope: static

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

Methods:

Public Members

setMaxVelocity

<instance> setMaxVelocity(x, [y])

Description:

Sets the maximum velocity of the body.

Parameters:

nametypeoptionaldefaultdescription
xnumberNoThe new maximum horizontal velocity, in pixels per second.
ynumberYes"x"The new maximum vertical velocity, in pixels per second.

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

Source: src/physics/arcade/components/Velocity.js#L73
Since: 3.0.0


setVelocity

<instance> setVelocity(x, [y])

Description:

Sets the velocity of the Body.

Parameters:

nametypeoptionaldefaultdescription
xnumberNoThe horizontal velocity of the body, in pixels per second. Positive values move the body to the right, while negative values move it to the left.
ynumberYes"x"The vertical velocity of the body, in pixels per second. Positive values move the body down, while negative values move it up.

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

Source: src/physics/arcade/components/Velocity.js#L17
Since: 3.0.0


setVelocityX

<instance> setVelocityX(x)

Description:

Sets the horizontal component of the body's velocity.

Positive values move the body to the right, while negative values move it to the left.

Parameters:

nametypeoptionaldescription
xnumberNoThe new horizontal velocity, in pixels per second.

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

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


setVelocityY

<instance> setVelocityY(y)

Description:

Sets the vertical component of the body's velocity.

Positive values move the body down, while negative values move it up.

Parameters:

nametypeoptionaldescription
ynumberNoThe new vertical velocity, in pixels per second.

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

Source: src/physics/arcade/components/Velocity.js#L54
Since: 3.0.0


Private Members

Updated on