DarkTornado

Particle Class Example

Jun 4th, 2011
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1.     class Particle
  2.     {
  3.         private Texture2D _sprite;
  4.        
  5.  
  6.         //The sprite of the particle.
  7.         public Texture2D sprite
  8.         {
  9.             get
  10.             {
  11.                 return _sprite;
  12.             }
  13.             set
  14.             {
  15.                 _sprite = value;
  16.                 rect = new Rectangle(0, 0, _sprite.Width, _sprite.Height);
  17.             }
  18.         }
  19.  
  20.         //Check if the particle should be removed.
  21.         public bool remove
  22.         {
  23.             get
  24.             {
  25.                 return _remove;
  26.             }
  27.         }
  28.         private bool _remove = false;
  29.  
  30.         public static SpriteBatch spriteBatch; //The sprite batch where the particles will be drawn.
  31.         public static GraphicsDeviceManager graphics; //
  32.         private Rectangle rect; //The rectangle of the particle (to check if the particle is in the screen).
  33.         public bool relativeRotation = true; //Rotation relatiove to direction.
  34.         public Vector2 position; //Position.
  35.         public Color[] color; //Array of colors.
  36.         public bool randomWiggle = true; //Start with random wiggle
  37.         private PropertyUpdater sizeUpdater; //Size
  38.         private PropertyUpdater rotationUpdater; //Rotation
  39.         private PropertyUpdater speedUpdater; //Speed
  40.         private PropertyUpdater directionUpdater; //Direction
  41.         private int timer; //Timer, to set the color and check if the particle should be removed.
  42.     private int lifeTime; //Life time in seconds until the particle is removed.
  43.    }
Advertisement
Add Comment
Please, Sign In to add comment