Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . GameObjects . Particles . Zones . DeathZone

This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . GameObjects . Particles . Zones . DeathZone

A Death Zone.

A Death Zone is a special type of zone that will kill a Particle as soon as it either enters, or leaves, the zone.

The zone consists of a source which could be a Geometric shape, such as a Rectangle or Ellipse, or your own object as long as it includes a contains method for which the Particles can be tested against.

Constructor:

new DeathZone(source, killOnEnter)

Parameters:

name type description
source Phaser.Types.GameObjects.Particles.DeathZoneSource

An object instance that has a contains method that returns a boolean when given x and y arguments.

killOnEnter boolean

Should the Particle be killed when it enters the zone? true or leaves it? false

Since: 3.0.0

Members

killOnEnter: boolean
Focus
Focus

Description:

Set to true if the Particle should be killed if it enters this zone. Set to false to kill the Particle if it leaves this zone.

Type:
boolean
Since: 3.0.0
Focus
Focus

Description:

An object instance that has a contains method that returns a boolean when given x and y arguments. This could be a Geometry shape, such as Phaser.Geom.Circle, or your own custom object.

Type:
Since: 3.0.0
Focus
Focus

Methods

willKill(particle)
Focus
Focus

Description:

Checks if the given Particle will be killed or not by this zone.

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The Particle to be checked against this zone.

Returns:
Description:

Return true if the Particle is to be killed, otherwise return false.

Type:
  • boolean
Examples:
Since: 3.0.0
Focus
Focus