Classique #35
After Width: | Height: | Size: 57 KiB |
BIN
assets/textures/classique/win.png
Normal file
BIN
assets/textures/classique/win.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
|
@ -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")),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue