[Solved] HELP! Spring Thunder

Please help-I can only get the coins but not the gems. I don’t know the code to get the gems. I’m so confused-I don’t know what this means:

# A blue gem has a value of 10.
# Collect if item.type is equal to “gem”
# AND item.value is equal to 10.

Thoughts appreciated thanks!

The comment is about checking if the item you pick is a gem with value 10.
Lets say item is the item that you check. Then you must check if item.type is "gem" and if item.value is 10. Tell me if you need more help.

Okay. Could you show me how to do it in code? :slightly_smiling_face:

(I kept trying to look on the other Spring Thunder topics but I didn’t understand still.) Sorry if I understand it slowly, I’m a slow coder.

Now I can’t get the coins either!!! I wonder what’s happening…could you please help me, @xantar? I have no idea how to do this-I don’t think my other lessons were as tricky as this!

you would have to chech if the item.type == gem so here is how you would put it if item.type == "gem"
the == is comparing between 2 objects. And the "" is something. Just place the item that you need in the ""
For the value part you would need to compare to see if it is == equal to whatever the value is. Do not put numbers in brackets) So this is all you need to knowfor Spring Thunder @SwordandShield

Python: if item.type=="gem" and… I think you can figure out the rest

It worked! Thank you very much, @xantar and @Archion! :grinning:

please help i have a good code and my friend past the level and i have the same code as him but it doesn’t work

Hi Hayden, Welcome to the CodeCombat discourse.
Please could you post the code and tell us your equipment (that’s the most likely source of the error).
Thanks,
:lion: :lion: :lion:

are you with defensive boots?
deffensive_boots
If so, they are toooo slow…

I think he is

can anyone help me and type the answer for Spring Thunder

Hi, if you need help with a level please post your code (formatted, instructions here: How to Post Your Code With Radiant, Harmonious Formatting) and specify your problem so we can help you.
We won’t give you the solution, as it’s against the rules and principles of the CodeCombat discourse.
Thanks
Danny

what do i do as the code isnt working


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.
    

this is my new code can someone help me please

# The hero should only grab silver coins and blue gems.

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)
        pass
    # A blue gem has a value of 10.
    # Collect if item.type is equal to "gem"
    # AND item.value is equal to 10.
    if item.type == "gem" and item.value == 2:
        hero.moveXY(item.pos.x, item.pos.y)
        pass

It tells you that the item’s value should be 10, so why do you have it as 2 @floridamanog?

1 Like

thanks i have finally done it, thank you so much

1 Like

FYI the level is random so the code might not work