feat: add main music to game
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
import pygame
|
||||
from pygame import mixer
|
||||
|
||||
from util.ConfigurationManager import ConfigurationManager
|
||||
from util.PieceGenerator import PieceGenerator
|
||||
@@ -20,6 +21,7 @@ class Tetris:
|
||||
|
||||
def initialize(self) -> None:
|
||||
pygame.init()
|
||||
mixer.init()
|
||||
|
||||
win_width = ConfigurationManager.configuration["window"]["width"]
|
||||
win_height = ConfigurationManager.configuration["window"]["height"]
|
||||
@@ -30,12 +32,15 @@ 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.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)
|
||||
|
||||
# gets called from the games main loop
|
||||
def update(self) -> None:
|
||||
|
||||
BIN
main_music.mp3
Executable file
BIN
main_music.mp3
Executable file
Binary file not shown.
Reference in New Issue
Block a user