Infinite particles

Hello again! I’m creating particles next way:

	var emitZone = new Phaser.Geom.Rectangle(0, 0, gameOptions.GAME_W, gameOptions.GAME_H);
		var particles = this.add.particles('emiter');
		var config = {
			speed: {min: -20, max: 20},
			lifespan: {max: 2000, min: 1000},
			quantity: 2,
			scale: {min: 0.1, max: 0.4},
			alpha: {start: 0.8, end: 0},
			blendMode: 'ADD',
			emitZone: {source: emitZone},
			maxParticles: 100
		var emitter = particles.createEmitter(config);

I need to have max particles count in the same time, but maxParticles works for all particles at all.
Another variant: make the particles live forever, but I can’t find infinite value in docs or examples.
So I try get event onParticleDeath and want to re-launch dead particles, but i can’t find, how to bring them back to life.
emitter.onParticleDeath(function (particle, emitter) { +=; particle.alpha = 0.8;}, emitter);
Any ideas how to have a constant number of particles on the screen or make them never die?

Hey Navka, you can sort of achieve this effect by setting lifespan equal to Number.MAX_VALUE. Eventually your particle will die, but only after many days of your program running.

Then you can do particles.explode(amount);

1 Like

Oh, it’s brilliant, thanks! And tell me, what can you think of to shake particles a little from side to side?