Entity.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //---------------------------------------------------------------------------------
  2. // Ported to the Atomic Game Engine
  3. // Originally written for XNA by Michael Hoffman
  4. // Find the full tutorial at: http://gamedev.tutsplus.com/series/vector-shooter-xna/
  5. //----------------------------------------------------------------------------------
  6. using AtomicEngine;
  7. namespace AtomicBlaster
  8. {
  9. abstract class Entity
  10. {
  11. protected CustomSprite image;
  12. // The tint of the image. This will also allow us to change the transparency.
  13. protected Color color = Color.White;
  14. public Vector2 Position, Velocity;
  15. public float Orientation;
  16. public float Radius = 20; // used for circular collision detection
  17. public bool IsExpired; // true if the entity was destroyed and should be deleted.
  18. public Vector2 Size
  19. {
  20. get
  21. {
  22. return image == null ? Vector2.Zero : new Vector2(image.Width, image.Height);
  23. }
  24. }
  25. public abstract void Update();
  26. public virtual void Draw(/*SpriteBatch spriteBatch*/)
  27. {
  28. CustomRenderer.Draw(image, Position, color, Orientation, Size / 2, 1.0f, 0);
  29. //spriteBatch.Draw(image, Position, null, color, Orientation, Size / 2f, 1f, 0, 0);
  30. }
  31. }
  32. }