setDepth() to particles emitter

I would like to set the depth of a particle emitter. I’ve tried:

        this.thrust = this.add.particles("jets").createEmitter({
                      x: 100,
                      y: 350,
                      angle: { min: 160, max: 200 },
                      scale: { start: 0.2, end: 0 },
                      blendMode: "ADD",
                      lifespan: 600,
                      on: false
                    }).setDepth(2)

and

    this.thrust = this.add.particles("jets").createEmitter({
                      x: 100,
                      y: 350,
                      angle: { min: 160, max: 200 },
                      scale: { start: 0.2, end: 0 },
                      blendMode: "ADD",
                      lifespan: 600,
                      on: false
                    })
    this.thrust.setDepth(2)

but I get the error TypeError: this.add.particles(...).createEmitter(...).setDepth is not a function.

Any ideas?

Thanks!

The depth needs to be set on the particles, not the emitter.

2 Likes

If you mean depth vs. other game objects, it needs to be done on the manager:

this.add.particles('jets')
  .setDepth(2)
  .createEmitter(…)
3 Likes