From 53ac3840baf207b5c983535a3fbf69a11f4b7a52 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 26 Sep 2025 12:09:25 +0200 Subject: [PATCH] feat(gameover): only allow the user to switch state after the gameover sound has been played. --- game/state/handlers/gameover.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/game/state/handlers/gameover.go b/game/state/handlers/gameover.go index 9b35471..9c557ee 100644 --- a/game/state/handlers/gameover.go +++ b/game/state/handlers/gameover.go @@ -19,10 +19,12 @@ func (GameOver) Exit() { } func (GameOver GameOver) Update(fsm state.Transitioner, delta float32) { - if rl.IsKeyPressed(rl.KeyEnter) { - fsm.Switch("gameplay") - } else if rl.IsKeyPressed(rl.KeyQ) { - fsm.Switch("menu") + if !audio.IsPlaying(assets.SFX_GAME_OVER) { + if rl.IsKeyPressed(rl.KeyEnter) { + fsm.Switch("gameplay") + } else if rl.IsKeyPressed(rl.KeyQ) { + fsm.Switch("menu") + } } }