function playGame() {
    if(audio.isMenuMusic) {
        stopMenuMusic();
    }
    playMusic();
    timer = timeLimit/1000;
    score = 0;
    scoreDisplay.textContent = 0;
    highScoreDisplay.textContent = highScore;
    timerDisplay.textContent = timer;
    timeUp = false;
    gameActive = true;
    ambush();

startTimer = setInterval(()=>{
        timer -= 1;
        timerDisplay.textContent = timer;
        if (timer <= 0) {
            timer = 0;
            clearInterval(startTimer);
            gameOver();
        }
    }, 1000);
}
// This is the master function for gameplay, and calls all participating sub-functions e.g. ambush, audio, etc 
This is the master function for gameplay, and calls all participating sub-functions e.g. ambush, audio, etc
This is the master function for gameplay and calls all participating sub - functions e . g . ambush audio etc
function playGame() {
    if(audio.isMenuMusic) {
        stopMenuMusic();
    }
    playMusic();
    timer = timeLimit/1000;
    score = 0;
    scoreDisplay.textContent = 0;
    highScoreDisplay.textContent = highScore;
    timerDisplay.textContent = timer;
    timeUp = false;
    gameActive = true;
    ambush();
startTimer = setInterval(()=>{
        timer -= 1;
        timerDisplay.textContent = timer;
        if (timer <= 0) {
            timer = 0;
            clearInterval(startTimer);
            gameOver();
        }
    }, 1000);
}
function playGame ( ) { if ( audio . isMenuMusic ) { stopMenuMusic ( ) ; } playMusic ( ) ; timer = timeLimit / 1000 ; score = 0 ; scoreDisplay . textContent = 0 ; highScoreDisplay . textContent = highScore ; timerDisplay . textContent = timer ; timeUp = false ; gameActive = true ; ambush ( ) ; startTimer = setInterval ( ( ) => { timer -= 1 ; timerDisplay . textContent = timer ; if ( timer <= 0 ) { timer = 0 ; clearInterval ( startTimer ) ; gameOver ( ) ; } } , 1000 ) ; }
This is the master function for gameplay, and calls all participating sub-functions e.g.
This is the master function for gameplay and calls all participating sub - functions e . g .