Move your pet to the left or right button as needed.
def onHear(event):
# 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.
archer.moveXY(32, 30)
# If event.speaker is the soldier:
if event.speaker == soldier:
# Move to the right button.
soldier.moveXY(47, 30)
pet.on(“hear”, onHear)
You don’t have to change the code below.
Your hero should protect the bottom right passage.
while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
Not really sure what to do here. Am i moving the hero or the pets?