77 lines
1.6 KiB
Python
Raw Normal View History

2021-05-10 16:14:23 -04:00
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