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

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

    interface Size {
        setBodySize(width: number, height: number, center?: boolean): this;
        setCircle(radius: number, offsetX?: number, offsetY?: number): this;
        setOffset(x: number, y?: number): this;
        setSize(width: number, height: number, center?: boolean): this;
    }

    Implemented by

    Index

    Methods

    • Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.

      Parameters

      • width: number

        The new width of the physics body, in pixels.

      • height: number

        The new height of the physics body, in pixels.

      • Optionalcenter: boolean

        Should the body be re-positioned so its center aligns with the parent Game Object? Default true.

      Returns this

    • Sets this physics body to use a circle for collision instead of a rectangle.

      Parameters

      • radius: number

        The radius of the physics body, in pixels.

      • OptionaloffsetX: number

        The amount to offset the body from the parent Game Object along the x-axis.

      • OptionaloffsetY: number

        The amount to offset the body from the parent Game Object along the y-axis.

      Returns this

    • Sets the body offset. This allows you to adjust the difference between the center of the body and the x and y coordinates of the parent Game Object.

      Parameters

      • x: number

        The amount to offset the body from the parent Game Object along the x-axis.

      • Optionaly: number

        The amount to offset the body from the parent Game Object along the y-axis. Defaults to the value given for the x-axis. Default x.

      Returns this

    • DEPRECATED: Please use setBodySize instead.

      Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.

      Parameters

      • width: number

        The new width of the physics body, in pixels.

      • height: number

        The new height of the physics body, in pixels.

      • Optionalcenter: boolean

        Should the body be re-positioned so its center aligns with the parent Game Object? Default true.

      Returns this