Jump to content

Particle Generator Random Angle


jjwallace
 Share

Recommended Posts

I have a particle generator of lighting bolts and i want them to generate at random angles around an object.  The particles do not move but just play an animation.  Everything is working i just need random angles to work, how does one reference this with emitter.

emitter = this.add.emitter(0, 0, 100);
        emitter.makeParticles('bolt');
        emitter.gravity = 0;
        emitter.x = this.world.centerX;
        emitter.y = this.world.centerY;
        
//        emitter.maxParticleScale = 1;
//        emitter.minParticleScale = 0.5;
//        emitter.angle = (Math.random()*360);
        emitter.setYSpeed(0, 0);
        emitter.setXSpeed(0, 0);
        emitter.minRotation = -180;
        emitter.maxRotation = 1800;

 

Link to comment
Share on other sites

 

Not an immediate answer to your question, but an alternative you can consider if you cannot proceed is to render your lightning bolts using rendertextures. I'm not sure if this will work with animated sprites, but you can create some nice effects by tweaking your settings inside the drawing function:

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...