mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
feat(game): add background music
This commit is contained in:
parent
a294ba4e90
commit
91587b772f
BIN
assets/music/background.wav
Normal file
BIN
assets/music/background.wav
Normal file
Binary file not shown.
@ -24,6 +24,10 @@ class Main:
|
|||||||
self.score = Score()
|
self.score = Score()
|
||||||
self.preview = Preview()
|
self.preview = Preview()
|
||||||
|
|
||||||
|
self.music = pygame.mixer.Sound(CONFIG.music.background)
|
||||||
|
self.music.set_volume(CONFIG.music.volume)
|
||||||
|
self.music.play()
|
||||||
|
|
||||||
def draw(self) -> None:
|
def draw(self) -> None:
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|
||||||
|
|||||||
@ -51,6 +51,13 @@ class Window:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@define
|
||||||
|
class Music:
|
||||||
|
background: Path = BASE_PATH / "assets" / "music" / "background.wav"
|
||||||
|
langing: Path = BASE_PATH / "assets" / "music" / "landing.wav"
|
||||||
|
volume: float = 0.01
|
||||||
|
|
||||||
|
|
||||||
@define
|
@define
|
||||||
class Config:
|
class Config:
|
||||||
log_level: str = "warning"
|
log_level: str = "warning"
|
||||||
@ -59,6 +66,7 @@ class Config:
|
|||||||
sidebar: SideBar = SideBar()
|
sidebar: SideBar = SideBar()
|
||||||
window: Window = Window()
|
window: Window = Window()
|
||||||
font: Font = Font()
|
font: Font = Font()
|
||||||
|
music: Music = Music()
|
||||||
colors = TokyoNightNight()
|
colors = TokyoNightNight()
|
||||||
fps: int = 60
|
fps: int = 60
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user