Namespace: Velocity

Phaser.Physics.Impact.Components. Velocity

The Impact Velocity component. Should be applied as a mixin.

Since: 3.0.0
Source: src/physics/impact/components/Velocity.js (Line 7)

Methods


setMaxVelocity(x [, y])

Sets the maximum velocity this body can travel at.

Parameters:
Name Type Argument Default Description
x number

The maximum allowed horizontal velocity.

y number <optional>
x

The maximum allowed vertical velocity. If not given, defaults to the horizontal value.

Since: 3.0.0
Source: src/physics/impact/components/Velocity.js (Line 71)
Returns:

This Game Object.

Type
Phaser.Physics.Impact.Components.Velocity

setVelocity(x [, y])

Sets the horizontal and vertical velocities of the physics body.

Parameters:
Name Type Argument Default Description
x number

The horizontal velocity value.

y number <optional>
x

The vertical velocity value. If not given, defaults to the horizontal value.

Since: 3.0.0
Source: src/physics/impact/components/Velocity.js (Line 50)
Returns:

This Game Object.

Type
Phaser.Physics.Impact.Components.Velocity

setVelocityX(x)

Sets the horizontal velocity of the physics body.

Parameters:
Name Type Description
x number

The horizontal velocity value.

Since: 3.0.0
Source: src/physics/impact/components/Velocity.js (Line 16)
Returns:

This Game Object.

Type
Phaser.Physics.Impact.Components.Velocity

setVelocityY(y)

Sets the vertical velocity of the physics body.

Parameters:
Name Type Description
y number

The vertical velocity value.

Since: 3.0.0
Source: src/physics/impact/components/Velocity.js (Line 33)
Returns:

This Game Object.

Type
Phaser.Physics.Impact.Components.Velocity