diff options
| author | Ben Beltran <ben@nsovocal.com> | 2013-11-12 22:40:29 -0600 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2013-11-12 22:40:29 -0600 |
| commit | 38c7d3f9eb7d63937c6654ff5dd6046ce02dd59c (patch) | |
| tree | 9df6c6faa8cb250d66c022f2d54a0f769adb7cfd /Super Polarity/ParticleEngine.cs | |
| parent | 2af83e98005a14c439b360a5b9ac636f594d9f0c (diff) | |
I think bullets come out now.
Diffstat (limited to 'Super Polarity/ParticleEngine.cs')
| -rw-r--r-- | Super Polarity/ParticleEngine.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Super Polarity/ParticleEngine.cs b/Super Polarity/ParticleEngine.cs index 0fced25..51188ae 100644 --- a/Super Polarity/ParticleEngine.cs +++ b/Super Polarity/ParticleEngine.cs @@ -11,7 +11,12 @@ namespace SuperPolarity { private Random random; public Vector2 EmitterLocation { get; set; } - public Color Color; + public Color Color; //TODO: Color list for random colors. + public int TTL; + public int TTLRandomFactor; + public int ScatterFactor; + public int ParticleCount; + public float StretchFactor; private List<Particle> particles; private List<Texture2D> textures; @@ -22,6 +27,9 @@ namespace SuperPolarity this.particles = new List<Particle>(); random = new Random(); Color = Color.Red; + TTL = 20; + TTLRandomFactor = 40; + StretchFactor = 1; } private Particle GenerateNewParticle() @@ -31,12 +39,16 @@ namespace SuperPolarity Vector2 velocity = new Vector2( 1f * (float)(random.NextDouble() * 2 - 1), 1f * (float)(random.NextDouble() * 2 - 1)); + float angle = 0; float angularVelocity = 0.1f * (float)(random.NextDouble() * 2 - 1); Color color = Color; - float size = (float)random.NextDouble(); + float size = (float)random.NextDouble() * StretchFactor; + + position.X += random.Next(-ScatterFactor, ScatterFactor); + position.Y += random.Next(-ScatterFactor, ScatterFactor); - int ttl = 20 + random.Next(40); + int ttl = TTL + random.Next(TTLRandomFactor); return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl); } |