[SOLVED] Mushroom Noise

I don’t know what is wrong with my code, I am on the level Mushroom Noise in the desert.

# Defeat the skeleton and open the chest.

def onSpawn (event):
    # Pet should find the health potion (type is "potion"): 
    potion = pet.findNearestByType("potion")
    # and fetch it:
    pet.fetch(potion)
    # Pet should find the gold key (type is "gold-key"):
    item = pet.findNearestByType("goldkey")
    # and fetch it:
    pet.fetch(item)
    pass

# Pet can find more than just items:
skeleton = pet.findNearestByType("skeleton")
pet.on("spawn", onSpawn)

while True:
    if skeleton.health > 0:
        hero.attack(skeleton)
    else:
        hero.moveXY(31, 38)

what is your problem?

never mind, i encountered the worst enemy of coding. AKA misspelling. In the searching for a gold key line there is supposed to be a “-” in between gold and key. I fixed it in the next minute! Thanks for trying to help though.

no problem
:slightly_smiling_face:

Moi aussi j’ai le meme probleme. C’est le meme niveau, et je ne vois pas où est le problème.


J’espere que mon post est bien placé
Merci a toute personne qui pourra m’aider.

J’ai moi aussi trouver mon erreur. Je le partage, comme ça si une autre personne est embeté, je pourrai aider a mon tour.
Donc a la ligne 9, j’ai commencé par écrire:
gold-key = pet.findNearestByType(“gold-key”)
Noter comme ça, ça equivalait a “gold” qui soustrait a “key”. J’ai simplement enlevé le (-).
Voila je referme le post

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