game: gameover highscore sound

This commit is contained in:
He4eT 2025-06-18 20:02:46 +02:00
commit 00bbe003ba

18
game.js
View file

@ -85,7 +85,7 @@ function drawMorse(codeList, x, y, color, width) {
function playMorseKey(seed) { function playMorseKey(seed) {
const note = rnd(57, 72, seed) const note = rnd(57, 72, seed)
const volume = rnd(8, 10, seed) const volume = rnd(8, 10, seed)
sfx(4, note, 4, 0, volume, 0) sfx(0, note, 4, 0, volume, 0)
} }
/* Arena */ /* Arena */
@ -632,20 +632,22 @@ function gameoverScreen() {
} }
function gameover() { function gameover() {
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) sfx(0, 'F-2', 30, 1, 5)
}
effects = [ effects = [
{ {
type: 'flash', type: 'flash',
frames: '77777777777765432'.split(''), frames: '77777777777765432'.split(''),
}, },
] ]
if (player.score > arena.highscore) {
pmem(0, player.score)
}
arena.gameoverTimestamp = time()
currentScreen = 'gameoverScreen'
} }
/* Utils */ /* Utils */