This commit is contained in:
CoCo_Sol 2023-10-29 16:47:38 +01:00
parent ea32d90226
commit 8b98f31d39
3 changed files with 8 additions and 6 deletions

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View file

@ -97,15 +97,16 @@ def check_number(world: World):
for entity in world.query(typing.Typing, Text):
for entity_text in world.query(TextDialogue):
if world[NombreEssai] == NombreEssai(0):
if world[NombreEssai] == 1:
entity_text[Text] = Text("Lose!")
create_end_buton(world, "lose")
return
number: str = entity[Text]
if number == "":
entity_text[Text] = Text("tu doit entrer un nombre !")
break
if world[RandomNumber] == int(number):
entity_text[Text] = Text("Win!")
create_end_buton(world, "win")
elif world[RandomNumber] > int(number):
entity_text[Text] = Text("Trop petit")
else:
@ -127,11 +128,12 @@ def create_end_buton(world: World, state: str):
Create the end buton
"""
# sup toutes les entitées
for entity in world.query():
del entity
world.create_entity(
Order(1),
Centered(),
Text(f"You {state} !"),
TextSize(150),
Order(3),
Texture(f"classique/{state}.png"),
Clickable(lambda world, _: world[Game].change_scene("menu")),
)