Problem with completing mission "Airdrop"


#1

Hello,I have problem, in mission Airdrop i don’t know how to complete this level.
This is my code:

def onSpawn (event):
while True:
item = hero.findNearestItem()
if item:
pet.moveXY(item.pos.x,item.pos.y)
pet.fetch(item)

while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
pass

How to use pets, I have never done it before.
Can you help?Thank you.


#2

remove the pet.moveXY(). Under Pet.fetch(item) and above while True:, type down pet.on("spawn", onSpawn)


#3

@Seojin_Roy_Lee Don’t just give out the answer. Make sure you add an explanation why so @Vayne1 can also grasp the concept