public void update() {
        player.update();
        tileMap.update();

        if(tileMap.isVictory()){
            victoryActions();
        }
        else if (player.isDead()) {
            gameStateControl.setPaused(gameStateControl.getGameState());
            gameStateControl.setGameState(LevelType.DEATH);
        }
        else {
            if (randomize) {
                //randomize and update tile map
                shouldRandomize = !shouldRandomize;
                if(shouldRandomize){
                    tileMap.randomize();
                    player.updateMap(tileMap);
                }
            }

            if (player.getX() < xmax || player.getX() > xmin) {
                tileMap.setX((int) (GamePanel.WIDTH / 2 - player.getX()));
            }
            if (player.getY() > GamePanel.HEIGHT / 2 && player.getY() != 0) {
                tileMap.setY((int) (GamePanel.HEIGHT / 2 - player.getY()));
            }
        }
    }