So I accidentally got distracted when I was working on Explorer(), and began working on GameMenu() class. This probably happened because it was my first time doing top-down design. I'm used to working chronologically as I go along with the program I'm making. So in the future, I'll try to stay in the current module I'm working on before moving on. Because I already started it, My next class after the Explorer() function, will be GameMenu().
This is GameMenu() now:
from PlayableCharacter import PlayableCharacter
class GameMenu(object):
PClist = []
# PChp List will use [current, total]
PChpList = []
# The Recource will use [current, total, name]
def __init__(self):
#Defualt for now
self.PClist = []
self.PChpList = []
self.PCRecourceList = []
def update(self, playerCharacters):
self.PClist = []
self.PCRecourceList = []
self.PChpList = []
for ch in playerCharacters:
self.PClist.append(ch)
self.PChpList.append([ch.currentHealth, ch.health])
self.PCRecourceList.append([ch.currentEnergy, ch.energyValue, ch.energyName])
def displayPC(self, playableCharacter):
#Defualt for now
print(playableCharacter.displayName)
def displayGameMenu(self):
#defualt for now
for pc in self.PClist:
print(pc)
I changed the constructor to create the lists needed for GameMenu(), then I added the Update() to update the lists with the current information. In theMain.py I added I added a list with all the characters to serve as a parameter for Update. It gets updated after every call to explorer().
characters = [Lori, Lauren, Julius, Marcus]
Comments
Post a Comment