X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fcarfire;a=blobdiff_plain;f=CarFire%2FCarFire%2FCarFire%2FPlayer.cs;h=a827ae250001a9afe4997a29bb36d55c3d6886f7;hp=58460500a02932441be7bd4142fd5ba51c8b6f20;hb=236bc590ff21370c1139a8c01ff35f7b30af743d;hpb=9fc306c489b446612f0fc1b363e490a5ff217d2c diff --git a/CarFire/CarFire/CarFire/Player.cs b/CarFire/CarFire/CarFire/Player.cs index 5846050..a827ae2 100644 --- a/CarFire/CarFire/CarFire/Player.cs +++ b/CarFire/CarFire/CarFire/Player.cs @@ -14,7 +14,7 @@ namespace CarFire { #region Member variables //The number of frames between each projectile is spawned. - const float basePlayerSpeed = 4.0f; + const float basePlayerSpeed = 8.0f; const int shootCoolDown = 18; String CharName; Game game; @@ -57,16 +57,21 @@ namespace CarFire mPlayerIndex = playerIndex; // Speed is the number of grid cells you can move through per second. - mMotion = new MovementManager(position, 25.0f); + mMotion = new MovementManager(position, basePlayerSpeed); } public void causeDamageTo(int amount) { playerHealth -= amount; } - - public void Update(TimeSpan timeSpan) + public void Update(TimeSpan timespan) { + } + public void Update(TimeSpan timeSpan, List keysPressed) + { + UpdatePosition(timeSpan, keysPressed); + Attack(keysPressed); + UpdateFrame(timeSpan); } /// /// Moves the current player being controlled based on a given set of key presses. @@ -103,7 +108,8 @@ namespace CarFire } } - if (direction != Direction.None && !keysPressed.Contains(Keys.LeftControl)) mMotion.Update(timeSpan, direction); + if (direction != Direction.None && !keysPressed.Contains(Keys.LeftControl)) + mMotion.Update(timeSpan, direction); else mMotion.LockUpdate(timeSpan, moveLeft, moveRight, moveUp, moveDown); } @@ -136,6 +142,7 @@ namespace CarFire /// public abstract void Draw(SpriteBatch spriteBatch); public abstract void Attack(List keysPressed); + public abstract void UpdateFrame(TimeSpan timeSpan); #endregion