Shine Getter Help! [Solved]

this is my code, please help me the hero will not move!

# To grab the most gold quickly, just go after gold coins.

while True:
    coins = hero.findItems()
    coinIndex = 0
    # Wrap this into a loop that iterates over all coins.
   while coinIndex < coins.size:
        coin = coins[coinIndex]
    # Gold coins are worth 3.
    if coin.value == 3:
       # Only pick up gold coins.
       hero.moveXY(coin.pos.x, coin.pos.y)
        pass

Two problems, you probably want to use len(coins) instead of coins.size. Second, you want to indent the if statement and the hero.moveXY

1 Like

I will try that now.

now my code is,

# To grab the most gold quickly, just go after gold coins.

while True:
    coins = hero.findItems()
    coinIndex = 0
    
    # Wrap this into a loop that iterates over all coins.
    while coinIndex < len(coins):
        coin = coins[coinIndex]
    # Gold coins are worth 3.
    if coin.value == 3:
        # Only pick up gold coins.
        hero.moveXY(coin.pos.x, coin.pos.y)
        pass
          

It still will not move my hero.

Is this a bug of some sort?

Put the if coin.value == 3 inside the while coinIndex < len(coins): and make sure to increment coinIndex(coinIndex += 1) after the if statement.

thanks for your help it works now!

'Gratz :slight_smile:

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