How to delete one enemy at a time after spawning multiple of them?

I have a mechanic where enemies are spawned every 3 seconds adn enemies are deleted when they are in collision with a “pipe” object.

The “pipe” object should only delete one enemy from the 2 or 3 that are on screen and in collision with the “pipe” object. So when pipe collides with enemy = delete enemy that is in collision with the pipe.

This doesn’t happen and rather it deletes all the enemies. Note that the spawned enemies are the same objects. Idk what is causing it to delete every enemy at once and not delete them one at a time.

The mechanic is pretty much the same as in the arcade Mario Bros. game.

Picture of the code. Spyke is the enemy and PipeDelete is the pipe object.

I tried to use the example platformer game to see how that deletes only one coin at a time when in collision with the player but the code lookes the same as mine does.

Hello, aapiarts

How about you put “Repeat for each instance” in the event that’s checking the point inside of PipeDelete?
I did it:


1 Like