Ajout du mode tricheur #49
|
@ -23,7 +23,7 @@ from engine import (
|
|||
World,
|
||||
)
|
||||
|
||||
COLOR_TEXT = Color(66, 39, 148)
|
||||
COLOR_TEXT = Color(135, 53, 27)
|
||||
|
||||
|
||||
class RandomNumber(int):
|
||||
|
@ -65,7 +65,7 @@ def __initialize_world(world: World):
|
|||
world.create_entity(
|
||||
Position(),
|
||||
Order(0),
|
||||
Texture("classique/background.png"),
|
||||
Texture("tricheur/background.png"),
|
||||
)
|
||||
|
||||
# Bouton valider/rejouer
|
||||
|
@ -73,8 +73,8 @@ def __initialize_world(world: World):
|
|||
Position(Display.WIDTH / 2, 875),
|
||||
Order(1),
|
||||
Centered(),
|
||||
Texture("classique/valider.png"),
|
||||
HoveredTexture("classique/valider_hover.png"),
|
||||
Texture("tricheur/valider.png"),
|
||||
HoveredTexture("tricheur/valider_hover.png"),
|
||||
Clickable(lambda world, _: _update(world)),
|
||||
)
|
||||
|
||||
|
@ -83,7 +83,7 @@ def __initialize_world(world: World):
|
|||
Position(Display.WIDTH / 2, 750),
|
||||
Order(2),
|
||||
Centered(),
|
||||
typing.Typing("1234567890"),
|
||||
typing.Typing("1234567890", 2),
|
||||
Text(""),
|
||||
COLOR_TEXT,
|
||||
TextSize(150),
|
||||
|
@ -114,9 +114,9 @@ def __initialize_world(world: World):
|
|||
world.create_entity(
|
||||
Order(11),
|
||||
Position(150, 150),
|
||||
Texture("classique/arrow.png"),
|
||||
Texture("tricheur/arrow.png"),
|
||||
Clickable(on_menu_button),
|
||||
HoveredTexture("classique/arrow_hover.png"),
|
||||
HoveredTexture("tricheur/arrow_hover.png"),
|
||||
)
|
||||
|
||||
# Les ressources.
|
||||
|
@ -174,9 +174,10 @@ def _update(world: World):
|
|||
f"il reste : {world[NombreEssai]} essai{'s' if world[NombreEssai] != 1 else ''}"
|
||||
)
|
||||
|
||||
#ajout de la mechanique de triche
|
||||
world[RandomNumber] = max(0, min(99, RandomNumber(world[RandomNumber] + random.randint(-3, 3))))
|
||||
print(world[RandomNumber])
|
||||
# ajout de la mechanique de triche
|
||||
world[RandomNumber] = max(
|
||||
0, min(99, RandomNumber(world[RandomNumber] + random.randint(-3, 3)))
|
||||
)
|
||||
|
||||
|
||||
def end_game(world: World, state: str):
|
||||
|
@ -208,8 +209,8 @@ def end_game(world: World, state: str):
|
|||
|
||||
# on change la texture du button submit.
|
||||
for entity in world.query(Clickable, Centered):
|
||||
entity[Texture] = Texture("classique/play_again.png")
|
||||
entity[HoveredTexture] = HoveredTexture("classique/play_again_hover.png")
|
||||
entity[Texture] = Texture("tricheur/play_again.png")
|
||||
entity[HoveredTexture] = HoveredTexture("tricheur/play_again_hover.png")
|
||||
|
||||
|
||||
def _check_return(world: World):
|
||||
|
|
Loading…
Reference in a new issue