diff --git a/data/cat.py b/data/cat.py index f7e1dec..443e1e9 100644 --- a/data/cat.py +++ b/data/cat.py @@ -2,6 +2,7 @@ class Cat: def __init__(self, name, traits): self.name = name self.traits = traits + self.food = 3 def to_dict(self): return vars(self) diff --git a/game.py b/game.py index d087c71..a820ed8 100644 --- a/game.py +++ b/game.py @@ -75,10 +75,11 @@ class Game: if os.path.exists("ENABLE DEBUG"): with open("ENABLE DEBUG", "r") as f: file = f.read().strip() - self.cat = data.save.load(file) - self.game_loop() - print(f"{self.cat.name} says bye") - return + if file: + self.cat = data.save.load(file) + self.game_loop() + print(f"{self.cat.name} says bye") + return title() options = ["New Game", "Quit"] if os.path.exists("saves"): diff --git a/systems/world.py b/systems/world.py index 2dfbd3c..eb9e812 100644 --- a/systems/world.py +++ b/systems/world.py @@ -107,18 +107,28 @@ def pet(cat: Cat): print(f"You pet {cat.name} a lot. {cat.name} is very happy.") +def feed(cat): + if cat.food <= 0: + print(f"You don't have any food. {cat.name} is sad.") + cat.food -= 1 + print(f"You feed {cat.name}, {cat.name} is happy") + + def house(cat: Cat): print("Welcome to your house!") while True: match ui.select( "Please choose an option", - ["Check on your cat", "Pet your cat", "Leave your house"], + ["Check on your cat", "Pet your cat", "Feed your cat", "Leave your house"], ): case "Check on your cat": print( f"{cat.name} - a {cat.traits["size"]} {cat.traits["color"]} with {cat.traits["eyes"]} eyes" ) + print(f"Food: {cat.food}") case "Pet your cat": pet(cat) + case "Feed your cat": + feed(cat) case "Leave your house": break