Spring Thunder coin


#1
while True:
    item = hero.findNearestItem()
    # A silver coin has a value of 2.
    # Collect if item.type is equal to "coin"
    # AND item.value is equal to 2.
    if item.type == "coin" and item.value == 2:
        hero.moveXY(item.pos.x, item.pos.y)
    # A blue gem has a value of 10.
    # Collect if item.type is equal to "gem"
    # AND item.value is equal to 10.
    item = hero.findNearestItem()
    if item.type == "gem" and item.value == 10:
        hero.moveXY(item.pos.x, item.pos.y)

I dont understand, why dont work?


#2

Please format your code by highlighting it and pressing the < / > button. Alternatively, you can use three backticks ``` (usually above the tab button on the keyboard) at the beginning and end of the code.

Just from looking at what you’ve posted, I can’t see anything wrong with your code. I would suggest mixing up the gear on your character (take off a speed ring if you have it, put one on if you didn’t wear one before, etc). The only change that you could make to your code is that you don’t need the second item = hero.findNearestItem() .


#3

i dont have ring, code dont work


#4

Hi. I think the problem is that your hero is too close to mushrooms after the first coin. It’s a bug. I’ll fix it ASAP.


#5

@DeadShank Could you try it now?


#6


#7

It’s weird. I just checked it with your account and it worked. Sorry, I forgot to remove say. Could you try direct link https://direct.codecombat.com/play/level/spring-thunder or clear browser cache?


#9

@taylerzy I was only getting the coins if I commented out the gem conditionals, but I took off the speed band, and it worked. Thanks!