X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FMelee.cs;h=f52301219c667184ef107a0d4f1e3cc366329288;hb=fc34f843ea42a3496a7ff5dd04853695ba628e8b;hp=299f2e79a794b9b2e18b04081eb0239cb4b8a5a6;hpb=0470a7b148c79aaacf0d8107b5bd40fa1e81ac0a;p=chaz%2Fcarfire diff --git a/CarFire/CarFire/CarFire/Melee.cs b/CarFire/CarFire/CarFire/Melee.cs index 299f2e7..f523012 100644 --- a/CarFire/CarFire/CarFire/Melee.cs +++ b/CarFire/CarFire/CarFire/Melee.cs @@ -15,15 +15,18 @@ namespace CarFire const int hitCoolDown = 18; const int baseHealth = 200; const int baseDamage = 30; + int coolDown; Texture2D charModel; Texture2D projectileModel; + int velocityX; + int velocityY; #endregion #region Public Methods public Melee(Game theGame, String Name, Point position, int playerIndex) : base(theGame, Name, position, playerIndex, baseHealth, baseDamage) { - projectileSpeed = 8; + coolDown = hitCoolDown; } #endregion @@ -46,17 +49,57 @@ namespace CarFire public override void Attack(List keysPressed) { - if (hitCoolDown > 0) - hitCoolDown--; - else if (hitCoolDown == 0) + if (coolDown > 0) + coolDown--; + else if (coolDown == 0) { if (keysPressed.Contains(Keys.Space)) { - + int startX = Coordinates.X; + int startY = Coordinates.Y; + if (Motion.Direction == Direction.Down || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.LowerRight) + { + velocityY = 1; + startY = Coordinates.Y + 1; + } + else if (Motion.Direction == Direction.Up || Motion.Direction == Direction.UpperLeft || Motion.Direction == Direction.UpperRight) + { + velocityY = -1; + startY = Coordinates.Y - 1; + } + if (Motion.Direction == Direction.Right || Motion.Direction == Direction.LowerRight || Motion.Direction == Direction.UpperRight) + { + velocityX = 1; + startX = Coordinates.X + 1; + } + else if (Motion.Direction == Direction.Left || Motion.Direction == Direction.LowerLeft || Motion.Direction == Direction.UpperLeft) + { + velocityX = -1; + startX = Coordinates.X - 1; + } + //Attack a monster + if (!Game.IsCellOpen(new Point(startX, startY))) + { + foreach (IEntity entity in Game.State.Entities) + { + //See if it is a monster + + //Damage the monster + + } + } } } + } + public override void PlayAttackSound() + { + + } + public override void PlayDieSound() + { + } #endregion }