81 lines
1.6 KiB
Python
Raw Normal View History

2021-05-10 16:14:23 -04:00
import os
PLAYER_INIT_LOCATION = "1"
class Player:
def __init__(self, name, location):
self.name = name
self.location = location
def getName(self):
return self.name
def setName(self, name):
self.name = name
2021-05-10 16:14:23 -04:00
def getLocation(self):
return self.location
class GameManager:
'Manage the game'
def __init__(self, userInput):
2021-05-10 16:14:23 -04:00
self.gameIsRunning = True
self.player = Player(userInput, PLAYER_INIT_LOCATION)
2021-05-10 16:14:23 -04:00
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():
os.system('clear')
2021-05-10 16:14:23 -04:00
def titleScreen():
2021-05-10 16:14:23 -04:00
while(True):
clearScreen()
print("Space Game Title To Be Disclosed!!!")
2021-05-10 16:14:23 -04:00
userInput = input("(n)ew game (q)uit:\n>> ").lower()
if userInput == "q":
break
if userInput == "n":
mainGame()
def mainGame():
userInput = ""
userInput = input("What is your name... peasant?")
if userInput == "":
userInput = "(none)"
Game = GameManager(userInput)
2021-05-10 16:14:23 -04:00
clearScreen()
2021-05-10 16:14:23 -04:00
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":
clearScreen()
2021-05-10 16:14:23 -04:00
def main():
titleScreen()
2021-05-10 16:14:23 -04:00
main()