why
does
my
hero
not
move
in
every
level
i
go
into
# 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)
coinIndex += 1
pass
Look at where you’ve put coinIndex += 1. It’s inside the if coin.value == 3 statement. What will happen if the first coin you loop through is silver or bronze? That if statement won’t run, and coinIndex won’t increase.