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