Dueling Grounds


#1

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.


#2

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.)


#3

Thank you. I figured it out.