Coins Not Destroying

So, in my game whenever you beat the 1st level without collecting any coins, then the 2nd level has the same coins from the 1st level still appear. does anyone know how to fix this?

Link

https://makecode.com/_WmzT5JYh5Jku
even though i had a hyperlink up there

Think of this as the demo of my next big game!

What the problem seems to be to me is your next level function.
Screenshot 2021-06-21 9.34.51 AM
It only destroys one coin, most likely the most recently created one because with your create coin code it names them all Coin. One fix to this would to be to destroy all of the coins (which would be harder), or to only be able to progress to the next level if you have collected all the coins (much easier fix, but might not be what you want for your game).

1 Like

Thank you! I’ll probably go with Option 2 as its not tedious to do.

Yeah, I tried doing something like that awhile ago and it ended up just not working after trying for 3 hours. Hope that your game goes well though!

1 Like

it’s not that bad to destroy all the coins if you still want to do that! you can loop over all the sprites of kind coin and destroy them:

3 Likes

Thank you! i never knew you could use “For element value of list” block so well!

2 Likes

I didn’t know that, that’s really cool!

3 Likes

Or you could use the destroy all of kind () block from the tilemaps extension.

2 Likes