git-svn-id: https://bd85.net/svn/cs3505_group@164 92bb83a3-7c8f-8a45-bc97-515c4e399668
authorKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Tue, 27 Apr 2010 19:00:26 +0000 (19:00 +0000)
committerKyle <Kyle@92bb83a3-7c8f-8a45-bc97-515c4e399668>
Tue, 27 Apr 2010 19:00:26 +0000 (19:00 +0000)
CarFire/CarFire/CarFire/AnimateMelee.cs
CarFire/CarFire/CarFire/Melee.cs

index e114dbe..05220ee 100644 (file)
@@ -22,44 +22,47 @@ namespace CarFire
         private string ph;\r
         private Vector2 position;\r
         private SpriteBatch character;\r
+        Player Player;\r
 \r
         //constructor(s)\r
-        public AnimateMelee(ContentManager content)\r
+        public AnimateMelee(ContentManager content, Player player)\r
         {\r
             SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f);\r
             contentManager = content;\r
             ph = fileNames[3];\r
             position = Vector2.Zero;\r
+            Player = player;\r
+            \r
         }\r
 \r
         //methods\r
 \r
-        public void AttackLeft(SpriteBatch spriteBatch)\r
+        public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot)\r
         {\r
             ph = fileNames[0];\r
             //graphics = graphicsDeviceManager;\r
             //this.spriteBatch = spriteBatch;\r
             //spriteBatch.\r
-\r
-            character = new SpriteBatch(spriteBatch.GraphicsDevice);\r
-            Animate();\r
+            //character = new SpriteBatch(spriteBatch.GraphicsDevice);\r
+            character = spriteBatch;\r
+            Animate(drawSpot);\r
 \r
 \r
             // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1);\r
         }\r
 \r
-        public void Animate()\r
+        public void Animate(Vector2 drawSpot)\r
         {\r
             //character = new SpriteBatch(graphics.GraphicsDevice);\r
             // "character" is the name of the sprite asset in the project.\r
             Console.WriteLine(ph);\r
             SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);\r
             //viewport = graphics.GraphicsDevice.Viewport;\r
-            position = new Vector2(0, 0);//viewport.Width / 2, 0);//viewport.Height / 2f);\r
-\r
-            character.Begin();\r
-            SpriteTexture.DrawFrame(character, position);\r
-            character.End();\r
+            position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f);\r
+            Console.WriteLine(drawSpot);\r
+            //character.Begin();\r
+            SpriteTexture.DrawFrame(character, drawSpot);\r
+            //character.End();\r
         }\r
 \r
     }\r
index cb25ac8..b597cb3 100644 (file)
@@ -41,7 +41,7 @@ namespace CarFire
 \r
             /*Zac\r
              */\r
-            animateMelee = new AnimateMelee(contentManager); \r
+            animateMelee = new AnimateMelee(contentManager, this); \r
 \r
         }\r
         /// <summary>\r
@@ -51,8 +51,10 @@ namespace CarFire
         public override void Draw(SpriteBatch spriteBatch)\r
         {\r
             Rectangle position = Game.State.Map.GetRectangleFromCoordinates(Motion.Position);\r
+            Point aPosition = Game.State.Map.GetPointFromCoordinates(Motion.Position);\r
+            Vector2 drawPosition = new Vector2(aPosition.X, aPosition.Y);\r
             //spriteBatch.Draw(charModel, position, Color.White);\r
-            animateMelee.AttackLeft(spriteBatch);\r
+            animateMelee.AttackLeft(spriteBatch, drawPosition);\r
             \r
         }\r
 \r
This page took 0.027479 seconds and 4 git commands to generate.