Kiwi404 Posted June 10, 2018 Share Posted June 10, 2018 Hi, Is there any method to reset an emitter properly to be reused ? because i reuse a set of emitters but sometimes when i reuse a previously used emitter it show quickly his last state (repartition of particules in their last coordinates) and then restart his animation, so i wonder if is it a bug or a bad use. EDIT : It's a bad. Code used to instanciate the emitters in the poolEmitter (extended Phaser.group) instance : em = game.add.emitter(10,16,30) // some emitter settings (minRotation, setXSpeed,makeParticles...) em.kill() this.add(em) Code used in the poolEmitter instance to get a free (dead) emitter : let obj = this.getFirstDead(false) obj.revive() obj.x = x obj.y = y return obj Code used for exploitation of the emitter : let em = poolEmitter.create(player.x ,player.y) em.explode(800,30) setTimeout(function(){ em.kill() em.on = false em.visible = false /* em.forEach(function(p) { // I try this to hide the particule manually to avoid to be showed in their last coord when reuse the emitter, but dont work p.alpha = 0 })*/ },900) Thanks Link to comment Share on other sites More sharing options...
Kiwi404 Posted June 11, 2018 Author Share Posted June 11, 2018 Sorry it's a bad use ( i started the emitter outside of game state's update function, so there was randomly an out of sync ). No problems now. Link to comment Share on other sites More sharing options...
Recommended Posts