Load save
This commit is contained in:
12
game.py
12
game.py
@@ -3,6 +3,7 @@ from systems.ui import clear, title
|
|||||||
from systems.world import shelter, house
|
from systems.world import shelter, house
|
||||||
import systems.ui as ui
|
import systems.ui as ui
|
||||||
import data.save
|
import data.save
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Game:
|
class Game:
|
||||||
@@ -44,11 +45,20 @@ class Game:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
title()
|
title()
|
||||||
|
options = ["New Game", "Quit"]
|
||||||
|
if os.path.exists("saves"):
|
||||||
|
options.insert(0, "Load Game")
|
||||||
print("Welcome to Whiskerbound!")
|
print("Welcome to Whiskerbound!")
|
||||||
choice = ui.select("", choices=["New Game", "Quit"])
|
choice = ui.select("Please choose an option", choices=options)
|
||||||
|
|
||||||
if choice == "New Game":
|
if choice == "New Game":
|
||||||
self.new_game()
|
self.new_game()
|
||||||
|
elif choice == "Load Game":
|
||||||
|
save = "saves/" + ui.select(
|
||||||
|
"Please choose a savefile to load", os.listdir("saves")
|
||||||
|
)
|
||||||
|
self.cat = data.save.load(save)
|
||||||
|
self.game_loop()
|
||||||
elif choice == "Quit":
|
elif choice == "Quit":
|
||||||
quit()
|
quit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user