Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED]Need help with Shine Getter (Python)

I’ve been stuck on this level for a while now, and have been reading some posts on it and have gotten my code to where my character will collect three gold coins and then stop moving. No idea why this is happening so some help would be appreciated.
This is my code:

coinIndex = 0
while True:
    coins = hero.findItems()
    while len(coins) > coinIndex:
        coin = coins[coinIndex]
        coinIndex += 1
        if coin.value == 3:
            pos = coin.pos
            x = pos.x
            y = pos.y
            hero.moveXY(x, y)
            pass

Try moving your coinIndex = 0 statement to inside the while true loop.

Tried it and it worked!
Thanks so much!

1 Like