Stuck on Pet engineer?


#1

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?


#2

Your moving the pet in order to press the button. Your not moving the hero because that code was already written.

Can you explain a little more if your having troubles? To me it seems you have all ready written the code.