function showGameOverCard() {
    const score = {
      playername: playerName,
      level: currentLevel,
      kills: molesKilled
    };
    highScores.push(score);
    highScores.sort((a, b) => b.kills - a.kills);
    highScores.splice(5);
    localStorage.setItem("highScores", JSON.stringify(highScores));
    highScoreList.innerHTML = "";
    highScores.forEach(entry => {
      highScoreList.innerHTML += `<li> Level/Kills: ${entry.level}/${entry.kills} Name: ${entry.playername}</li>`;
    });
    gameOverText.innerText = `Congrats ${playerName}:
                  You have reached level ${currentLevel}!
                  The tales of this hunt will be long told after your death...`;
    gameOverAudio.play();
    gameOverCard.classList.add("display-block");
    runningGame = false;
    fieldActive = false;
  }
//Create score element. Add to high score. Sort it scores. Cut at length 5. Save to local storage. Empty high score list. Add items from array as li to html. Create personalized game over text. Pl;ay audio. Show card. Switch game and field off.

Create score element. Add to high score. Sort it scores. Cut at length 5. Save to local storage. Empty high score list. Add items from array as li to html. Create personalized game over text. Pl;ay audio. Show card. Switch game and field off.
Create score element . Add to high score . Sort it scores . Cut at length 5 . Save to local storage . Empty high score list . Add items from array as li to html . Create personalized game over text . Pl ; ay audio . Show card . Switch game and field off .
function showGameOverCard() {
    const score = {
      playername: playerName,
      level: currentLevel,
      kills: molesKilled
    };
    highScores.push(score);
    highScores.sort((a, b) => b.kills - a.kills);
    highScores.splice(5);
    localStorage.setItem("highScores", JSON.stringify(highScores));
    highScoreList.innerHTML = "";
    highScores.forEach(entry => {
      highScoreList.innerHTML += `<li> Level/Kills: ${entry.level}/${entry.kills} Name: ${entry.playername}</li>`;
    });
    gameOverText.innerText = `Congrats ${playerName}:
                  You have reached level ${currentLevel}!
                  The tales of this hunt will be long told after your death...`;
    gameOverAudio.play();
    gameOverCard.classList.add("display-block");
    runningGame = false;
    fieldActive = false;
  }
function showGameOverCard ( ) { const score = { playername : playerName , level : currentLevel , kills : molesKilled } ; highScores . push ( score ) ; highScores . sort ( ( a , b ) => b . kills - a . kills ) ; highScores . splice ( 5 ) ; localStorage . setItem ( "highScores" , JSON . stringify ( highScores ) ) ; highScoreList . innerHTML = "" ; highScores . forEach ( entry => { highScoreList . innerHTML += ` ${ entry . level } ${ entry . kills } ${ entry . playername } ` ; } ) ; gameOverText . innerText = ` ${ playerName } ${ currentLevel } ` ; gameOverAudio . play ( ) ; gameOverCard . classList . add ( "display-block" ) ; runningGame = false ; fieldActive = false ; }
Create score element.
Create score element .