X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FMelee.cs;h=03f5a65bcf27be1879abf276cc1454ad75f9bef2;hp=38be3038a5ae2e231affcf3ac3b9a29890173a65;hb=236bc590ff21370c1139a8c01ff35f7b30af743d;hpb=f67652c2fe85f9ba6c71dedbab26760775004e00 diff --git a/CarFire/CarFire/CarFire/Melee.cs b/CarFire/CarFire/CarFire/Melee.cs index 38be303..03f5a65 100644 --- a/CarFire/CarFire/CarFire/Melee.cs +++ b/CarFire/CarFire/CarFire/Melee.cs @@ -18,10 +18,14 @@ namespace CarFire int coolDown; Texture2D charModel; Texture2D projectileModel; + bool isAttacking; int velocityX; int velocityY; #endregion + //zac variable + AnimateMelee animateMelee; + #region Public Methods public Melee(Game theGame, String Name, Point position, int playerIndex) : base(theGame, Name, position, playerIndex, baseHealth, baseDamage) @@ -36,6 +40,11 @@ namespace CarFire charModel = contentManager.Load("cs"); //change to charModel when designed projectileModel = contentManager.Load("projectile"); //change to a projectile model later + /*Zac + */ + + animateMelee = new AnimateMelee(contentManager, this); + } /// /// This method will draw a character to the screen. @@ -44,17 +53,28 @@ namespace CarFire public override void Draw(SpriteBatch spriteBatch) { Rectangle position = Game.State.Map.GetRectangleFromCoordinates(Motion.Position); - spriteBatch.Draw(charModel, position, Color.White); + Point aPosition = Game.State.Map.GetPointFromCoordinates(Motion.Position); + Vector2 drawPosition = new Vector2(aPosition.X, aPosition.Y); + //spriteBatch.Draw(charModel, position, Color.White); + if (isAttacking) + animateMelee.AttackLeft(spriteBatch, drawPosition); + + } + public override void UpdateFrame(TimeSpan timeSpan) + { + animateMelee.Update(timeSpan); } - public override void Attack(List keysPressed) { if (coolDown > 0) coolDown--; else if (coolDown == 0) { + isAttacking = false; if (keysPressed.Contains(Keys.Space)) { + isAttacking = true; + coolDown = hitCoolDown; int startX = Coordinates.X; int startY = Coordinates.Y; if (Motion.Direction == Direction.Down || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.LowerRight)