Skip to content Skip to sidebar Skip to footer

I Received A Name Error When Trying To Call A Method

I have the following function which controls the spawning of the enemies and what they do. At the end of it I create multiple enemies using the same constructor. However, when in t

Solution 1:

You're iterating over enemies with the variable i - not Enemy:

for i in enemies:
    Enemy.load()

Usually you'd want something like:

for enemy in enemies:
    enemy.Load()

That way you're actually invoking the method on the object of your current iteration.

Post a Comment for "I Received A Name Error When Trying To Call A Method"