Pretty up the menus a bit
This commit is contained in:
parent
d183c57d18
commit
c58efad369
27
main.py
27
main.py
@ -32,19 +32,25 @@ class GameManager:
|
|||||||
self.gameIsRunning = False
|
self.gameIsRunning = False
|
||||||
|
|
||||||
def printPlayerStats(self):
|
def printPlayerStats(self):
|
||||||
|
clearScreen()
|
||||||
print("Name: ", self.player.getName())
|
print("Name: ", self.player.getName())
|
||||||
print("Location: ", self.player.getLocation())
|
print("Location: ", self.player.getLocation())
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def enterTradeHub(self):
|
def enterTradeHub(self):
|
||||||
|
clearScreen()
|
||||||
while True:
|
while True:
|
||||||
userInput = input("(l)ist items (e)xit\n>> ").lower()
|
userInput = input("(e)xit\n\n(l)ist items\n>> ").lower()
|
||||||
|
|
||||||
if userInput == 'e':
|
if userInput == 'e':
|
||||||
|
clearScreen()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if userInput == 'l':
|
elif userInput == 'l':
|
||||||
|
clearScreen()
|
||||||
self.planets[self.player.getLocation()].getTradeHub().printItems()
|
self.planets[self.player.getLocation()].getTradeHub().printItems()
|
||||||
|
else:
|
||||||
|
clearScreen()
|
||||||
|
|
||||||
class Planet:
|
class Planet:
|
||||||
'Contains trade hub'
|
'Contains trade hub'
|
||||||
@ -66,7 +72,8 @@ class TradeHub:
|
|||||||
def getItems(self):
|
def getItems(self):
|
||||||
return self.items
|
return self.items
|
||||||
def printItems(self):
|
def printItems(self):
|
||||||
print(f"{'Name' : <15}{'* * * * * | * * * * *' : ^10}{'Cost' : >6}")
|
print(f"{'Name' : <15}{'- - - - - | - - - - -' : ^10}{'Cost' : >6}")
|
||||||
|
print()
|
||||||
for item in self.items.values():
|
for item in self.items.values():
|
||||||
print(f"{item.getName() : <15}{'* * * * * | * * * * *' : ^10}{str(item.getPrice()) : >5}")
|
print(f"{item.getName() : <15}{'* * * * * | * * * * *' : ^10}{str(item.getPrice()) : >5}")
|
||||||
print()
|
print()
|
||||||
@ -89,7 +96,7 @@ def titleScreen():
|
|||||||
while(True):
|
while(True):
|
||||||
clearScreen()
|
clearScreen()
|
||||||
print("Space Game Title To Be Disclosed!!!")
|
print("Space Game Title To Be Disclosed!!!")
|
||||||
userInput = input("(n)ew game (q)uit:\n>> ").lower()
|
userInput = input("(n)ew game\n(q)uit:\n>> ").lower()
|
||||||
|
|
||||||
if userInput == "q":
|
if userInput == "q":
|
||||||
break
|
break
|
||||||
@ -98,6 +105,7 @@ def titleScreen():
|
|||||||
mainGame()
|
mainGame()
|
||||||
|
|
||||||
def mainGame():
|
def mainGame():
|
||||||
|
clearScreen()
|
||||||
tradeableItems = {
|
tradeableItems = {
|
||||||
"flour" : Item("flour", 0.5),
|
"flour" : Item("flour", 0.5),
|
||||||
"Rice Cakes" : Item("Rice Cakes", 1),
|
"Rice Cakes" : Item("Rice Cakes", 1),
|
||||||
@ -140,18 +148,21 @@ def mainGame():
|
|||||||
clearScreen()
|
clearScreen()
|
||||||
|
|
||||||
while Game.isGameRunning():
|
while Game.isGameRunning():
|
||||||
userInput = input("(q)uit (p)layer stats (e)nter trade hub (c)lear screen:\n>> ").lower()
|
userInput = ""
|
||||||
|
userInput = input("(q)uit\n\n(p)layer stats\n(e)nter trade hub\n(c)lear screen:\n>> ").lower()
|
||||||
|
|
||||||
if userInput == "q":
|
if userInput == "q":
|
||||||
Game.stopGame()
|
Game.stopGame()
|
||||||
|
|
||||||
if userInput == "p":
|
elif userInput == "p":
|
||||||
Game.printPlayerStats()
|
Game.printPlayerStats()
|
||||||
|
|
||||||
if userInput == "c":
|
elif userInput == "c":
|
||||||
clearScreen()
|
clearScreen()
|
||||||
if userInput == "e":
|
elif userInput == "e":
|
||||||
Game.enterTradeHub()
|
Game.enterTradeHub()
|
||||||
|
else:
|
||||||
|
clearScreen()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
titleScreen()
|
titleScreen()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user