Compare commits
2 Commits
13eb7979e9
...
c58efad369
Author | SHA1 | Date | |
---|---|---|---|
c58efad369 | |||
d183c57d18 |
35
main.py
35
main.py
@ -1,6 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
PLAYER_INIT_LOCATION = "BoB"
|
PLAYER_INIT_LOCATION = "Luna"
|
||||||
|
|
||||||
class Player:
|
class Player:
|
||||||
|
|
||||||
@ -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,9 +72,10 @@ 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()
|
||||||
for item in self.items.values():
|
for item in self.items.values():
|
||||||
print("Name:", item.getName())
|
print(f"{item.getName() : <15}{'* * * * * | * * * * *' : ^10}{str(item.getPrice()) : >5}")
|
||||||
print("Cost:",item.getPrice())
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
class Item:
|
class Item:
|
||||||
@ -82,7 +89,6 @@ class Item:
|
|||||||
def getPrice(self):
|
def getPrice(self):
|
||||||
return self.price
|
return self.price
|
||||||
|
|
||||||
|
|
||||||
def clearScreen():
|
def clearScreen():
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
|
|
||||||
@ -90,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
|
||||||
@ -99,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),
|
||||||
@ -124,9 +131,8 @@ def mainGame():
|
|||||||
"Luna" : Planet("Luna")
|
"Luna" : Planet("Luna")
|
||||||
}
|
}
|
||||||
planets["BoB"].addTradeHub(tradeHubs["Star Crapper"])
|
planets["BoB"].addTradeHub(tradeHubs["Star Crapper"])
|
||||||
|
planets["Luna"].addTradeHub(tradeHubs["The Jackel"])
|
||||||
|
|
||||||
planetLuna = Planet("Luna")
|
|
||||||
planetLuna.addTradeHub(tradeHubs["The Jackel"])
|
|
||||||
|
|
||||||
# Create user
|
# Create user
|
||||||
userInput = ""
|
userInput = ""
|
||||||
@ -142,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