help:

I get an error:

File "F:\zombielord\main.py", line 1692, in pumpkin_zombie_fight
distance=pumpkinArray[ea_pumpkin].obj.getPos()-zombieArray[ea_zombie].obj.getPos()
AssertionError: !is_empty() at line 1115 of panda/src/pgraph/nodePath.cxx

when running this code:

for ea_pumpkin in range(len(pumpkinArray)-1,-1,-1):
        for ea_zombie in range(len(zombieArray)-1,-1,-1):
          if not pumpkinArray[ea_pumpkin].obj.isEmpty() or zombieArray[ea_zombie].obj.isEmpty(): 
            distance=pumpkinArray[ea_pumpkin].obj.getPos()-zombieArray[ea_zombie].obj.getPos()

It happens if a pumpkin has been destroyed by a zombie- then later that same zombie gets destroyed.

What is wrong with my checking?

Perhaps you meant to use parens here for grouping:

if not (pumpkinArray[ea_pumpkin].obj.isEmpty() or zombieArray[ea_zombie].obj.isEmpty()):

Otherwise, the keyword “not” applies only to the first clause, not to the whole condition.

David

:open_mouth:

Thanks