Finish Luna; pretty item list

This commit is contained in:
Logen Kain 2021-05-10 19:13:26 -04:00
parent 13eb7979e9
commit d183c57d18

10
main.py
View File

@ -1,6 +1,6 @@
import os import os
PLAYER_INIT_LOCATION = "BoB" PLAYER_INIT_LOCATION = "Luna"
class Player: class Player:
@ -66,9 +66,9 @@ 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}")
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 +82,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')
@ -124,9 +123,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 = ""