Class: Factory

Phaser.Physics.Impact. Factory

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


new Factory(world)

Parameters:
Name Type Description
world Phaser.Physics.Impact.World

A reference to the Impact Physics world.

Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 12)

Members


sys :Phaser.Scenes.Systems

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

Type:
Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 39)

world :Phaser.Physics.Impact.World

A reference to the Impact Physics world.

Type:
Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 30)

Methods


body(x, y, width, height)

Creates a new ImpactBody object and adds it to the physics simulation.

Parameters:
Name Type Description
x number

The horizontal position of the body in the physics world.

y number

The vertical position of the body in the physics world.

width number

The width of the body.

height number

The height of the body.

Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 49)
Returns:

The ImpactBody object that was created.

Type
Phaser.Physics.Impact.ImpactBody

destroy()

Destroys this Factory.

Since: 3.5.0
Source: src/physics/impact/Factory.js (Line 137)

existing(gameObject)

Adds an Impact Physics Body to the given Game Object.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object to receive the physics body.

Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 67)
Returns:

The Game Object.

Type
Phaser.GameObjects.GameObject

image(x, y, key [, frame])

Creates a new ImpactImage object and adds it to the physics world.

Parameters:
Name Type Argument Description
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.

frame string | integer <optional>

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

Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 92)
Returns:

The ImpactImage object that was created.

Type
Phaser.Physics.Impact.ImpactImage

sprite(x, y, key [, frame])

Creates a new ImpactSprite object and adds it to the physics world.

Parameters:
Name Type Argument Description
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.

frame string | integer <optional>

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

Since: 3.0.0
Source: src/physics/impact/Factory.js (Line 114)
Returns:

The ImpactSprite object that was created.

Type
Phaser.Physics.Impact.ImpactSprite