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

    The Arcade Physics Factory allows you to easily create Arcade Physics enabled Game Objects. Objects that are created by this Factory are automatically added to the physics world.

    Index

    Constructors

    Properties

    scene: Scene

    A reference to the Scene this Arcade Physics instance belongs to.

    sys: Systems

    A reference to the Scene.Systems this Arcade Physics instance belongs to.

    A reference to the Arcade Physics World.

    Methods

    • Creates a new physics Body with the given position and size.

      This Body is not associated with any Game Object, but still exists within the world and can be tested for collision, have velocity, etc.

      Parameters

      • x: number

        The horizontal position of this Body in the physics world.

      • y: number

        The vertical position of this Body in the physics world.

      • Optionalwidth: number

        The width of the Body in pixels. Cannot be negative or zero. Default 64.

      • Optionalheight: number

        The height of the Body in pixels. Cannot be negative or zero. Default 64.

      Returns Physics.Arcade.Body

    • Adds an Arcade Physics Body to the given Game Object.

      Type Parameters

      Parameters

      • gameObject: G

        A Game Object.

      • OptionalisStatic: boolean

        Create a Static body (true) or Dynamic body (false). Default false.

      Returns G

    • Creates a new Arcade Image object with a Dynamic body.

      Parameters

      • x: number

        The horizontal position of this Game Object in the world.

      • y: number

        The vertical position of this Game Object in the world.

      • texture: string | Textures.Texture

        The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.

      • Optionalframe: string | number

        An optional frame from the Texture this Game Object is rendering with.

      Returns ImageWithDynamicBody

    • Creates a new Arcade Sprite object with a Dynamic body.

      Parameters

      • x: number

        The horizontal position of this Game Object in the world.

      • y: number

        The vertical position of this Game Object in the world.

      • key: string

        The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.

      • Optionalframe: string | number

        An optional frame from the Texture this Game Object is rendering with.

      Returns SpriteWithDynamicBody

    • Creates a new static physics Body with the given position and size.

      This Body is not associated with any Game Object, but still exists within the world and can be tested for collision, etc.

      Parameters

      • x: number

        The horizontal position of this Body in the physics world.

      • y: number

        The vertical position of this Body in the physics world.

      • Optionalwidth: number

        The width of the Body in pixels. Cannot be negative or zero. Default 64.

      • Optionalheight: number

        The height of the Body in pixels. Cannot be negative or zero. Default 64.

      Returns StaticBody

    • Creates a new Arcade Image object with a Static body.

      Parameters

      • x: number

        The horizontal position of this Game Object in the world.

      • y: number

        The vertical position of this Game Object in the world.

      • texture: string | Textures.Texture

        The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.

      • Optionalframe: string | number

        An optional frame from the Texture this Game Object is rendering with.

      Returns ImageWithStaticBody

    • Creates a new Arcade Sprite object with a Static body.

      Parameters

      • x: number

        The horizontal position of this Game Object in the world.

      • y: number

        The vertical position of this Game Object in the world.

      • texture: string | Textures.Texture

        The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.

      • Optionalframe: string | number

        An optional frame from the Texture this Game Object is rendering with.

      Returns SpriteWithStaticBody