fix de la demande de pseudo #54

Merged
raphael merged 1 commit from fix-de-la-dedmande-de-pseudo into main 2024-01-16 09:36:28 +00:00
2 changed files with 6 additions and 5 deletions

View file

@ -1,4 +1,5 @@
import os
from pathlib import Path
from engine import CurrentScene, KeepAlive, Plugin
from engine.ecs import Entity, World
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(
TextBundle(
"Quel est votre pseudo ?",
@ -94,12 +95,12 @@ def __create_button(world: World, name: str):
def new_score(world: World, e: Entity):
e.remove(Clickable)
if os.path.exists("../username.txt"):
with open("../username.txt", "r") as f:
if os.path.exists(Path.home() / ".ponguito/username.txt"):
with open(Path.home() / ".ponguito/username.txt", "r") as f:
name = f.read()
else:
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])
try:

View file

@ -1 +1 @@
1.0.0
1.0.1