X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FMelee.cs;h=4c053a6a8c26a7efd14b9786ed5bb56594a12334;hp=299f2e79a794b9b2e18b04081eb0239cb4b8a5a6;hb=b5eebc2087c00bb67b3a3b9ddcec4743aa7a8cdb;hpb=0470a7b148c79aaacf0d8107b5bd40fa1e81ac0a diff --git a/CarFire/CarFire/CarFire/Melee.cs b/CarFire/CarFire/CarFire/Melee.cs index 299f2e7..4c053a6 100644 --- a/CarFire/CarFire/CarFire/Melee.cs +++ b/CarFire/CarFire/CarFire/Melee.cs @@ -15,6 +15,7 @@ namespace CarFire const int hitCoolDown = 18; const int baseHealth = 200; const int baseDamage = 30; + int coolDown; Texture2D charModel; Texture2D projectileModel; #endregion @@ -23,7 +24,7 @@ namespace CarFire public Melee(Game theGame, String Name, Point position, int playerIndex) : base(theGame, Name, position, playerIndex, baseHealth, baseDamage) { - projectileSpeed = 8; + coolDown = hitCoolDown; } #endregion @@ -46,17 +47,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 }