Long Road / Bug?


#1

Move to the right side of the forest.

This function should check for items near the pet and fetch them.

def fetchPotions(event):
# Complete this function:
# Don’t forget to use a “while-true loop”:
item = hero.findNearestItem()
if item:
pet.fetch(item)
pass

while True:
health = hero.maxHealth
x = hero.pos.x
if health < hero.maxHealth/3:
pet.on(“spawn”, fetchPotions)
else:
hero.moveXY(x + 20, 35)
pass

Assign the function ‘fetchPotions’ for the pet event “spawn”.


#2

No. Just wrong code. Don’t wait low health to assign an event handler. Have you solved levels before about “spawn” events? (Go fetch, Guard Dog)?