Phaser API Documentation

  Version: 
Filter

The Particle Bounds Processor.

Defines a rectangular region, in world space, within which particle movement is restrained.

Use the properties collideLeft, collideRight, collideTop and collideBottom to control if a particle will rebound off the sides of this boundary, or not.

This happens when the particles worldPosition x/y coordinate hits the boundary.

The strength of the rebound is determined by the Particle.bounce property.

Constructor:

new ParticleBounds(x, y, width, height, [collideLeft], [collideRight], [collideTop], [collideBottom])

Parameters:

name type arguments Default description
x number

The x position (top-left) of the bounds, in world space.

y number

The y position (top-left) of the bounds, in world space.

width number

The width of the bounds.

height number

The height of the bounds.

collideLeft boolean <optional> true

Whether particles interact with the left edge of the bounds.

collideRight boolean <optional> true

Whether particles interact with the right edge of the bounds.

collideTop boolean <optional> true

Whether particles interact with the top edge of the bounds.

collideBottom boolean <optional> true

Whether particles interact with the bottom edge of the bounds.

Since: 3.60.0

Extends


Members

active: boolean
Focus
Focus

Description:

The active state of the Particle Processor.

An inactive Particle Processor will be skipped for processing by its parent Emitter.

Type:
boolean
Inherited from: Phaser.GameObjects.Particles.ParticleProcessor#active
Since: 3.60.0
Focus
Focus

Description:

A rectangular boundary constraining particle movement. Use the Emitter properties collideLeft, collideRight, collideTop and collideBottom to control if a particle will rebound off the sides of this boundary, or not. This happens when the particles x/y coordinate hits the boundary.

Type:
Since: 3.60.0
Focus
Focus
collideBottom: boolean
Focus
Focus

Description:

Whether particles interact with the bottom edge of the emitter Phaser.GameObjects.Particles.ParticleBounds#bounds.

Type:
boolean
Default: true
Since: 3.60.0
Focus
Focus
collideLeft: boolean
Focus
Focus

Description:

Whether particles interact with the left edge of the emitter Phaser.GameObjects.Particles.ParticleEmitter#bounds.

Type:
boolean
Default: true
Since: 3.60.0
Focus
Focus
collideRight: boolean
Focus
Focus

Description:

Whether particles interact with the right edge of the emitter Phaser.GameObjects.Particles.ParticleBounds#bounds.

Type:
boolean
Default: true
Since: 3.60.0
Focus
Focus
collideTop: boolean
Focus
Focus

Description:

Whether particles interact with the top edge of the emitter Phaser.GameObjects.Particles.ParticleBounds#bounds.

Type:
boolean
Default: true
Since: 3.60.0
Focus
Focus

Description:

A reference to the Particle Emitter that owns this Processor. This is set automatically when the Processor is added to an Emitter and nulled when removed or destroyed.

Type:
Inherited from: Phaser.GameObjects.Particles.ParticleProcessor#manager
Since: 3.60.0
Focus
Focus
x: number
Focus
Focus

Description:

The x coordinate of the Particle Processor, in world space.

Type:
number
Inherited from: Phaser.GameObjects.Particles.ParticleProcessor#x
Since: 3.60.0
Focus
Focus
y: number
Focus
Focus

Description:

The y coordinate of the Particle Processor, in world space.

Type:
number
Inherited from: Phaser.GameObjects.Particles.ParticleProcessor#y
Since: 3.60.0
Focus
Focus

Methods

destroy()
Focus
Focus

Description:

Destroys this Particle Processor by removing all external references.

This is called automatically when the owning Particle Emitter is destroyed.

Inherited from: Phaser.GameObjects.Particles.ParticleProcessor#destroy
Since: 3.60.0
Focus
Focus
update(particle)
Focus
Focus

Description:

Takes a Particle and updates it against the bounds.

Parameters:

name type description
particle Phaser.GameObjects.Particles.Particle

The Particle to update.

Overrides: Phaser.GameObjects.Particles.ParticleProcessor#update
Since: 3.0.0
Focus
Focus