I have a game in progress when the player fires a "Bullet" out of a gun and shoots the enemy.
Now I have multiple instances of the enemy moving around the screen and if the bullet hits the enemy the enemy is destroyed. The problem I'm having is that if say 2 or more enemy sprites are overlapping and the bullet touches 2 enemies then both enemies are destroyed.
How can I make the bullet only kill 1 of the enemies, 1 bullet 1 kill.
I obviously destroy the bullet when it hits the enemy but still if more than 1 enemy is hit by the same bullet they all get destroyed and I don't want that.
Develop games in your browser. Powerful, performant & highly capable.
You could add a "for each enemy" as your last condition and add a "stop loop" action. Only one enemy would then be destroyed.
Inside de collision condition, use "Pick nth instance" (is a zero based list, so zero is the first picked object) to pick only one, then apply your "Destroy" action.