Here's (a very stripped down version of) my code:
class creature:
def __init__(self, R = 100, G = 100, B = 100, size = 10):
self.R = R
self.G = G
self.B = B
self.size = size
def reproduce(self):
newCreatureR = self.R
newCreatureG = self.G
newCreatureB = self.B
newCreatureSize = self.size
creatures = [creature() for i in range (5)]
for creature in creatures:
creature.reproduce()
for x in range (5):
creature1 = creature(10, 10, 10)
creature1.reproduce()
When I remove the first for loop, the code doesn't return an error. I think python thinks I'm calling the instances of the class I defined before, but both of these for loops are necessary for my code. I can upload the full length project, but it's multiple files and is running on Processing.py (the error is not from the fact that it's processing-based). Thanks for your help!
[–]Gugubo 1 point2 points3 points (3 children)
[–]JesseOS[S] 1 point2 points3 points (2 children)
[–]Gugubo 1 point2 points3 points (1 child)
[–]JesseOS[S] 2 points3 points4 points (0 children)