diff options
| author | Ben Beltran <ben@nsovocal.com> | 2014-02-03 10:06:44 -0600 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2014-02-03 10:06:44 -0600 |
| commit | 4fc09567c557a1110180940cca40fd7144921026 (patch) | |
| tree | 5fb7b0b787b739a3f4a2785651c69219a8318ab0 /SuperPolarity/Particle.cs | |
| parent | 0cafec445af0a97d96feb1a1daefa1486142c73f (diff) | |
Removes spaces.
Diffstat (limited to 'SuperPolarity/Particle.cs')
| -rw-r--r-- | SuperPolarity/Particle.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/SuperPolarity/Particle.cs b/SuperPolarity/Particle.cs new file mode 100644 index 0000000..d65bac6 --- /dev/null +++ b/SuperPolarity/Particle.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace SuperPolarity +{ + class Particle + { + public Texture2D Texture { get; set; } + public Vector2 Position { get; set; } + public Vector2 Velocity { get; set; } + public float Angle { get; set; } + public float AngularVelocity { get; set; } + public Color Color { get; set; } + public float Size { get; set; } + public int TTL { get; set; } + + public Particle(Texture2D texture, Vector2 position, Vector2 velocity, + float angle, float angularVelocity, Color color, float size, int ttl) + { + Texture = texture; + Position = position; + Velocity = velocity; + Angle = angle; + AngularVelocity = angularVelocity; + Color = color; + Size = size; + TTL = ttl; + } + + public void Update() + { + TTL--; + Position += Velocity; + Angle += AngularVelocity; + } + + public void Draw(SpriteBatch spriteBatch) + { + Rectangle sourceRectangle = new Rectangle(0, 0, Texture.Width, Texture.Height); + Vector2 origin = new Vector2(Texture.Width / 2, Texture.Height / 2); + + spriteBatch.Draw(Texture, Position, sourceRectangle, Color, + Angle, origin, Size, SpriteEffects.None, 0f); + } + + } +} |