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

    Provides methods for setting the gravity properties of an Arcade Physics Game Object. Should be applied as a mixin and not used directly.

    interface Gravity {
        setGravity(x: number, y?: number): this;
        setGravityX(x: number): this;
        setGravityY(y: number): this;
    }

    Implemented by

    Index

    Methods

    • Set the X and Y values of the gravitational pull to act upon this Arcade Physics Game Object. Values can be positive or negative. Larger values result in a stronger effect.

      If only one value is provided, this value will be used for both the X and Y axis.

      Parameters

      • x: number

        The gravitational force to be applied to the X-axis.

      • Optionaly: number

        The gravitational force to be applied to the Y-axis. If this is not specified, the X value will be used. Default x.

      Returns this

    • Set the gravitational force to be applied to the X axis. Value can be positive or negative. Larger values result in a stronger effect.

      Parameters

      • x: number

        The gravitational force to be applied to the X-axis.

      Returns this

    • Set the gravitational force to be applied to the Y axis. Value can be positive or negative. Larger values result in a stronger effect.

      Parameters

      • y: number

        The gravitational force to be applied to the Y-axis.

      Returns this