Help With Shine Getter


So I’ve been stuck on the level Shine Getter in the Desert World, and I need some help.
So, I’m not sure what’s wrong with my code, but if anyone could help me out, I would appreciate it.
My code:

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


Your while-loop entails while coinIndex > len(coins):. The problem is, coinIndex is zero, and therefore is never greater then the amount of coins. I don’t suppose you meant while coinIndex < len(coins):?


Then I just get a “Hard Execution Limit of 3 Million”


Your indentations are also a little mixed up. If my assumptions are correct, you only increment coinIndex when you pick up a gold coin. This should not be. You want to loop over all coins.


Just tried it when you find a gold coin, not when you walk over it, and it worked. Thanks for your help


Lol I just got the 100 levels achievement and got 1,000 gems, too. :grinning: