If there's no player in a level, add one

This commit is contained in:
blinry 2020-11-18 19:51:27 +01:00
parent b91ebe0f36
commit b5143ec906
2 changed files with 4 additions and 1 deletions

View file

@ -134,7 +134,7 @@ func update():
#item.position = Vector2(rand_range(0, world.rect_size.x), rand_range(0, world.rect_size.y))
#randomize()
world.add_child(item)
if not player:
if file_path == "you":
player = item
FileBrowserMode.COMMIT:

View file

@ -101,6 +101,9 @@ func construct():
var repo = repos[r]
game.global_shell.cd(repo.path)
game.global_shell.run(repo.setup_commands)
# If there is no player, add one.
if game.global_shell.run("test -f you && echo yes || echo no") == "no\n":
game.global_shell.run("echo \"x = 200\ny = 200\" > you")
func check_win():
var won = true