Carmoreno
Carmoreno

Reputation: 1319

Destroy a single particle in Phaser.js

How I can destroy a single particle using phaser.js?, currently I have a simple particle system in my game (using a image as particle). I have seen the phaser documentation and the destroy function destroys all particle system (I want to destroy only one).

Upvotes: 0

Views: 446

Answers (1)

Kamen Minkov
Kamen Minkov

Reputation: 3722

Since Phaser.Emitter extends Phaser.Group, you can iterate over the children elements of an Emitter with the methods you have available for a group (and the ones specific to an Emitter - look here - you have getFirstAlive() for example).

So you can have it like this:

emitter.getFirstAlive().destroy();

but it's up to you to find the one specific particle you want to destroy.

Upvotes: 1

Related Questions