From: Kyle Date: Wed, 21 Apr 2010 19:49:53 +0000 (+0000) Subject: Display should now follow correct player in a network game(Not Tested Yet!) X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=16658241429e8befc3cb171a62163f36dedb6a33;p=chaz%2Fcarfire Display should now follow correct player in a network game(Not Tested Yet!) git-svn-id: https://bd85.net/svn/cs3505_group@124 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- diff --git a/CarFire/CarFire/CarFire/Display.cs b/CarFire/CarFire/CarFire/Display.cs index aceadfe..dd07212 100644 --- a/CarFire/CarFire/CarFire/Display.cs +++ b/CarFire/CarFire/CarFire/Display.cs @@ -63,7 +63,7 @@ namespace CarFire /// checking for collisions, gathering input, and playing audio. /// /// Provides a snapshot of timing values. - public void Update(TimeSpan timespan, GameState state) + public void Update(TimeSpan timespan, GameState state, int thisPlayer) { //INPUT - testing input... has to be through network later @@ -141,9 +141,9 @@ namespace CarFire } } - if (mCharacters[0] != null) + if (mCharacters[thisPlayer] != null) { - mGame.State.Map.CenterCell = mCharacters[0].Position; + mGame.State.Map.CenterCell = mCharacters[thisPlayer].Position; } //Handle wall collisions of projectiles again... for (int i = 0; i < mProjectiles.Count; i++) diff --git a/CarFire/CarFire/CarFire/Game.cs b/CarFire/CarFire/CarFire/Game.cs index fa3fbd1..38ec627 100644 --- a/CarFire/CarFire/CarFire/Game.cs +++ b/CarFire/CarFire/CarFire/Game.cs @@ -361,7 +361,7 @@ namespace CarFire public long Update(TimeSpan elapsedTime) { State.AdvanceFrame(mInputs, elapsedTime.Milliseconds); // Apply the inputs, advance game state. - mDisplay.Update(elapsedTime, State); + mDisplay.Update(elapsedTime, State, mThisPlayerID); State.Entities.ForEach(delegate(IEntity e) { e.Update(elapsedTime); }); mInputs = new NextInputs(State.NumberOfPlayers); // Start with inputs cleared on the next frame. //mDisplay.Update(elapsedTime);