for x in self.maxZombieInThisWave:
self.zombie(x) = loader.loadModel("zombie")
self.zombie(x).reparentTo(render)
x/3 = r
r[0] = rowUp
len(x) = length
i[length+1]
but this doesn’t work, how can I create an attribute depending on a for loop?
Also it gives me can’t assign to operator for x/3 = r and len(x) = length. And " can’t assign to function call" for self.zombie(x) = loader… What’s with this?
I’m not sure I understand the question, and that snippet won’t work - it looks like you’re using brackets instead of square brackets to access list elements, and I’m not sure where “r”, “rowUp” or “length” get defined. :S
Try inverting your name definitions, ie x/3 = r should probably be r = x / 3. Accessing a list should be myList[x] instead of myList(x).
I assume self.maxZombieInThisWave is an integer that says how many zombies you need to spawn.
self.zombies = []
if self.maxZombieInThisWave > 0:
for num in range(self.maxZombieInThisWave-1):
self.zombies[num] = loader.loadModel("zombie")
self.zombies[num].reparentTo(render)
# self.zombies[num] now is the current zombie. do with it whatever you need.
# e.g. move it num units up:
self.zombies[num].setZ(num)
Beside that, I suggest you learn Python first. Starting with Panda3D is like trying to fly a helicopter before being able to drive a car.