[SOLVED] Problem with detecting collisions when they overlap

I have an attack animation that deals damage when player collides with the enemy.
I use Trigger once condition to deal damage only 1 time to the specific enemy during the animation.

However, if I have 2 or more enemies that are close to each other, their collision masks are also close together. That makes the player collision mask touch collision masks of both enemies at the same time.

This results in player dealing damage only to the first enemy it collides with, leaving the other enemy undamaged, until player resets and collides with the other enemy again.

I’ve been using repeat for each condition for enemies to check for collisions, but the problem remains.
If the player is touching the first enemy, I think that the code registers that it is touching the other enemy as well.

Instead of Trigger Once, you may want to use an object variable for the enemy like “damaged”. When they are attacked, set their “damaged” to true.
On another event, add a timer that waits for 1 second, then set “damaged” to false.

1 Like

Got it working! Thank you.

1 Like