Dueling Grounds

I don’t understand what I am doing wrong in this level. My code looks like this:

loop:
self.findNearestEnemy()
self.attack(enemy)

But it tells me that the enemy is not defined. I don’t understand. I’ve tried moving to different places. My character just won’t attack.

Did you assign self.findNearestEnemy() to a variable?

Did you define enemy?

(Hint: enemy = ???)

(Also, use the triple backticks (```) to wrap your code next time.)

1 Like

Thank you. I figured it out.

1 Like