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