win et lose sons

This commit is contained in:
CoCo_Sol 2023-10-29 22:21:54 +01:00
parent 1566c780e2
commit 464d717fac
3 changed files with 7 additions and 0 deletions

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} !")