Phaser API Documentation

  Version: 
addParticleBounds(x, [y], [width], [height], [collideLeft], [collideRight], [collideTop], [collideBottom])

Description:

Creates a Particle Bounds processor and adds it to this Emitter.

This processor will check to see if any of the active Particles hit the defined boundary, as specified by a Rectangle shape in world-space.

If so, they are 'rebounded' back again by having their velocity adjusted.

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

You should be careful to ensure that you emit particles within a bounds, if set, otherwise it will lead to unpredictable visual results as the particles are hastily repositioned.

The Particle Bounds processor is returned from this method. If you wish to modify the area you can directly change its bounds property, along with the collideLeft etc values.

To disable the bounds you can either set its active property to false, or if you no longer require it, call ParticleEmitter.removeParticleProcessor.

Parameters:

name type arguments Default description
x number | Phaser.Types.GameObjects.Particles.ParticleEmitterBounds | Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt

The x-coordinate of the left edge of the boundary, or an object representing a rectangle.

y number <optional>

The y-coordinate of the top edge of the boundary.

width number <optional>

The width of the boundary.

height number <optional>

The height of the boundary.

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.

Returns:
Description:

The Particle Bounds processor.

Since: 3.60.0