Skip to main content
Version: Phaser v4.1.0

ParticleBounds

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

nametypeoptionaldefaultdescription
xnumberNoThe x position (top-left) of the bounds, in world space.
ynumberNoThe y position (top-left) of the bounds, in world space.
widthnumberNoThe width of the bounds.
heightnumberNoThe height of the bounds.
collideLeftbooleanYestrueWhether particles interact with the left edge of the bounds.
collideRightbooleanYestrueWhether particles interact with the right edge of the bounds.
collideTopbooleanYestrueWhether particles interact with the top edge of the bounds.
collideBottombooleanYestrueWhether particles interact with the bottom edge of the bounds.

Scope: static

Extends

Phaser.GameObjects.Particles.ParticleProcessor

Source: src/gameobjects/particles/ParticleBounds.js#L11
Since: 3.60.0

Inherited Members​

From Phaser.GameObjects.Particles.ParticleProcessor:


Public Members​

bounds​

bounds: Phaser.Geom.Rectangle​

Description:

A rectangular boundary constraining particle movement. Use the ParticleBounds 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.

Source: src/gameobjects/particles/ParticleBounds.js#L56
Since: 3.60.0


collideBottom​

collideBottom: boolean​

Description:

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

Source: src/gameobjects/particles/ParticleBounds.js#L98
Since: 3.60.0


collideLeft​

collideLeft: boolean​

Description:

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

Source: src/gameobjects/particles/ParticleBounds.js#L68
Since: 3.60.0


collideRight​

collideRight: boolean​

Description:

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

Source: src/gameobjects/particles/ParticleBounds.js#L78
Since: 3.60.0


collideTop​

collideTop: boolean​

Description:

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

Source: src/gameobjects/particles/ParticleBounds.js#L88
Since: 3.60.0


Inherited Methods​

From Phaser.GameObjects.Particles.ParticleProcessor:


Public Methods​

update​

<instance> update(particle)​

Description:

Checks the given Particle against the boundary rectangle. If the particle's world position crosses an active edge, its position is clamped back inside the boundary and its velocity along that axis is negated and scaled by the particle's bounce value, causing it to rebound.

Parameters:

nametypeoptionaldescription
particlePhaser.GameObjects.Particles.ParticleNoThe Particle to update.

Overrides: Phaser.GameObjects.Particles.ParticleProcessor#update

Source: src/gameobjects/particles/ParticleBounds.js#L109
Since: 3.0.0