This commit is contained in:
CoCo_Sol 2023-10-30 00:30:36 +01:00
parent 464d717fac
commit 9ac2958a49
3 changed files with 14 additions and 1 deletions

Binary file not shown.

BIN
assets/sounds/undo.wav Normal file

Binary file not shown.

View file

@ -2,6 +2,7 @@
Définis la scène du jeu classique, sans variante.
"""
from math import e
import random
from plugins import typing
from engine import (
@ -9,6 +10,7 @@ from engine import (
Clickable,
Color,
Display,
Entity,
Game,
HoveredTexture,
Keyboard,
@ -21,6 +23,7 @@ from engine import (
Texture,
World,
)
from scenes.menu import on_click_butons
class RandomNumber(int):
@ -112,7 +115,7 @@ def __initialize_world(world: World):
Order(11),
Position(100, 100),
Texture("classique/arrow.png"),
Clickable(lambda world, _: world[Game].change_scene("menu")),
Clickable(lambda world, entity: on_menu_button(world, entity)),
HoveredTexture("classique/arrow_hover.png"),
)
@ -122,12 +125,22 @@ def __initialize_world(world: World):
world[IsRunning] = IsRunning()
def on_menu_button(world: World, entity: Entity):
"""
Fonction qui s'execute quand on clique sur un bouton.
"""
world[Game].change_scene("menu")
entity[Sound] = Sound("undo.wav")
def _update(world: World):
"""
Verifie si le nombre donné est le meme que celui que l'on a choisi.
Boucle du jeu.
"""
world.create_entity(Sound("menu_click.wav"))
# si le jeu s'est arrete.
if IsRunning not in world:
# on relance le jeu.