I need to update my Game lists and variables in the Game's init function from my Troop class.
# trying to make a game
# here is a quick summary of what I am trying to accomplish
class Game(object):
def __init__(self):
self.var1 = 0
self.xlist = [1, 2, 3]
self.ylist = [6, 5, 4]
def mainloop(self)
for x in range(0, len(self.xlist))
t = Troop(self.xlist[x], self.ylist[x])
class Troop(Game):
def ally(self, x, y):
x += 1
# ^--v these formulas are more complex in the game
y += 1
# v-- what I need to update from Troop class
# var1, xlist, and ylist
# code code code
# code code code
The Troop class basically makes a copy of these variables and lists and changes only them. They are not updating correctly for my full game.