[Desert Combat] Stuck in a while loop?


#1

I’ve tried a few different things on the second while loop. I keep getting the same error message.


#2

I think it’s because of the returning value of findNearestEnemy.

Try something like this:

while ordersGiven>=5:
    enemy=self.findNearestEnemy
    #it should not ignore this check
    if enemy:
        self.attack(enemy)
    else:
        break

#3

That didn’t work. I’m not sure what to do.


#4

Outlash forgot some brackets.
Correct is

enemy = self.findNearestEnemy()