fix de la demande de pseudo

This commit is contained in:
raphael 2024-01-16 10:32:40 +01:00
parent 632ba7e1dd
commit 2c14af597c
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import os import os
from pathlib import Path
from engine import CurrentScene, KeepAlive, Plugin from engine import CurrentScene, KeepAlive, Plugin
from engine.ecs import Entity, World from engine.ecs import Entity, World
from engine.math import Vec2 from engine.math import Vec2
@ -36,7 +37,7 @@ def __spawn_elements(world: World):
) )
) )
if not os.path.exists("username.txt"): if not os.path.exists(Path.home() / ".ponguito/username.txt"):
world.new_entity().set( world.new_entity().set(
TextBundle( TextBundle(
"Quel est votre pseudo ?", "Quel est votre pseudo ?",
@ -94,12 +95,12 @@ def __create_button(world: World, name: str):
def new_score(world: World, e: Entity): def new_score(world: World, e: Entity):
e.remove(Clickable) e.remove(Clickable)
if os.path.exists("../username.txt"): if os.path.exists(Path.home() / ".ponguito/username.txt"):
with open("../username.txt", "r") as f: with open(Path.home() / ".ponguito/username.txt", "r") as f:
name = f.read() name = f.read()
else: else:
name = world.query(Writing).pop() name = world.query(Writing).pop()
with open("../username.txt", "w") as f: with open(Path.home() / ".ponguito/username.txt", "w") as f:
f.write(name[Text]) f.write(name[Text])
try: try:

View file

@ -1 +1 @@
1.0.0 1.0.1