public FlxSprite loadParticleGraphic(Texture2D Graphic, float Rotation, float Width = 0, float Height = 0)
{
rotateBy = Rotation * 0.0174532925f;
texture = Graphic;
int numFrames = (int)FlxU.floor(texture.Width / texture.Height);
if (Width == 0 || Height == 0)
{
Width = texture.Height;
Height = Width;
}
frameWidth = width = Width;
frameHeight = height = Height;
List<FlxRect> _draws = new List<FlxRect>();
for (int i = 0; i < numFrames; i++)
{
FlxRect textureArea = new FlxRect(i * height, 0, width, height);
_draws.Add(textureArea);
}
int di;// = (int)Math.Round(FlxU.randomBetween(0, numFrames));
Random r = new Random();
di = r.Next(numFrames);
particleRect = _draws[di];
//FlxRect t = _draws[di];
sourceRect = new FlxRect(particleRect.x, particleRect.y, particleRect.width, particleRect.height);
return this;
}