There might be something wrong with this level. My bird is acting stupid. It fly’s out for no reason, then when it time to fetch, the stupid thing brings it half way then fly’s back.
Here is my code–
def onHear(event):
# Find the nearest potion.
potion = pet.findNearestByType(“potion”)
message = event.message
# If the event’s message is “Fetch”
if message is “Fetch”:
# Have the pet fetch the potion.
pet.fetch(potion)
# Else (for any other messages):
else:
# Use pet.moveXY to return the pet to the red mark.
pet.moveXY(53,34)
pet.on(“hear”, onHear)
You don’t have to change the code below.
while True:
enemy = hero.findNearest(hero.findEnemies())
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 34)
ok
</>def onHear(event):
# Find the nearest potion.
potion = pet.findNearestByType(“potion”)
message = event.message
# If the event’s message is “Fetch”
if message is “Fetch”:
# Have the pet fetch the potion.
pet.fetch(potion)
# Else (for any other messages):
else:
# Use pet.moveXY to return the pet to the red mark.
pet.moveXY(53,34)
pet.on(“hear”, onHear)
You don’t have to change the code below.
while True:
enemy = hero.findNearest(hero.findEnemies())
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 34) </>
def onHear(event):
# Find the nearest potion.
potion = pet.findNearestByType("potion")
message = event.message
# If the event's message is "Fetch"
if message is "Fetch":
# Have the pet fetch the potion.
pet.fetch(potion)
# Else (for any other messages):
else:
# Use pet.moveXY to return the pet to the red mark.
pet.moveXY(53,34)
pet.on("hear", onHear)
# You don't have to change the code below.
while True:
enemy = hero.findNearest(hero.findEnemies())
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 34)