Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED]Command to find and collect items

Hi I just wanted to know if anyone knew the command to have your hero find and collect the items for example on salted earth the goal is to kill the ogres and collect the coins
I have the code to kill but not to move and collect them. Can someone help me with this?

Item = hero.findNearestItem

If item:
    Hero.moveXY(item.pos.x, item.pos.y)

Im pretty sure that’s it in python

Or the more simple way is

item = hero.findNearestItem

If item:
    hero.move(item.pos)
1 Like

Make sure to make the I lowercase if you’re making it

:crazy_face:

Rachel

I know, i just could not copy paste it from any level, so it automatically pages it upper case

1 Like

This skill is useful for many future levels. Can you please mark whichever post helped solve your problem or helped the most.

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