How can I programm losing a second heart in a game?

Hi I´m new on snap and not very good with programming.

I want to program a game. For that every time my player touches the opponent, I want to loose a heart. (It turns grey)

For the first heart it works but for the second and third… I dont know what to do. If the player touches the opponent a second time the second heart is supposed to turn grey. I thought maybe i could use the operator “touching=2” but it doesnt work.

I hope maybe someone could help me or give me an impulse… :slight_smile:


Use the amount of losses as a number rather than multiple variables.
From there you can set the heart costume based on the value of “losses”.

Thank you! My code is working now :slight_smile:

just saying, the when <> is really slow. you should use


(drag this image into snap).
Also, since redgrographysnap answered your question, you should probably mark their post as the solution.

Thank you, i will try this. I didnt know i could do that but i marked it as the solution!! TY :slight_smile:

you’re welcome! let me know if my solution works.