Problems adding emitter

Hello. First time using Phaser here. I have done a lot of JS (including three.js) so I know how to program (just not optimally :stuck_out_tongue: ). I am trying to create a Match3 game using the following example:

So far I have been able to tweak it so it behaves a little more the way I want it, however I seem to have hit a snag. I want to create a particle emitter for twinkles, and later explosions, so within create() i put:

	emitter = this.add.emitter(0, 0, 128);
	emitter.makeParticles(["spark"]);
	emitter.minParticleScale = 0.25;
	emitter.maxParticleScale = 0.75;
	emitter.setScale(0.5, 1.5, 0.5, 1.5, 2000, Phaser.Easing.Linear.None, true);

But I get the error this.add.emitter is not a function. I tried game.add.emitter but that didn’t help either. Is there something missing? Is this function for Phaser 2 rather than 3? In all the examples I’ve looked it should be just this, nothing extra in the game config that I know of.

/Edward

Hi @Edward,
In Phaser 3, the ParticleEmitterManager object has the method createEmitter() .
Here the oficial examples:

Regards.

Ah. Thank you. Managed to figure out how to grow and spin the sprites from that.
However, it does not seem to give examples of how to shrink the sprites after growing (like the tween.yoyo). Googling gave me .setScale(0.5, 0.5, 1.5, 1.5, 2000, Phaser.Linear.None, true) but that did not seem to do anything. Having the scale: {start, end} inside createEmitter works, but only in one direction. I’d like to pingpong between start and end.

1 Like

Ah, thank you! Heh, a whole custom function for just that.
Well, lets see if I can complete this thing.