mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-05-04 18:59:13 -04:00
wip
This commit is contained in:
parent
9e12f62b81
commit
892f800107
14 changed files with 2866 additions and 2840 deletions
34
src/game.ts
34
src/game.ts
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue