From: Kyle Date: Fri, 23 Apr 2010 03:12:38 +0000 (+0000) Subject: Can now choose between melee and ranged character... melee attack not X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=51e2ac05cd36fffa4fd39d592c5df91dae4752ed;p=chaz%2Fcarfire Can now choose between melee and ranged character... melee attack not implemented yet. git-svn-id: https://bd85.net/svn/cs3505_group@136 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire/Game.cs b/CarFire/CarFire/CarFire/Game.cs index dce6ba4..be18be7 100644 --- a/CarFire/CarFire/CarFire/Game.cs +++ b/CarFire/CarFire/CarFire/Game.cs @@ -245,6 +245,21 @@ namespace CarFire public Game() { + } + /// + /// This method should be called whenever the players want to move to a new map. + /// Not implemented yet. Need some way to get next map. + /// + public void startNewMap() + { + //TODO somehow get next map + State.Entities.Clear(); + //State.Map = State.Map.getNextMap(); + for (int i = 0; i < State.mCharacters.Length; i++) + { + State.mCharacters[i].Coordinates = State.Map.GetStartingPositionForPlayer(i + 1); + } + State.Entities = State.Map.GetAllEntities(); } public void LoadContent(ContentManager contentManager) { @@ -382,7 +397,12 @@ namespace CarFire if (State.mCharacters[i] == null) { allCharactersSelected = false; - if (State.GetKeysDown(i).Contains(Keys.Enter)) + if (State.GetKeysDown(i).Contains(Keys.M)) + { + State.mCharacters[i] = new Melee(this, "", State.Map.GetStartingPositionForPlayer(i + 1), i); + State.mCharacters[i].LoadContent(mContentManager); + } + else if (State.GetKeysDown(i).Contains(Keys.R)) { State.mCharacters[i] = new Ranged(this, "", State.Map.GetStartingPositionForPlayer(i + 1), i); State.mCharacters[i].LoadContent(mContentManager); @@ -397,7 +417,7 @@ namespace CarFire else { spriteBatch.GraphicsDevice.Clear(Color.Black); - spriteBatch.DrawString(menu, "Press Enter To Select A Character", new Vector2(30, 30), Color.RosyBrown); + spriteBatch.DrawString(menu, "Press R to select a Ranged Character and M to select a Melee Character", new Vector2(30, 30), Color.RosyBrown); } return CurrentFrameNumber; } diff --git a/CarFire/CarFire/CarFire/Player.cs b/CarFire/CarFire/CarFire/Player.cs index 0a8d4e5..6af9f19 100644 --- a/CarFire/CarFire/CarFire/Player.cs +++ b/CarFire/CarFire/CarFire/Player.cs @@ -14,6 +14,7 @@ namespace CarFire { #region Member variables //The number of frames between each projectile is spawned. + const float basePlayerSpeed = 4.0f; const int shootCoolDown = 18; String CharName; Game game; @@ -32,7 +33,12 @@ namespace CarFire public MovementManager Motion { get { return mMotion; } } public int PlayerIndex { get { return mPlayerIndex; } } public Vector2 Position { get { return mMotion.Position; } } - public Point Coordinates { get { return mMotion.Coordinates; } } + public Point Coordinates { get { return mMotion.Coordinates; } + set + { + Coordinates = value; + mMotion = new MovementManager(value, basePlayerSpeed); + } } public int Damage { get { return playerDamage; } set { playerDamage = value; } } #endregion