# Move your pet to the left or right button as needed.
def onHear(event):
# Find guards to listen them.
archer = pet.findNearestByType("archer")
soldier = pet.findNearestByType("soldier")
# If the speaker is the archer:
if event.speaker == archer:
# Move to the left button.
pet.moveXY(32, 30)
# If the speaker is the soldier:
if event.speaker == soldier:
# Move to the right button.
pet.moveXY(48, 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)
This is what I have so far but every time I do it, it says that its incomplete. Please help!
I changed my code and now it looks like this but the hero is running out of health before the game ends. What can I do to fix this?
# 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.
pet.moveXY(32, 30)
# If event.speaker is the `soldier`:
if event.speaker==soldier:
# Move to the right button.
pet.moveXY(48, 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 and hero.distanceTo(enemy) < 5:
hero.attack(enemy)
Can you please post the Starter Code? Also what hero and equipment are you using? (For that please post the picture of the game before loading the level.)
To everyone who is stuck on the level, you need to buy equipment or choose a hero that gives you more health so you can complete the level. (sorry for the unnecessary notification btw)