Win sound
This commit is contained in:
@@ -141,11 +141,12 @@
|
|||||||
const textures = {};
|
const textures = {};
|
||||||
|
|
||||||
const piecemoveSound = new Audio("/static/piecemove.mp3");
|
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 color = 0;
|
||||||
let turn = 0;
|
let turn = 0;
|
||||||
let state = -1;
|
let state = -1;
|
||||||
|
let oldState = -1;
|
||||||
let start_time = undefined;
|
let start_time = undefined;
|
||||||
let ready = false;
|
let ready = false;
|
||||||
let letterMap = ' ';
|
let letterMap = ' ';
|
||||||
@@ -187,7 +188,11 @@
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Playback failed:", error);
|
console.error("Playback failed:", error);
|
||||||
});
|
});
|
||||||
|
if (oldState !== state && state >= 1) {
|
||||||
|
endgameSound.play();
|
||||||
|
}
|
||||||
oldBoard = structuredClone(board);
|
oldBoard = structuredClone(board);
|
||||||
|
oldState = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user