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.
new Factory(world)
name | type | description |
---|---|---|
world | Phaser.Physics.Arcade.World |
The Arcade Physics World instance. |
A reference to the Scene this Arcade Physics instance belongs to.
A reference to the Scene.Systems this Arcade Physics instance belongs to.
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.
name | type | arguments | Default | description |
---|---|---|---|---|
x | number |
The horizontal position of this Body in the physics world. |
||
y | number |
The vertical position of this Body in the physics world. |
||
width | number | <optional> | 64 |
The width of the Body in pixels. Cannot be negative or zero. |
height | number | <optional> | 64 |
The height of the Body in pixels. Cannot be negative or zero. |
The Body that was created.
Creates a new Arcade Physics Collider object.
name | type | arguments | description |
---|---|---|---|
object1 | Phaser.Types.Physics.Arcade.ArcadeColliderType |
The first object to check for collision. |
|
object2 | Phaser.Types.Physics.Arcade.ArcadeColliderType |
The second object to check for collision. |
|
collideCallback | Phaser.Types.Physics.Arcade.ArcadePhysicsCallback | <optional> |
The callback to invoke when the two objects collide. |
processCallback | Phaser.Types.Physics.Arcade.ArcadePhysicsCallback | <optional> |
The callback to invoke when the two objects collide. Must return a boolean. |
callbackContext | * | <optional> |
The scope in which to call the callbacks. |
The Collider that was created.
Destroys this Factory.
Adds an Arcade Physics Body to the given Game Object.
name | type | arguments | Default | description |
---|---|---|---|---|
gameObject | Phaser.GameObjects.GameObject |
A Game Object. |
||
isStatic | boolean | <optional> | false |
Create a Static body (true) or Dynamic body (false). |
The Game Object.
Creates a Physics Group object. All Game Objects created by this Group will automatically be dynamic Arcade Physics objects.
name | type | arguments | description |
---|---|---|---|
children | Array.<Phaser.GameObjects.GameObject> | Phaser.Types.Physics.Arcade.PhysicsGroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig | <optional> |
Game Objects to add to this group; or the |
config | Phaser.Types.Physics.Arcade.PhysicsGroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig | <optional> |
Settings for this group. |
The Group object that was created.
Creates a new Arcade Image object with a Dynamic body.
name | type | arguments | 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. |
|
texture | string | Phaser.Textures.Texture |
The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. |
|
frame | string | number | <optional> |
An optional frame from the Texture this Game Object is rendering with. |
The Image object that was created.
Creates a new Arcade Physics Collider Overlap object.
name | type | arguments | description |
---|---|---|---|
object1 | Phaser.Types.Physics.Arcade.ArcadeColliderType |
The first object to check for overlap. |
|
object2 | Phaser.Types.Physics.Arcade.ArcadeColliderType |
The second object to check for overlap. |
|
collideCallback | Phaser.Types.Physics.Arcade.ArcadePhysicsCallback | <optional> |
The callback to invoke when the two objects collide. |
processCallback | Phaser.Types.Physics.Arcade.ArcadePhysicsCallback | <optional> |
The callback to invoke when the two objects collide. Must return a boolean. |
callbackContext | * | <optional> |
The scope in which to call the callbacks. |
The Collider that was created.
Creates a new Arcade Sprite object with a Dynamic body.
name | type | arguments | 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 | number | <optional> |
An optional frame from the Texture this Game Object is rendering with. |
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.
name | type | arguments | Default | description |
---|---|---|---|---|
x | number |
The horizontal position of this Body in the physics world. |
||
y | number |
The vertical position of this Body in the physics world. |
||
width | number | <optional> | 64 |
The width of the Body in pixels. Cannot be negative or zero. |
height | number | <optional> | 64 |
The height of the Body in pixels. Cannot be negative or zero. |
The Static Body that was created.
Creates a Static Physics Group object. All Game Objects created by this Group will automatically be static Arcade Physics objects.
name | type | arguments | description |
---|---|---|---|
children | Array.<Phaser.GameObjects.GameObject> | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig | <optional> |
Game Objects to add to this group; or the |
config | Phaser.Types.GameObjects.Group.GroupConfig | Phaser.Types.GameObjects.Group.GroupCreateConfig | <optional> |
Settings for this group. |
The Static Group object that was created.
Creates a new Arcade Image object with a Static body.
name | type | arguments | 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. |
|
texture | string | Phaser.Textures.Texture |
The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. |
|
frame | string | number | <optional> |
An optional frame from the Texture this Game Object is rendering with. |
The Image object that was created.
Creates a new Arcade Sprite object with a Static body.
name | type | arguments | 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. |
|
texture | string | Phaser.Textures.Texture |
The key, or instance of the Texture this Game Object will use to render with, as stored in the Texture Manager. |
|
frame | string | number | <optional> |
An optional frame from the Texture this Game Object is rendering with. |
The Sprite object that was created.