private void calcTime(GameContainer gc, StateBasedGame sbg, int delta)
			throws SlickException {
		// Stores the current time.
		int secondsPlayedOld = secondsPlayed;

		// Increments the time based on delta.
		time += delta;
		secondsPlayed = time/1000;

		// If it's been one second.
		if (secondsPlayed - secondsPlayedOld != 0){
			timeLeft--;
			if(timeLeft == 0 && Settings.level < 7){
				// Increments the player number for multiplayer.
				if (Settings.currentPlayer < Settings.players){
					Settings.currentPlayer++;
				}
				
				// Sets the current player back to 1 after everyone has had a turn.
				else if (Settings.currentPlayer == Settings.players){
					Settings.currentPlayer = 1;
				}
				
				// Refresh and enter the level cleared state.
				sbg.getState(Game.LEVEL_CLEARED_STATE).init(gc, sbg);
				sbg.enterState(Game.LEVEL_CLEARED_STATE);
			}

			else if (timeLeft == 0 && Settings.level == 7){
				sbg.addState(new EndOfGame(Game.END_OF_GAME_STATE));
				sbg.getState(Game.END_OF_GAME_STATE).init(gc, sbg);
				sbg.enterState(Game.END_OF_GAME_STATE);
			}
		}

		spawner.timedSpawn();
	}