aboutsummaryrefslogtreecommitdiff
path: root/SuperPolarity/Actors/GameActor.cs
diff options
context:
space:
mode:
authorBen Beltran <ben@nsovocal.com>2014-05-31 12:39:02 -0500
committerBen Beltran <ben@nsovocal.com>2014-05-31 12:39:02 -0500
commit05e4b948df39b47d33067049cf51fd3be7749031 (patch)
tree36a0151b009e29a16e34bfecb31a4a99ba3a5d86 /SuperPolarity/Actors/GameActor.cs
parent8bdfcb11a2c1023c684093c0f19f3cc65799e0f8 (diff)
Moves some files around!
Diffstat (limited to 'SuperPolarity/Actors/GameActor.cs')
-rw-r--r--SuperPolarity/Actors/GameActor.cs80
1 files changed, 80 insertions, 0 deletions
diff --git a/SuperPolarity/Actors/GameActor.cs b/SuperPolarity/Actors/GameActor.cs
new file mode 100644
index 0000000..8015ffa
--- /dev/null
+++ b/SuperPolarity/Actors/GameActor.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Content;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace SuperPolarity
+{
+ public class GameActor : Actor
+ {
+ // Graphics / In-Game
+ protected Texture2D Texture;
+ protected Vector2 Origin;
+
+ // Constraints / Behavior
+ public int HP;
+ protected bool Immortal;
+ public int Value;
+
+ public override int Width
+ {
+ get { return Texture.Width; }
+ }
+
+ public override int Height
+ {
+ get { return Texture.Height; }
+ }
+
+ public GameActor(SuperPolarity newGame)
+ : base(newGame)
+ {
+ }
+
+ public virtual void Initialize(Texture2D texture, Vector2 position)
+ {
+ base.Initialize (position);
+
+ Texture = texture;
+
+ Collides = true;
+
+ Origin = new Vector2(Texture.Width / 2, Texture.Height / 2);
+
+ HP = 1;
+ Immortal = false;
+
+ Value = 1;
+ InitBox ();
+ }
+
+ public override void Draw(SpriteBatch spriteBatch)
+ {
+ base.Draw(spriteBatch);
+
+ spriteBatch.Draw(Texture, Position, null, Color, Angle, Origin, 1f, SpriteEffects.None, 0f);
+ }
+
+ public override void CleanUp()
+ {
+ base.CleanUp ();
+ Texture = null;
+ }
+
+
+ public void TakeDamage(int amount)
+ {
+ if (!Immortal)
+ {
+ HP = HP - amount;
+ if (HP < 0)
+ {
+ Die();
+ }
+ }
+ }
+ }
+}