Les sons du jeu classique #43

Merged
tipragot merged 7 commits from sound-classique into main 2023-10-30 00:21:25 +00:00
3 changed files with 7 additions and 0 deletions
Showing only changes of commit 464d717fac - Show all commits

Binary file not shown.

BIN
assets/sounds/win_sound.wav Normal file

Binary file not shown.

View file

@ -15,6 +15,7 @@ from engine import (
Order, Order,
Position, Position,
Scene, Scene,
Sound,
Text, Text,
TextSize, TextSize,
Texture, Texture,
@ -167,6 +168,12 @@ def end_game(world: World, state: str):
""" """
del world[IsRunning] # le jeu est fini. del world[IsRunning] # le jeu est fini.
# On joue le son
if state == "Gagné":
world.create_entity(Sound("win_sound.wav"))
else:
world.create_entity(Sound("lose_sound.wav"))
# On affiche le message de fin. # On affiche le message de fin.
for entity_text in world.query(TextDialogue): for entity_text in world.query(TextDialogue):
entity_text[Text] = Text(f"{state} !") entity_text[Text] = Text(f"{state} !")