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

    Provides methods used for setting the enable properties of an Arcade Physics Body.

    interface Enable {
        disableBody(disableGameObject?: boolean, hideGameObject?: boolean): this;
        enableBody(
            reset?: boolean,
            x?: number,
            y?: number,
            enableGameObject?: boolean,
            showGameObject?: boolean,
        ): this;
        refreshBody(): this;
        setDirectControl(value?: boolean): this;
    }

    Implemented by

    Index

    Methods

    • Stops and disables this Game Object's Body.

      Parameters

      • OptionaldisableGameObject: boolean

        Also set this Game Object's active to false. Default false.

      • OptionalhideGameObject: boolean

        Also set this Game Object's visible to false. Default false.

      Returns this

    • Enables this Game Object's Body. If you reset the Body you must also pass x and y.

      Parameters

      • Optionalreset: boolean

        Also reset the Body and place the Game Object at (x, y).

      • Optionalx: number

        The horizontal position to place the Game Object, if reset is true.

      • Optionaly: number

        The horizontal position to place the Game Object, if reset is true.

      • OptionalenableGameObject: boolean

        Also set this Game Object's active to true.

      • OptionalshowGameObject: boolean

        Also set this Game Object's visible to true.

      Returns this

    • Syncs the Body's position and size with its parent Game Object. You don't need to call this for Dynamic Bodies, as it happens automatically. But for Static bodies it's a useful way of modifying the position of a Static Body in the Physics World, based on its Game Object.

      Returns this

    • Sets whether this Body should calculate its velocity based on its change in position every frame. The default, which is to not do this, means that you make this Body move by setting the velocity directly. However, if you are trying to move this Body via a Tween, or have it follow a Path, then you should enable this instead. This will allow it to still collide with other bodies, something that isn't possible if you're just changing its position directly.

      Parameters

      • Optionalvalue: boolean

        true if the Body calculate velocity based on changes in position, otherwise false. Default true.

      Returns this