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,4 +1,5 @@
from typing import List, Tuple
from pygame import mixer
import copy
from entity.Entity import Entity
@@ -15,6 +16,7 @@ class Piece(Entity):
def __init__(self, shape: Tuple, position: Tuple, color: str, border_color: str):
super().__init__(self.__get_points(shape, position), color, border_color)
self.center = self.__get_center(shape, position)
self.piece_set_sound = mixer.Channel(2)
self.previous_points = None
self.previous_center = None
@@ -72,6 +74,11 @@ class Piece(Entity):
self.points = self.previous_points
self.center = self.previous_center
# TODO should be private
def play_piece_set_sound(self) -> None:
piece_set_sound_file = ConfigurationManager.configuration["sound"]["rpiece-set"]
self.piece_set_sound.play(mixer.Sound(piece_set_sound_file))
def __get_points(self, shape: Tuple, position: Tuple) -> List:
tile_size = ConfigurationManager.configuration["engine"]["tile-size"]