diff --git a/game.html b/game.html index 5a37d79..efac198 100644 --- a/game.html +++ b/game.html @@ -141,11 +141,12 @@ const textures = {}; const piecemoveSound = new Audio("/static/piecemove.mp3"); - //const endgameSound = new Audio("/static/endgame.mp3"); + const endgameSound = new Audio("/static/endgame.mp3"); let color = 0; let turn = 0; let state = -1; + let oldState = -1; let start_time = undefined; let ready = false; let letterMap = ' '; @@ -187,7 +188,11 @@ .catch(error => { console.error("Playback failed:", error); }); + if (oldState !== state && state >= 1) { + endgameSound.play(); + } oldBoard = structuredClone(board); + oldState = state; } }