phaser - v4.0.0-rc.4
    Preparing search index...

    Provides methods for modifying the velocity of an Arcade Physics body.

    Should be applied as a mixin and not used directly.

    interface Velocity {
        setMaxVelocity(x: number, y?: number): this;
        setVelocity(x: number, y?: number): this;
        setVelocityX(x: number): this;
        setVelocityY(y: number): this;
    }

    Implemented by

    Index

    Methods

    • Sets the maximum velocity of the body.

      Parameters

      • x: number

        The new maximum horizontal velocity, in pixels per second.

      • Optionaly: number

        The new maximum vertical velocity, in pixels per second. Default x.

      Returns this

    • Sets the velocity of the Body.

      Parameters

      • x: number

        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.

      • Optionaly: number

        The vertical velocity of the body, in pixels per second. Positive values move the body down, while negative values move it up. Default x.

      Returns this

    • 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

      • x: number

        The new horizontal velocity, in pixels per second.

      Returns this

    • Sets the vertical component of the body's velocity.

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

      Parameters

      • y: number

        The new vertical velocity, in pixels per second.

      Returns this