espace Posted March 9, 2017 Share Posted March 9, 2017 hi, my goal is : have multiple explosion and have no lag so i use a particle emitterbut after a certain delay, a lag appears. what the best solution to avoid that ? thanks for yours suggestions. character.prototype.explode=function(){ this.particle = game.add.emitter(this.cible.x,this.cible.y,200) this.particle.makeParticles("rect") this.particle.minParticleSpeed.setTo(-600,-600) this.particle.maxParticleSpeed.setTo(800,800) this.particle.setAlpha(.8, .6) this.particle.minParticleScale = .2 this.particle.maxParticleScale = .5 this.particle.minRotation = 0 this.particle.maxRotation = 0 this.particle.on=false this.particle.start(true,3900,null,20) } game.time.events.loop( 500,this.explode,this ) Link to comment Share on other sites More sharing options...
marcgfx Posted March 9, 2017 Share Posted March 9, 2017 I assume something you are doing is using too much performance. Maybe give profiling a try, to find what the lag could be caused by? Link to comment Share on other sites More sharing options...
samme Posted March 9, 2017 Share Posted March 9, 2017 You're creating a new emitter (with 200 particles) twice every second! You only need 1 emitter. And you can probably use Emitter#flow, no need for a loop. Link to comment Share on other sites More sharing options...
espace Posted March 11, 2017 Author Share Posted March 11, 2017 200 damned problem solved Link to comment Share on other sites More sharing options...
Recommended Posts