I have a class:
class Tree(object):
def __init__(self):
self.health = 100
And I use it here:
tree_list += [Tree()] * random.randint(4, 12)
This makes the list contain multiple Tree() classes. The problem is that when I change 'health' in one of the items in tree_list:
tree_list[0].health -= 25
It changes the 'health' value in EVERY item in tree_list. Can someone please help me figure out why it changes the value for every item instead of the item I intend to change? Any help would be appreciated. :D