-#define SINGLE_TEST\r
+#undef SINGLE_TEST\r
\r
using System;\r
using System.Collections.Generic;\r
/// </summary>\r
public class Display\r
{\r
+ bool playerChosen = false;\r
List<Projectile> mProjectiles = new List<Projectile>();\r
- List<IPlayer> mCharacters = new List<IPlayer>();\r
+ //List<IPlayer> mCharacters = new List<IPlayer>();\r
+ IPlayer[] mCharacters = new IPlayer[4];\r
Texture2D everything;\r
Map mMap;\r
int currentCenterX = 5;\r
/// checking for collisions, gathering input, and playing audio.\r
/// </summary>\r
/// <param name="gameTime">Provides a snapshot of timing values.</param>\r
- public void Update(TimeSpan timespan)\r
+ public void Update(TimeSpan timespan, GameState state)\r
{\r
+ \r
//INPUT - testing input... has to be through network later\r
#if SINGLE_TEST\r
KeyboardState keyState = Keyboard.GetState();\r
}\r
mMap.CenterCell = new Vector2(mCharacters[0].GridX, mCharacters[0].GridY);\r
#endif\r
-\r
+ \r
+ for (int i = 0; i < 4; i++)\r
+ {\r
+ if (mCharacters[i] == null)\r
+ {\r
+ if(state.keysDown[i].Contains(Keys.Enter))\r
+ {\r
+ mCharacters[i] = (new Human(mMap, "", everything));\r
+ mCharacters[i].GridX = mMap.GetStartingPositionForPlayer(i+1).X;\r
+ mCharacters[i].GridY = mMap.GetStartingPositionForPlayer(i+1).Y;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ mMap.CenterCell = new Vector2(mCharacters[0].GridX, mCharacters[0].GridY);\r
+ mCharacters[i].MovePlayer(state.keysDown[i]);\r
+ }\r
+ }\r
for (int i = 0; i < mProjectiles.Count; i++ )\r
{\r
mProjectiles[i].Update(timespan);\r
}\r
}\r
//Check for collisons\r
- for (int j = 0; j < mCharacters.Count; j++) \r
+ for (int j = 0; j < mCharacters.Length; j++) \r
{\r
\r
- \r
+ if(mCharacters[j] != null)\r
for (int i = 0; i < mProjectiles.Count; i++)\r
{\r
if (mProjectiles[i].GridX == mCharacters[j].GridX && mProjectiles[i].GridY == mCharacters[j].GridY)\r
projectile.Draw(spriteBatch);\r
\r
}\r
- foreach(IPlayer character in mCharacters)\r
+ for(int i = 0; i < 4; i++)//IPlayer character in mCharacters)\r
{\r
- character.Draw(spriteBatch);\r
+ if(mCharacters[i] != null)\r
+ mCharacters[i].Draw(spriteBatch);\r
} \r
}\r
\r
public void AddCharacters(IPlayer player)\r
{\r
- mCharacters.Add(player);\r
+ mCharacters[mCharacters.Length] = player;\r
+ //mCharacters.Add(player);\r
}\r
}\r
}\r