@Override
	protected void update() {
		this.gameClockTrigger++;
		//The level will take care of whatever happens next every second.
		if(this.gameClockTrigger % 100 == 0) {
			this.gameClockTrigger = 0;
			this.level.handleUpdateTick();
		}
		
		//Take care of the usual bussiness
		this.entityUpdateIterator.reset();
		while (this.entityUpdateIterator.hasNext()) {
			this.entityUpdateIterator.next().update();
		}
		// Pass the collision handler a copy of the entity list
		CollisionHandler.handleCollisions();
		if (Keyboard.isKeyDown(KeyEvent.VK_ESCAPE)) {
			this.setOverlay(new GamePausedScreen(this), false);
		}
		
		//React if the game is actually over.
		if (this.level.isGameOver()) {
			boolean playerGotNewHighscore = (Highscore.getPlacement(PlayerSession.getScore()) != -1);
			if(this.level.playerHasWon()) {
				if(PlayerSession.getNextLevel() == null) {
					//Allow entering a new highscore depending on whether it actually is a new highscore.
					if(playerGotNewHighscore) {
						this.parent.setOverlay(new EnterHighscoreScreen(this.parent));
					} else {
						this.parent.setOverlay(new ViewHighscoreScreen(this.parent));
					}
				} else {
					//Go to the I don't know yet Screen if the game is over and the player WON.
					this.parent.setOverlay(new GameWonScreen(this.parent));
				}
			} else {
				//Go to GameOverScreen if the game is over - the player died and lost the game.
				//Allow entering a new highscore depending on whether it actually is a new highscore.
				if(playerGotNewHighscore) {
					this.parent.setOverlay(new EnterHighscoreScreen(this.parent));
				} else {
					this.parent.setOverlay(new ViewHighscoreScreen(this.parent));
				}
			}
		}
	}