From 00bbe003bada272e330485bb8972b210a6bda8f5 Mon Sep 17 00:00:00 2001 From: He4eT Date: Wed, 18 Jun 2025 20:02:46 +0200 Subject: [PATCH] game: gameover highscore sound --- game.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/game.js b/game.js index a10791a..cf03570 100644 --- a/game.js +++ b/game.js @@ -85,7 +85,7 @@ function drawMorse(codeList, x, y, color, width) { function playMorseKey(seed) { const note = rnd(57, 72, seed) const volume = rnd(8, 10, seed) - sfx(4, note, 4, 0, volume, 0) + sfx(0, note, 4, 0, volume, 0) } /* Arena */ @@ -632,20 +632,22 @@ function gameoverScreen() { } function gameover() { - sfx(0, 'F-2', 30, 1, 5) + currentScreen = 'gameoverScreen' + arena.gameoverTimestamp = time() + + if (player.score > arena.highscore) { + pmem(0, player.score) + sfx(0, 'C-5', 30, 1, 6) + } else { + sfx(0, 'F-2', 30, 1, 5) + } + effects = [ { type: 'flash', frames: '77777777777765432'.split(''), }, ] - - if (player.score > arena.highscore) { - pmem(0, player.score) - } - - arena.gameoverTimestamp = time() - currentScreen = 'gameoverScreen' } /* Utils */