81 lines
1.6 KiB
Python
81 lines
1.6 KiB
Python
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
|
|
|
|
def getLocation(self):
|
|
return self.location
|
|
|
|
class GameManager:
|
|
'Manage the game'
|
|
|
|
def __init__(self, userInput):
|
|
self.gameIsRunning = True
|
|
self.player = Player(userInput, 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():
|
|
os.system('clear')
|
|
|
|
def titleScreen():
|
|
while(True):
|
|
clearScreen()
|
|
print("Space Game Title To Be Disclosed!!!")
|
|
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)
|
|
|
|
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":
|
|
clearScreen()
|
|
|
|
def main():
|
|
titleScreen()
|
|
|
|
main()
|