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

Coincrumbs level shifting

When i try to do the level coincrumbs i get my code right but as soon as i hit submit it changes how the map looks and gets me killed.

Post you code, properly formatted, so we can see what might be the problem.

# 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:
        hero.moveXY(8,33)
        hero.moveXY(24,34)
        hero.moveXY(40, 34)
        hero.moveXY(40, 10)
        hero.moveXY(72,9)
        hero.moveXY(72,57)

I have the same problem

as soon as i hit submit the map changes

Rather than hard coding the moveXY coordinates, use the variables itemX and itemY instead.