[SOLVED] Help! Medic School

def startsWith(phrase, word):
    # If the word is longer than the text, return False.
    if len(word) > len(text):
        return False
        # Loop through the indexes of word and text.
        for i in len(word):
            # If characters with the same index are different:
            if i != phrase:
                # Return False.
                return False
    # We checked all letters and they are the same.
    # Return True.
    return True

def onHear(event):
    # Accept only options from experts.
    if startsWith(event.speaker.id, "Exp"):
        potion = pet.findNearestByType("potion")
        if potion:
            pet.fetch(potion)
            pet.moveXY(28, 34)

pet.on("hear", onHear)
while True:
    mushrooms = hero.findByType("mushroom")
    nearest = hero.findNearest(mushrooms)
    if nearest:
        hero.moveXY(nearest.pos.x, nearest.pos.y)

Am I doing something wrong?
Lydia

https://codecombat.com/play/level/medic-school?

Lydia

Thanks!
Lydia
20 chars

Isn’t the pet supposed to move to the hero?
Lydia

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.