(solved) Underground business i need help


i need help with underground business. here is my code:

i can’t figure out what’s wrong.


You do not need to put pet.on("spawn", onSpawn) in a while-true loop. It automatically loops itself.


okay but now it has two errors:


What is gold? Try using hero.gold. Also be sure to use >= because there could be more than 300 gold (>= means greater than or equal to), or else you will be assigning 300 to the variable gold.
I don’t quite understand the enemy issue, but unless you don’t have any glasses equipped, it should be working.

Also a little side note: I suppose that you should let the pet move to each corner of the dungeon because it is magnetic and attracts items, and there is more than one type of item to collect.


thanks! it worked! (it has to be 20 characters)


I can’t get 300 coins, only 150 coin. Do anyone know the resolution?

Accumulate 300 gold and escape from the dungeon.

def onSpawn(event):
while True:
# Send the pet to walk around the dungeon:
# Don’t forget to return it to the hero:
pet.moveXY(hero.pos.x, hero.pos.y)

pet.on(“spawn”, onSpawn)

while True:
# Guard peasants:
enemy = hero.findNearestEnemy()
if enemy:
# When you have 300+ gold move to the red mark:
if hero.gold >=300:
hero.moveXY(50, 34)


Did you get all the gold from the mimic, or did you not get any at all.


I only get 150 gold and don’t have any way to get all 300 gold. I don’t know why.


Even if i let mimic run around, it is still 150 coin :frowning:
Anyone who can give me the correct code? Don’t instruction :frowning:


for one you shouldn’t put it in a while loop.


I have passed. Thank you all :)))