This commit is contained in:
Renan LE CARO 2025-05-03 20:22:25 +02:00
parent 9e12f62b81
commit 892f800107
14 changed files with 2866 additions and 2840 deletions

View file

@ -254,34 +254,34 @@ let timers = [];
function startPlayCountDown() {
stopPlayCountDown();
gameState.startCountDown = 3;
gameState.needsRender = true;
gameState.startCountDown = 3
gameState.needsRender = true
timers.push(setTimeout(() => {
gameState.startCountDown = 2
gameState.needsRender = true
}, 1000));
timers.push(setTimeout(() => {
gameState.startCountDown = 1
gameState.needsRender = true
}, 2000));
timers.push(
setTimeout(() => {
gameState.startCountDown = 0
gameState.startCountDown = 2;
gameState.needsRender = true;
}, 1000),
);
timers.push(
setTimeout(() => {
gameState.startCountDown = 1;
gameState.needsRender = true;
}, 2000),
);
timers.push(
setTimeout(() => {
gameState.startCountDown = 0;
play();
}, 3000),
);
}
function stopPlayCountDown() {
if(!timers.length) return
if (!timers.length) return;
gameState.startCountDown = 0
gameState.startCountDown = 0;
timers.forEach((id) => clearTimeout(id));
timers.length = 0;
}
gameCanvas.addEventListener("touchstart", (e) => {
e.preventDefault();