I recently tried to rebeat Peasant Protection, and even after following the instructions I had trouble.
Here is my code:
while True:
enemy = hero.findNearestEnemy()
distance = hero.distanceTo(enemy)
if distance < 10:
# Attack if they get too close to the peasant.
self.attack(enemy)
# Else, stay close to the peasant! Use else.
else:
self.moveXY(40, 37)
as you can see, I did what the instructions said, but no matter what i did my code didn’t seem to work. the hints didn’t help either.
@Autri_Basu what kind of sword are you using? I used your code and won the level using the long sword so I am not sure what is happening on your end. Are you using a warrior class to play?
Make sure you can defeat each munchkin with 1 attack and try resubmitting.
Are you asking for help? Or are you just saying that you used the Long Sword for this level, because if you are, please do not revive dead topics.
Lydia