feat: add the rest of the sounds with channels
This commit is contained in:
11
Tetris.py
11
Tetris.py
@@ -7,7 +7,7 @@ from util.PieceGenerator import PieceGenerator
|
||||
from entity.Well import Well
|
||||
from entity.Stack import Stack
|
||||
|
||||
# TODO should be a singleton?
|
||||
# TODO should be a singleton and refactor the whole file?
|
||||
class Tetris:
|
||||
|
||||
def __init__(self):
|
||||
@@ -15,6 +15,7 @@ class Tetris:
|
||||
self.tile_size = -1
|
||||
self.screen = None
|
||||
self.clock = None
|
||||
self.main_music = None
|
||||
self.current_piece = None
|
||||
self.well = None
|
||||
self.stack = None
|
||||
@@ -32,15 +33,17 @@ class Tetris:
|
||||
self.tile_size = ConfigurationManager.configuration["engine"]["tile-size"]
|
||||
self.screen = pygame.display.set_mode((win_width, win_height))
|
||||
self.clock = pygame.time.Clock()
|
||||
mixer.music.load("main_music.mp3")
|
||||
mixer.music.set_volume(0.7)
|
||||
self.main_music = mixer.Channel(0)
|
||||
self.well = Well((280, 80), ConfigurationManager.configuration["color"]["border"]) # TODO calculate position later and redo color config for well
|
||||
self.stack = Stack(ConfigurationManager.configuration["color"]["base-4"], ConfigurationManager.configuration["color"]["border"])
|
||||
|
||||
loaded_icon = pygame.image.load(win_icon)
|
||||
pygame.display.set_caption(win_title)
|
||||
pygame.display.set_icon(loaded_icon)
|
||||
mixer.music.play(-1)
|
||||
|
||||
main_music_file = ConfigurationManager.configuration["sound"]["main-music"]
|
||||
self.main_music.set_volume(0.7)
|
||||
self.main_music.play(mixer.Sound(main_music_file), -1)
|
||||
|
||||
# gets called from the games main loop
|
||||
def update(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user