I need help with Village Guard


#1

hey i need some help. here is my code

loop:

leftEnemy = self.findNearestEnemy()
if leftEnemy:
    self.attack(leftEnemy)
    self.attack(leftEnemy)
# Now move to the right entrance.
# Use "if" to attack if there is an enemy.
self.moveXY(60, 34)  
self.moveXY(35, 34)

#2

Help us help you by reading the FAQ on how to format your code properly and the supply relating information


#3

Your code does this:

Find nearest enemy.
If there is an enemy, attack enemy twice.
Move to the right position.
Move to the left position.

You need to find the nearest enemy from each X. If I were you, I would reset the level, then use the same technique to find rightEnemy that the default code uses to find leftEnemy.