Skip to main content
Version: Phaser v4.0.0

ParticleProcessor

This class provides the structure required for all Particle Processors.

You should extend it and add the functionality required for your processor, including tidying up any resources this may create in the destroy method.

See the GravityWell for an example of a processor.

Constructor

new ParticleProcessor([x], [y], [active])

Parameters

nametypeoptionaldefaultdescription
xnumberYes0The x coordinate of the Particle Processor, in world space.
ynumberYes0The y coordinate of the Particle Processor, in world space.
activebooleanYestrueThe active state of this Particle Processor.

Scope: static

Source: src/gameobjects/particles/ParticleProcessor.js#L9
Since: 3.60.0

Public Members

active

active: boolean

Description:

The active state of the Particle Processor.

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

Source: src/gameobjects/particles/ParticleProcessor.js#L66
Since: 3.60.0


emitter

emitter: Phaser.GameObjects.Particles.ParticleEmitter

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.

Source: src/gameobjects/particles/ParticleProcessor.js#L37
Since: 3.60.0


x

x: number

Description:

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

Source: src/gameobjects/particles/ParticleProcessor.js#L48
Since: 3.60.0


y

y: number

Description:

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

Source: src/gameobjects/particles/ParticleProcessor.js#L57
Since: 3.60.0


Public Methods

destroy

<instance> destroy()

Description:

Destroys this Particle Processor by removing all external references.

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

Source: src/gameobjects/particles/ParticleProcessor.js#L96
Since: 3.60.0


update

<instance> update(particle, delta, step, t)

Description:

The Particle Processor update method should be overridden by your own method and handle the processing of the particles, typically modifying their velocityX/Y values based on the criteria of this processor.

Parameters:

nametypeoptionaldescription
particlePhaser.GameObjects.Particles.ParticleNoThe Particle to update.
deltanumberNoThe delta time in ms.
stepnumberNoThe delta value divided by 1000.
tnumberNoThe current normalized lifetime of the particle, between 0 (birth) and 1 (death).

Source: src/gameobjects/particles/ParticleProcessor.js#L79
Since: 3.60.0