From ded7da8e73515c3ac65842bef5d8ae7d22a1b33a Mon Sep 17 00:00:00 2001 From: 0880 <98263509+0880880@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:29:25 +0330 Subject: [PATCH] Win sound --- game.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; } }