feat: add the rest of the sounds with channels

This commit is contained in:
Giovani Rodriguez
2021-06-10 15:53:14 -04:00
parent 479553424f
commit 5cf73ceb7d
8 changed files with 28 additions and 5 deletions

View File

@@ -1,3 +1,5 @@
from pygame import mixer
from util.ConfigurationManager import ConfigurationManager
from entity.Piece import Piece
from entity.Well import Well
@@ -8,6 +10,7 @@ class Stack(Entity):
def __init__(self, color: str, border_color: str):
super().__init__([], color, border_color)
self.rows_completed_count = 0
self.row_completion_sound = mixer.Channel(1)
def update(self, elapsed_time) -> None:
super().update(elapsed_time)
@@ -48,4 +51,9 @@ class Stack(Entity):
new_points.append(square)
self.points = new_points
return len(rows_completed)
self.__play_row_completion_sound()
return len(rows_completed)
def __play_row_completion_sound(self) -> None:
row_completion_sound_file = ConfigurationManager.configuration["sound"]["row-completion"]
self.row_completion_sound.play(mixer.Sound(row_completion_sound_file))