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 xnumber The horizontal position of the body in the physics world.
ynumber The vertical position of the body in the physics world.
widthnumber The width of the body.
heightnumber The height of the body.
- Since: 3.0.0
- Source: src/physics/impact/Factory.js (Line 49)
Returns:
The ImpactBody object that was created.
-
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 gameObjectPhaser.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.
-
image(x, y, key [, frame])
-
Creates a new ImpactImage object and adds it to the physics world.
Parameters:
Name Type Argument Description xnumber The horizontal position of this Game Object in the world.
ynumber The vertical position of this Game Object in the world.
keystring The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
framestring | 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.
-
sprite(x, y, key [, frame])
-
Creates a new ImpactSprite object and adds it to the physics world.
Parameters:
Name Type Argument Description xnumber The horizontal position of this Game Object in the world.
ynumber The vertical position of this Game Object in the world.
keystring The key of the Texture this Game Object will use to render with, as stored in the Texture Manager.
framestring | 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.
