Particle Emitter, callback when finished?

I can not find a callback, when finished.
When Position is reached, remove Particle and add Text

function create ()
{
var particles = this.add.particles(‘flares’);

particles.createEmitter({
    frame: 'yellow',
    radial: false,
    x: { min: 800, max: 300, steps: 256 },
    y: 400,
    lifespan: 2000,
    speedX: { min: 200, max: 400 },
    quantity: 1,
    gravityY: 50,
    scale: { start: 0.6, end: 0, ease: 'Power3' },
    blendMode: 'ADD',
    delay: 1
});

}

Hi, i don’t know if it’s what you want, let me know.

particles = this.add.particles('flares');

    emitter = particles.createEmitter({
        frame: 'blue',
        x: -200,
        y: 0,
        lifespan: 1000,
        speed: { min: 200, max: 300 },
        angle: 330,
        gravityY: 300,
        scale: { start: 0.4, end: 0 },
        quantity: 1,
        blendMode: 'ADD'
    });

    emitter.onParticleDeath((particle) => {
        this.add.text(particles.x + particle.x, particles.y + particle.y, 'ok')
    }, this);

Hi, not quite.
Flares move from right(800) to left (300)… When the Position is reached, delete everything and add Text

Flares Move to 300: When reached => Delete All “destroy()” and add Text.

Example:
https://labs.phaser.io/edit.html?src=src\game%20objects\particle%20emitter\fireballs.js

and Paste my Code

Not sure to understand what you exactly want (i’m not english…)

var config = {
    type: Phaser.WEBGL,
    width: 800,
    height: 600,
    backgroundColor: '#000',
    parent: 'phaser-example',
    scene: {
        preload: preload,
        create: create,
        update: update,
    }
};

var game = new Phaser.Game(config);

function preload ()
{
    this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json');
}

function create ()
{
this.particles = this.add.particles('flares');

this.emitter = this.particles.createEmitter({
    frame: 'yellow',
    radial: false,
    x: { min: 800, max: 300, steps: 256 },
    y: 400,
    lifespan: 2000,
    speedX: { min: 200, max: 400 },
    quantity: 1,
    gravityY: 50,
    scale: { start: 0.6, end: 0, ease: 'Power3' },
    blendMode: 'ADD',
    delay: 1
});
}

function update(time, delta) {
    if (this.emitter.x.counter < 305) {
        this.add.text(300, this.emitter.y.propertyValue, 'ok');
        this.emitter.killAll()
    }
}
1 Like

Yes that’s it. Many thanks