Simultaneous Collision

Hello!!

So, I have an issue with double collision. When my player dies, they will respawn in a second after and have a blinking affect while invulnerable for a few seconds more. A somewhat rare issue Im having is if I happen to be sitting just right between two enemies when the blinking effect has ended, it will hit both enemies at the same time, decreasing 2 lives instead of 1. Does this make sense? Is there a way to check for just 1 and only 1 collision if two or more happen to within the range?

Thanks!

1 Answer

1

You could set a global boolean to true once one of them starts processing the loose life scenario, and everywhere there is a collision detected that could cause loss of life, first check if this is set, and if it is do nothing. Remember to set it back when finished.
Alternatively if you are processing the loss of life in 1 single script, that is called by a broadcast message for example, then use a local boolean within that.

so basically broadcast a bool trigger once player life has been decremented so that it will disconnect the lose life code and it wont register a simultaneous collision?

–

There isn't a more elegant way to do this?

–