From 7f4c180b23503bbb463d725e7ab6a9b77faa15bc Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Mon, 10 May 2021 16:14:23 -0400 Subject: [PATCH] First commit --- main.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..c6bc856 --- /dev/null +++ b/main.py @@ -0,0 +1,76 @@ +import os + +PLAYER_NAME = "jack" +PLAYER_INIT_LOCATION = "1" +class Player: + + def __init__(self, name, location): + self.name = name + self.location = location + + def getName(self): + return self.name + + def getLocation(self): + return self.location + +class GameManager: + 'Manage the game' + + def __init__(self): + self.gameIsRunning = True + self.player = Player(PLAYER_NAME, PLAYER_INIT_LOCATION) + + def isGameRunning(self): + return self.gameIsRunning + + def stopGame(self): + self.gameIsRunning = False + + def printPlayerStats(self): + print("Name: ", self.player.getName()) + print("Location: ", self.player.getLocation()) + print() + + def clearScreen(self): + os.system('clear') + + +def mainMenu(): + while(True): + os.system('clear') + userInput = input("(n)ew game (q)uit:\n>> ").lower() + + if userInput == "q": + break + + if userInput == "n": + mainGame() + + +def mainGame(): + Game = GameManager() + userInput = "" + + + Game.clearScreen() + + while Game.isGameRunning(): + userInput = input("(q)uit (p)layer stats (c)lear screen:\n>> ").lower() + + if userInput == "q": + Game.stopGame() + + if userInput == "p": + Game.printPlayerStats() + + if userInput == "c": + Game.clearScreen() + +def main(): + mainMenu() + +main() +# Main menu should be start game or quit +# game running should be false until start +# ending the game shoudl return to the main menu