Inheritance: FlxSprite
Exemple #1
0
 /// <summary>
 /// Create the particles to be used
 /// </summary>
 /// <param name="Graphics">Texture for the particles - can be one square or a spritesheet.  Set Multiple to true if it is a spritesheet and it will automatically create the particles as long as each frame on the spritesheet is square</param>
 /// <param name="Multiple">Whether or not the Texture contains multiple sprites for particles</param>
 /// <param name="Quantity">The number of particles to generate</param>
 /// <param name="Rotation">The amount of rotation in degrees per frame, so keep this number low</param>
 /// <param name="Collide">The collidability of the particle, 1 = Full and 0 = None</param>
 /// <returns>FlxEmitter</returns>
 public FlxEmitter makeParticles(Texture2D Graphic, bool Multiple=false, uint Quantity = 50, float Rotation = 1f, float Collide = 0.8f)
 {
     maxSize = Quantity;
     FlxParticle particle;
     uint i = 0;
     while(i < Quantity)
     {
         particle = new FlxParticle();
         if (Multiple)
             particle.loadParticleGraphic(Graphic, Rotation);
         else
             particle.loadGraphic(Graphic);
         if(Collide > 0)
         {
             particle.width *= Collide;
             particle.height *= Collide;
             particle.centerOffsets();
         }
         else
             particle.allowCollisions = FlxObject.NONE;
         particle.exists = false;
         add(particle);
         i++;
     }
     return this;
 }