feat(game): add mute

This commit is contained in:
Kristofers Solo 2024-01-04 18:51:06 +02:00
parent 9aae271bf4
commit 33554bf0e0
2 changed files with 9 additions and 0 deletions

View File

@ -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):

View File

@ -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.