PokéRogue
    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
    • Parameters

      • world: World

        The Arcade Physics World instance.

      Returns Factory

    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.

    world: World

    A reference to the Arcade Physics World.

    • 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 Body

      The Body that was created.

    • Creates a new Arcade Physics Collider object.

      Parameters

      • object1: ArcadeColliderType

        The first object to check for collision.

      • object2: ArcadeColliderType

        The second object to check for collision.

      • OptionalcollideCallback: ArcadePhysicsCallback

        The callback to invoke when the two objects collide.

      • OptionalprocessCallback: ArcadePhysicsCallback

        An optional callback to invoke when the two objects are tested for collision. Return true to allow the collision to be processed, or false to prevent it.

      • OptionalcallbackContext: any

        The scope in which to call the callbacks.

      Returns Collider

      The Collider that was created.

    • Destroys this Factory.

      Returns void

    • 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

      The Game Object.

    • 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 | 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

      The Image object that was created.

    • Creates a new Arcade Physics Collider Overlap object.

      Parameters

      • object1: ArcadeColliderType

        The first object to check for overlap.

      • object2: ArcadeColliderType

        The second object to check for overlap.

      • OptionalcollideCallback: ArcadePhysicsCallback

        The callback to invoke when the two objects overlap.

      • OptionalprocessCallback: ArcadePhysicsCallback

        An optional callback to invoke when the two objects are tested for overlap. Return true to allow the overlap to be processed, or false to prevent it.

      • OptionalcallbackContext: any

        The scope in which to call the callbacks.

      Returns Collider

      The Collider that was created.

    • 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

      The Sprite object that was created.

    • 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

      The Static Body that was created.

    • 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 | 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

      The Image object that was created.

    • 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 | 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

      The Sprite object that was created.