Suppression du délai inutile lors de l'envoi du score #20
|
@ -7,7 +7,6 @@ from plugins.click import Clickable
|
||||||
from plugins.hover import HoveredTexture
|
from plugins.hover import HoveredTexture
|
||||||
from plugins.inputs import Held, Pressed
|
from plugins.inputs import Held, Pressed
|
||||||
from plugins.render import SpriteBundle, Text, TextBundle
|
from plugins.render import SpriteBundle, Text, TextBundle
|
||||||
from plugins.timing import TimedEvent
|
|
||||||
from plugins.writing import Writing
|
from plugins.writing import Writing
|
||||||
import requests as rq
|
import requests as rq
|
||||||
from scenes import game, thanks
|
from scenes import game, thanks
|
||||||
|
@ -22,12 +21,7 @@ def new_score(world: World, e: Entity):
|
||||||
try:
|
try:
|
||||||
post = {"name": name[Text], "score": world[game.Player1Score]}
|
post = {"name": name[Text], "score": world[game.Player1Score]}
|
||||||
rq.post(f"https://{IP}/new_score", post)
|
rq.post(f"https://{IP}/new_score", post)
|
||||||
world.new_entity().set(
|
world.set(CurrentScene(thanks.THANKS))
|
||||||
TimedEvent(
|
|
||||||
1,
|
|
||||||
lambda world, entity: world.set(CurrentScene(thanks.THANKS)),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print("Error with the serveur:", error)
|
print("Error with the serveur:", error)
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ def __spawn_elements(world: World):
|
||||||
position=Vec2(render.WIDTH / 2, render.HEIGHT / 2 - 75),
|
position=Vec2(render.WIDTH / 2, render.HEIGHT / 2 - 75),
|
||||||
origin=Vec2(0.5),
|
origin=Vec2(0.5),
|
||||||
),
|
),
|
||||||
TimedEvent(3, lambda world, entity: world.set(CurrentScene(menu.MENU))),
|
TimedEvent(1.5, lambda world, entity: world.set(CurrentScene(menu.MENU))),
|
||||||
)
|
)
|
||||||
world.new_entity().set(
|
world.new_entity().set(
|
||||||
TextBundle(
|
TextBundle(
|
||||||
|
|
Loading…
Reference in a new issue