mirror of
https://github.com/kristoferssolo/Tetris.git
synced 2025-10-21 20:00:35 +00:00
feat(game): add langing sound
This commit is contained in:
parent
91587b772f
commit
7f9b1fb266
BIN
assets/music/landing.wav
Normal file
BIN
assets/music/landing.wav
Normal file
Binary file not shown.
@ -49,6 +49,9 @@ class Game:
|
|||||||
self.score = 0
|
self.score = 0
|
||||||
self.lines = 0
|
self.lines = 0
|
||||||
|
|
||||||
|
self.landing_sound = pygame.mixer.Sound(CONFIG.music.landing)
|
||||||
|
self.landing_sound.set_volume(CONFIG.music.volume)
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
self.dispaly_surface.blit(self.surface, CONFIG.game.pos)
|
self.dispaly_surface.blit(self.surface, CONFIG.game.pos)
|
||||||
self.draw()
|
self.draw()
|
||||||
@ -110,6 +113,7 @@ class Game:
|
|||||||
self.tetromino.move_horizontal(Direction.RIGHT)
|
self.tetromino.move_horizontal(Direction.RIGHT)
|
||||||
|
|
||||||
def create_new_tetromino(self) -> None:
|
def create_new_tetromino(self) -> None:
|
||||||
|
self.landing_sound.play()
|
||||||
if self.game_over():
|
if self.game_over():
|
||||||
self.restart()
|
self.restart()
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class Main:
|
|||||||
|
|
||||||
self.music = pygame.mixer.Sound(CONFIG.music.background)
|
self.music = pygame.mixer.Sound(CONFIG.music.background)
|
||||||
self.music.set_volume(CONFIG.music.volume)
|
self.music.set_volume(CONFIG.music.volume)
|
||||||
self.music.play()
|
self.music.play(-1)
|
||||||
|
|
||||||
def draw(self) -> None:
|
def draw(self) -> None:
|
||||||
pygame.display.update()
|
pygame.display.update()
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class Window:
|
|||||||
@define
|
@define
|
||||||
class Music:
|
class Music:
|
||||||
background: Path = BASE_PATH / "assets" / "music" / "background.wav"
|
background: Path = BASE_PATH / "assets" / "music" / "background.wav"
|
||||||
langing: Path = BASE_PATH / "assets" / "music" / "landing.wav"
|
landing: Path = BASE_PATH / "assets" / "music" / "landing.wav"
|
||||||
volume: float = 0.01
|
volume: float = 0.01
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user