From: Kyle Date: Tue, 27 Apr 2010 19:00:26 +0000 (+0000) Subject: git-svn-id: https://bd85.net/svn/cs3505_group@164 92bb83a3-7c8f-8a45-bc97-515c4e399668 X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=3c616e65a6ecf3ebe7b494c9e22c96bc53a1a36f;p=chaz%2Fcarfire git-svn-id: https://bd85.net/svn/cs3505_group@164 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire/AnimateMelee.cs b/CarFire/CarFire/CarFire/AnimateMelee.cs index e114dbe..05220ee 100644 --- a/CarFire/CarFire/CarFire/AnimateMelee.cs +++ b/CarFire/CarFire/CarFire/AnimateMelee.cs @@ -22,44 +22,47 @@ namespace CarFire private string ph; private Vector2 position; private SpriteBatch character; + Player Player; //constructor(s) - public AnimateMelee(ContentManager content) + public AnimateMelee(ContentManager content, Player player) { SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f); contentManager = content; ph = fileNames[3]; position = Vector2.Zero; + Player = player; + } //methods - public void AttackLeft(SpriteBatch spriteBatch) + public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot) { ph = fileNames[0]; //graphics = graphicsDeviceManager; //this.spriteBatch = spriteBatch; //spriteBatch. - - character = new SpriteBatch(spriteBatch.GraphicsDevice); - Animate(); + //character = new SpriteBatch(spriteBatch.GraphicsDevice); + character = spriteBatch; + Animate(drawSpot); // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1); } - public void Animate() + public void Animate(Vector2 drawSpot) { //character = new SpriteBatch(graphics.GraphicsDevice); // "character" is the name of the sprite asset in the project. Console.WriteLine(ph); SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1); //viewport = graphics.GraphicsDevice.Viewport; - position = new Vector2(0, 0);//viewport.Width / 2, 0);//viewport.Height / 2f); - - character.Begin(); - SpriteTexture.DrawFrame(character, position); - character.End(); + position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f); + Console.WriteLine(drawSpot); + //character.Begin(); + SpriteTexture.DrawFrame(character, drawSpot); + //character.End(); } } diff --git a/CarFire/CarFire/CarFire/Melee.cs b/CarFire/CarFire/CarFire/Melee.cs index cb25ac8..b597cb3 100644 --- a/CarFire/CarFire/CarFire/Melee.cs +++ b/CarFire/CarFire/CarFire/Melee.cs @@ -41,7 +41,7 @@ namespace CarFire /*Zac */ - animateMelee = new AnimateMelee(contentManager); + animateMelee = new AnimateMelee(contentManager, this); } /// @@ -51,8 +51,10 @@ namespace CarFire public override void Draw(SpriteBatch spriteBatch) { Rectangle position = Game.State.Map.GetRectangleFromCoordinates(Motion.Position); + Point aPosition = Game.State.Map.GetPointFromCoordinates(Motion.Position); + Vector2 drawPosition = new Vector2(aPosition.X, aPosition.Y); //spriteBatch.Draw(charModel, position, Color.White); - animateMelee.AttackLeft(spriteBatch); + animateMelee.AttackLeft(spriteBatch, drawPosition); }