I am getting an error when I run my code and I do not know why. The error occurs on the very last line: hero.attack(enemy), and reads “Fix Your Code ReferenceError: even is not defined”. This is not a typo in my post, the error says “even is not defined” and not “event”. Also this is in the part of the code that is says I do not need to change. I also checked that I have a sword equipped that supports the hero.attack move.
Move your pet to the left or right button as needed.
# Find the guards to listen to.
archer = pet.findNearestByType(“archer”)
soldier = pet.findNearestByType(“soldier”)
# If event.speaker is the archer:
if event.speaker == archer:
# Move to the left button.
# If event.speaker is the soldier:
if even.speaker == soldier:
# Move to the right button.
You don’t have to change the code below.
Your hero should protect the bottom right passage.
enemy = hero.findNearestEnemy()