public override void Update(GameTime gameTime) { //Check for collision. foreach (CollisionTile tile in map.TileList) { if (tile.Collision) { player.Collision(tile.Rectangle, map.Width, map.Height); } } player.Update(gameTime); //If the player went into a new room. if (player.ChangeRoom != 0) { switch (player.ChangeRoom) { case 1: player.CurrentRoom = map.Tunnels[player.CurrentRoom].RoomOne; break; case 2: player.CurrentRoom = map.Tunnels[player.CurrentRoom].RoomTwo; break; case 3: player.CurrentRoom = map.Tunnels[player.CurrentRoom].RoomThree; break; } //If the wumpus is awake try and move it. if (Wumpus.Instance.IsAwake) { Wumpus.Instance.TryMove(player.CurrentRoom); } //If the current room has wumpus wake it, or if it is kill player. if (Wumpus.Instance.Room == player.CurrentRoom) { if (Wumpus.Instance.IsAwake) { mainLevelManager.ChangeScreens(gameRef.killScreen); } else { Wumpus.Instance.IsAwake = true; } } //If room has a pit, you die. if (Pit.Instance.ContainsPits(player.CurrentRoom)) { mainLevelManager.ChangeScreens(gameRef.pitFall); } //If room has superbats you get put in a random new room that doesnt have a hazzard. if (SuperBats.Instance.ContainsSuperbats(player.CurrentRoom)) { int newRoom = -1; while (newRoom == -1) { newRoom = RandomNum.Instance.Next(0, Constants.NUM_OF_ROOMS); if (SuperBats.Instance.ContainsSuperbats(newRoom) || Pit.Instance.ContainsPits(newRoom) || (player.CurrentRoom == newRoom) || (Wumpus.Instance.Room == newRoom)) { newRoom = -1; } else { player.CurrentRoom = newRoom; } } } if (SuperBats.Instance.ContainsSuperbats(player.CurrentRoom)) { double counter = gameTime.ElapsedGameTime.TotalSeconds; while (gameTime.ElapsedGameTime.TotalSeconds - counter < 5) { SuperBats.Instance.Draw(Game1.spriteBatch); } } //Update text to the screen. screenText.setText(player.CurrentRoom, map.Tunnels[player.CurrentRoom].RoomOne, map.Tunnels[player.CurrentRoom].RoomTwo, map.Tunnels[player.CurrentRoom].RoomThree, player.NumberArrows); //Reset variable to zero, room change is complete. player.ChangeRoom = 0; } base.Update(gameTime); if (KeyboardManager.Instance.KeyPressed(Keys.Z)) { mainLevelManager.ChangeScreens(gameRef.killScreen); } if (KeyboardManager.Instance.KeyPressed(Keys.T)) { isShooting = true; } if (KeyboardManager.Instance.KeyPressed(Keys.Escape)) { isShooting = false; } if (isShooting) { //process shooting somehow } }