my task causes an update bug

here is my code:

def updatezombies(Task):
            i=0
            for z in zombieArray:
                pos=zombieArray[i].basezombie.getZ()
                pos=pos +0.0005
                zombieArray[i].basezombie.setZ(pos)
                i+=1
            return Task.again

it works correct on the first generator I make- but if you add additional generators- every time you add a new generator all the zombie’s accelerate.

Why is this?

[color=red][b]Edit: Nevermind I had set the code inside of another loop because of an indentation mistake. It needed to be on it’s own.

JB[/b]

the purpose is to update the positions and move each zombie at the same rate irregardless of how many zombies or zombie generators.

instead of using zombieArray[i] you can simply use z.
you can also cut down a few operations and shrink it.
like

def updatezombies(Task):
            for z in zombieArray:
                z.basezombie.setZ(z.basezombie.getZ() + 0.0005)
            return Task.again