[SOLVED] Mad Maxer Sells Out - help

Hy guy, i’m problem whit this level…
the hero don’t move to coin… what is the problem?

# Coins here disappear after a few seconds!
# Get all the gold coins before they vanish.

while True:
    closestGold = None      # coin nascosti, vuota
    minGoldDist = 9001      # distanza minima 9001 ( praticamente tutte )
    coinIndex = 0           # punto di inizio della lista , 0 .
    coins = hero.findItems()# genera la lista coins
    while coinIndex < len(coins):
        coin = coins[coinIndex]
        
        if coin.value == 3 and hero.distanceTo(coin) < minGoldDist:
            closetGold = coin
            minGoldDist = hero.distanceTo(coin)
        coinIndex +=1
    # Find the closest coin that is gold.
    # Remember that gold coins have a value of 3.
    
    if closestGold:
        #Now go to the closest gold coin and get it!
        hero.moveXY(closestGold.pos.x, closestGold.pos.y)
        pass

Thanks

# you have:
    closestGold = None
# and then: 
            closetGold = coin # spelling error
1 Like

OMG!!!..
i read it for 2 hour :slight_smile:

Now hero move to coin, but don’t move of all coin and the mission fail.

edit:

No ok… i add another line to define the distance

if coin.value == 3 and hero.distanceTo(coin) < minGoldDist:
            closestGold = coin
            minGoldDist = hero.distanceTo(coin)  # add this line