Scope: static
Source: src/physics/arcade/components/Velocity.js#L7
Since: 3.0.0
Static functions
setMaxVelocity
<instance> setMaxVelocity(x, [y])
Description:
Sets the maximum velocity of the body.
Parameters:
name | type | optional | default | description |
---|---|---|---|---|
x | number | No | The new maximum horizontal velocity, in pixels per second. | |
y | number | Yes | "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:
name | type | optional | default | description |
---|---|---|---|---|
x | number | No | The 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. | |
y | number | Yes | "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:
name | type | optional | description |
---|---|---|---|
x | number | No | The 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:
name | type | optional | description |
---|---|---|---|
y | number | No | The 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