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

[Solved]Coincrumbs level help please

@dedreous

# Follow the trail of coins to the red X at the exit.

while True:
    # This finds the nearest item.
    item = hero.findNearestItem()
    if item:
        # This stores the item's pos, or position in a variable.
        itemPosition = item.pos
        # Put the X and Y coordinates of the item into variables.
        itemX = itemPosition.x
        itemY = itemPosition.y
        # Now, use moveXY to move to itemX and itemY:
        items = hero.findItems()
        hero.moveXY(8, 34)
        hero.moveXY(8, 9)
        hero.moveXY(24, 10)
        hero.moveXY(40, 9)
        hero.moveXY(55, 10)
        hero.moveXY(56, 34)
        hero.moveXY(72, 34)
        hero.moveXY(72, 57)

i am stuck so i got an success but when i pressed sumit i failed

Instead of hard coding the coordinates, use the variables itemX and itemY instead.

1 Like

thanks that worked

[en_US.composer.my_button_text]

could you help me out on blind distance

it did not work for me

please do not revive dead topics and welcome @Riley_Capel
-Zax

1 Like

Hi, @Riley_Capel, welcome to the CodeCombat discourse :tada:
Zax’s code wasn’t working code, were you using that?
If not, please post your code and we’ll see what we can do.
Danny
P.S. @ZAX155, You can revive a topic if you yourself need more help, I just don’t like it when people say stuff like “thanks” 4 years later :grin:

okay @Deadpool198 i will try not to do it
-Zax