new Factory(world)
Parameters:
| Name | Type | Description |
|---|---|---|
world |
Phaser.Physics.Arcade.World | The Arcade Physics World instance. |
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 14)
Members
-
scene :Phaser.Scene
-
A reference to the Scene this Arcade Physics instance belongs to.
Type:
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 41)
-
sys :Phaser.Scenes.Systems
-
A reference to the Scene.Systems this Arcade Physics instance belongs to.
Type:
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 50)
-
world :Phaser.Physics.Arcade.World
-
A reference to the Arcade Physics World.
Type:
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 32)
Methods
-
collider(object1, object2 [, collideCallback] [, processCallback] [, callbackContext])
-
Creates a new Arcade Physics Collider object.
Parameters:
Name Type Argument Description object1Phaser.GameObjects.GameObject | Array.<Phaser.GameObjects.GameObject> | Phaser.GameObjects.Group | Array.<Phaser.GameObjects.Group> The first object to check for collision.
object2Phaser.GameObjects.GameObject | Array.<Phaser.GameObjects.GameObject> | Phaser.GameObjects.Group | Array.<Phaser.GameObjects.Group> The second object to check for collision.
collideCallbackArcadePhysicsCallback <optional>
The callback to invoke when the two objects collide.
processCallbackArcadePhysicsCallback <optional>
The callback to invoke when the two objects collide. Must return a boolean.
callbackContext* <optional>
The scope in which to call the callbacks.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 60)
Returns:
The Collider that was created.
-
destroy()
-
Destroys this Factory.
- Since: 3.5.0
- Source: src/physics/arcade/Factory.js (Line 252)
-
existing(gameObject [, isStatic])
-
Adds an Arcade Physics Body to the given Game Object.
Parameters:
Name Type Argument Default Description gameObjectPhaser.GameObjects.GameObject A Game Object.
isStaticboolean <optional>
false Create a Static body (true) or Dynamic body (false).
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 98)
Returns:
The Game Object.
-
group( [children] [, config])
-
Creates a Physics Group object. All Game Objects created by this Group will automatically be dynamic Arcade Physics objects.
Parameters:
Name Type Argument Description childrenArray.<Phaser.GameObjects.GameObject> | Phaser.Types.Physics.Arcade.PhysicsGroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig <optional>
Game Objects to add to this group; or the
configargument.configPhaser.Types.Physics.Arcade.PhysicsGroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig <optional>
Settings for this group.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 235)
Returns:
The Group object that was created.
-
image(x, y, texture [, frame])
-
Creates a new Arcade Image object with a Dynamic body.
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.
texturestring | Phaser.Textures.Texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
framestring | number <optional>
An optional frame from the Texture this Game Object is rendering with.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 144)
Returns:
The Image object that was created.
-
overlap(object1, object2 [, collideCallback] [, processCallback] [, callbackContext])
-
Creates a new Arcade Physics Collider Overlap object.
Parameters:
Name Type Argument Description object1Phaser.GameObjects.GameObject | Array.<Phaser.GameObjects.GameObject> | Phaser.GameObjects.Group | Array.<Phaser.GameObjects.Group> The first object to check for overlap.
object2Phaser.GameObjects.GameObject | Array.<Phaser.GameObjects.GameObject> | Phaser.GameObjects.Group | Array.<Phaser.GameObjects.Group> The second object to check for overlap.
collideCallbackArcadePhysicsCallback <optional>
The callback to invoke when the two objects collide.
processCallbackArcadePhysicsCallback <optional>
The callback to invoke when the two objects collide. Must return a boolean.
callbackContext* <optional>
The scope in which to call the callbacks.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 79)
Returns:
The Collider that was created.
-
sprite(x, y, key [, frame])
-
Creates a new Arcade Sprite object with a Dynamic body.
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 | number <optional>
An optional frame from the Texture this Game Object is rendering with.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 193)
Returns:
The Sprite object that was created.
-
staticGroup( [children] [, config])
-
Creates a Static Physics Group object. All Game Objects created by this Group will automatically be static Arcade Physics objects.
Parameters:
Name Type Argument Description childrenArray.<Phaser.GameObjects.GameObject> | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig <optional>
Game Objects to add to this group; or the
configargument.configPhaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig <optional>
Settings for this group.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 218)
Returns:
The Static Group object that was created.
-
staticImage(x, y, texture [, frame])
-
Creates a new Arcade Image object with a Static body.
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.
texturestring | Phaser.Textures.Texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
framestring | number <optional>
An optional frame from the Texture this Game Object is rendering with.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 120)
Returns:
The Image object that was created.
-
staticSprite(x, y, texture [, frame])
-
Creates a new Arcade Sprite object with a Static body.
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.
texturestring | Phaser.Textures.Texture The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager.
framestring | number <optional>
An optional frame from the Texture this Game Object is rendering with.
- Since: 3.0.0
- Source: src/physics/arcade/Factory.js (Line 168)
Returns:
The Sprite object that was created.
