Namespace: Events

Phaser.Physics.Arcade. Events

Events


COLLIDE

The Arcade Physics World Collide Event.

This event is dispatched by an Arcade Physics World instance if two bodies collide and at least one of them has their onCollide property set to true.

It provides an alternative means to handling collide events rather than using the callback approach.

Listen to it from a Scene using: this.physics.world.on('collide', listener).

Please note that 'collide' and 'overlap' are two different things in Arcade Physics.

Parameters:
Name Type Description
gameObject1 Phaser.GameObjects.GameObject

The first Game Object involved in the collision. This is the parent of body1.

gameObject2 Phaser.GameObjects.GameObject

The second Game Object involved in the collision. This is the parent of body2.

body1 Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody

The first Physics Body involved in the collision.

body2 Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody

The second Physics Body involved in the collision.

Source: src/physics/arcade/events/COLLIDE_EVENT.js (Line 7)

OVERLAP

The Arcade Physics World Overlap Event.

This event is dispatched by an Arcade Physics World instance if two bodies overlap and at least one of them has their onOverlap property set to true.

It provides an alternative means to handling overlap events rather than using the callback approach.

Listen to it from a Scene using: this.physics.world.on('overlap', listener).

Please note that 'collide' and 'overlap' are two different things in Arcade Physics.

Parameters:
Name Type Description
gameObject1 Phaser.GameObjects.GameObject

The first Game Object involved in the overlap. This is the parent of body1.

gameObject2 Phaser.GameObjects.GameObject

The second Game Object involved in the overlap. This is the parent of body2.

body1 Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody

The first Physics Body involved in the overlap.

body2 Phaser.Physics.Arcade.Body | Phaser.Physics.Arcade.StaticBody

The second Physics Body involved in the overlap.

Source: src/physics/arcade/events/OVERLAP_EVENT.js (Line 7)

PAUSE

The Arcade Physics World Pause Event.

This event is dispatched by an Arcade Physics World instance when it is paused.

Listen to it from a Scene using: this.physics.world.on('pause', listener).

Source: src/physics/arcade/events/PAUSE_EVENT.js (Line 7)

RESUME

The Arcade Physics World Resume Event.

This event is dispatched by an Arcade Physics World instance when it resumes from a paused state.

Listen to it from a Scene using: this.physics.world.on('resume', listener).

Source: src/physics/arcade/events/RESUME_EVENT.js (Line 7)

TILE_COLLIDE

The Arcade Physics Tile Collide Event.

This event is dispatched by an Arcade Physics World instance if a body collides with a Tile and has its onCollide property set to true.

It provides an alternative means to handling collide events rather than using the callback approach.

Listen to it from a Scene using: this.physics.world.on('tilecollide', listener).

Please note that 'collide' and 'overlap' are two different things in Arcade Physics.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object involved in the collision. This is the parent of body.

tile Phaser.Tilemaps.Tile

The tile the body collided with.

body Phaser.Physics.Arcade.Body

The Arcade Physics Body of the Game Object involved in the collision.

Source: src/physics/arcade/events/TILE_COLLIDE_EVENT.js (Line 7)

TILE_OVERLAP

The Arcade Physics Tile Overlap Event.

This event is dispatched by an Arcade Physics World instance if a body overlaps with a Tile and has its onOverlap property set to true.

It provides an alternative means to handling overlap events rather than using the callback approach.

Listen to it from a Scene using: this.physics.world.on('tileoverlap', listener).

Please note that 'collide' and 'overlap' are two different things in Arcade Physics.

Parameters:
Name Type Description
gameObject Phaser.GameObjects.GameObject

The Game Object involved in the overlap. This is the parent of body.

tile Phaser.Tilemaps.Tile

The tile the body overlapped.

body Phaser.Physics.Arcade.Body

The Arcade Physics Body of the Game Object involved in the overlap.

Source: src/physics/arcade/events/TILE_OVERLAP_EVENT.js (Line 7)

WORLD_BOUNDS

The Arcade Physics World Bounds Event.

This event is dispatched by an Arcade Physics World instance if a body makes contact with the world bounds and it has its onWorldBounds property set to true.

It provides an alternative means to handling collide events rather than using the callback approach.

Listen to it from a Scene using: this.physics.world.on('worldbounds', listener).

Parameters:
Name Type Description
body Phaser.Physics.Arcade.Body

The Arcade Physics Body that hit the world bounds.

up boolean

Is the Body blocked up? I.e. collided with the top of the world bounds.

down boolean

Is the Body blocked down? I.e. collided with the bottom of the world bounds.

left boolean

Is the Body blocked left? I.e. collided with the left of the world bounds.

right boolean

Is the Body blocked right? I.e. collided with the right of the world bounds.

Source: src/physics/arcade/events/WORLD_BOUNDS_EVENT.js (Line 7)