#Find the nearest item. So I typed: item = hero.findNearestItem And then they said: # Collect item if it exists and its type is “coin”. I put
_ if item:_ #Move to the position of the item. pos = item.pos x = pos.x y = pos.y hero.moveXY(x, y)
Is that the right code?
#Find the nearest item.
item = hero.findNearestItem
# Collect item if it exists and its type is “coin”.
I put
if item:
#Move to the position of the item.
pos = item.pos
x = pos.x
y = pos.y
hero.moveXY(x, y)
You forgot the while True Loop. Without that, this code will run only once. Try adding While True And see if it works.