[Solved] What should I do next after fetched a sword by raven?(“Airdrop” stage)

I am straggling on “Airdrop” stage.

My raven has fetched a sword, I don’t know what should it to do.

# Get all swords and protect the village.

def onSpawn (event):
    while True:
        item = hero.findNearestItem()
        #  The pet should fetch the item if it exists:
        pet.fetch(item)
        pet.moveXY(22, 34)

# Assign onSpawn function for the pet's "spawn".
pet.on("spawn", onSpawn)

while True:
    # Guard the left passage: 
    pet.moveXY(21, 34)
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    pass

you don’t need to tell the pet to keep returning to the 21, 34 coordinates. pet.fetch tells the pet to return the item to your hero and that is sufficient for this level. Also, in your onSpawn function, you should get in the habit of checking for an item before moving to it.

item = define item variable
if item:
    do something with item
2 Likes