Boots of jumping doesn't like moveXY?

Hi
here’s my level

issue:
trying to set moveXY as dynamic variables

 coin = hero.findNearestItem()
        if coin:
            pos = coin.pos
            x = coin.x
            y = coin.y
            hero.moveXY(x, y)

Throws an error.

I also tried:

  elif item:
        # Collect coins.
        coin = hero.findNearestItem()
        if coin:
            pos = coin.pos
            xc = coin.x
            yc = coin.y
            hero.move({"x": xc, "y": yc})

Also throws an error. :confused:

but the help uses the same code!


Uploading…

Is it because I’m using boots of jumping?!

thank you
Dennis

Here’s the full my code

# Collect coins. Ignore sand yaks and burls. Fight throwers and ogres.
while True:
    enemy = hero.findNearestEnemy()
    item = hero.findNearestItem()
    if enemy:
        if enemy.type is "sand-yak" or enemy.type is "burl":
            # Don't fight sand yaks or burls! Just keep collecting coins.
            hero.say("Get out of my way!")
            pass
        else:
            # But if the enemy is type "thrower" or "ogre", attack them.
            if enemy.type is "thrower" or "ogre":
                hero.attack(enemy)
                hero.attack(enemy)
                
            pass
        
    elif item:
        # Collect coins.
        coin = hero.findNearestItem()
        if coin:
            pos = coin.pos
            x = coin.x
            y = coin.y
            hero.moveXY(x, y)

        
        pass
1 Like

Its not the boots of jumping. your coin variable is good, but the “pos” variable is unnecessary. same as your x and y variables. You are overthinking it. its much simpler than it is. You need to use:
hero.moveXY(coin.pos.x, coin.pos.y) for example.
Hope this helps!:+1:

2 Likes
        coin = hero.findNearestItem()
        if coin:
            pos = coin.pos
            x = coin.x
            y = coin.y
            hero.moveXY(x, y)

You’re setting pos equal to coin.pos, but then setting x and y to coin.x and y.

1 Like

Yes. Thank you. I see it now.