59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
from data.cat import Cat
|
|
from systems.ui import clear, title
|
|
from systems.world import shelter, house
|
|
import systems.ui as ui
|
|
import data.save
|
|
|
|
|
|
class Game:
|
|
def __init__(self):
|
|
self.cat = None
|
|
|
|
def new_game(self):
|
|
self.cat = shelter()
|
|
print("Saving...")
|
|
data.save.save(self.cat)
|
|
print("Save complete.")
|
|
self.game_loop()
|
|
|
|
def game_loop(self):
|
|
while True:
|
|
match ui.select("Please choose an option", ["Go to your house", "Options"]):
|
|
case "Go to your house":
|
|
house(self.cat)
|
|
case "Options":
|
|
while True:
|
|
match ui.select(
|
|
"Please choose an option",
|
|
["Save", "Save and quit", "Quit", "Back"],
|
|
):
|
|
case "Save":
|
|
data.save.save(self.cat)
|
|
case "Save and quit":
|
|
print("Goodbye!")
|
|
data.save.save(self.cat)
|
|
return
|
|
case "Quit":
|
|
if ui.confirm(
|
|
"Are you sure you want to quit without saving?"
|
|
):
|
|
print("Goodbye!")
|
|
return
|
|
case "Back":
|
|
break
|
|
|
|
def run(self):
|
|
title()
|
|
print("Welcome to Whiskerbound!")
|
|
choice = ui.select("", choices=["New Game", "Quit"])
|
|
|
|
if choice == "New Game":
|
|
self.new_game()
|
|
elif choice == "Quit":
|
|
quit()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
game = Game()
|
|
game.run()
|