From 33554bf0e054bcca8ae4616055039ad64bd03e39 Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Thu, 4 Jan 2024 18:51:06 +0200 Subject: [PATCH] feat(game): add mute --- src/game/game.py | 4 ++++ src/game/main.py | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/game/game.py b/src/game/game.py index 1689369..1dd2309 100644 --- a/src/game/game.py +++ b/src/game/game.py @@ -142,6 +142,10 @@ class Game: self._reset_game_state() self._initialize_field_and_tetromino() + def mute(self) -> None: + """Mute the game.""" + self.landing_sound.set_volume(0) + def _draw_grid(self) -> None: """Draw the grid on the game surface.""" for col in range(1, CONFIG.game.columns): diff --git a/src/game/main.py b/src/game/main.py index 59e397d..22f44f9 100644 --- a/src/game/main.py +++ b/src/game/main.py @@ -54,6 +54,11 @@ class Main: pygame.quit() sys.exit() + def mute(self) -> None: + """Mute the game.""" + self.music.set_volume(0) + self.game.mute() + def _update_score(self, lines: int, score: int, level: int) -> None: """ Update the game score.