Buggy Enemies

Hello! I am currently making my own game for STEM, and I’m having a few bugs. The problem I’m having is with the overlapping with my projectile and the player. When I overlap with my enemies, they’re supposed to be destroyed, and a life is taken away from the player, but all my lives are taken away, and the enemy isn’t destroyed. It’s also the same deal with my projectiles. Any help is greatly appreciated!
Game link: https://arcade.makecode.com/S53386-69976-26094-64741
Thanks ^^

1 Like

The problem is luckily very simple. All you have to do is, in the overlap blocks, change the variable myEnemy to othersprite. You can do this by dragging. Then, drag the destroy othersprite block above the change life block, and it should work.
Screen Recording 2024-12-15 172435
I can’t wait to play the finished game! :princess:

–Bobby5020

3 Likes

You have this:


What you need is this:

The variable myEnemy will always be the last enemy created. It doesn’t matter which enemy you touch. The parameter otherSprite will always be the enemy you touched.

2 Likes

That makes sense. Thank you!

Thanks so much!