I'm not sure how many of you are familiar with fighting games, but most of them have this mechanic that players call "trading hits" which occurs when both players' hitboxes intersect each other's hurtboxes at roughly the same time. This causes both players to get hurt. You can see an example at 1:41 in this video:
I want to implement something similar in my game. The problem I have right now is it checks for collisions between players starting with player 1, so if both characters tried hitting each other at the same time, player 2 would get hit first and player 1 would be unharmed because player 1 would have hit player 2 first.
I can fix this by having the hitboxes linger. However, it doesn't look good when someone gets hit right after using an attack that lasts for a good 2-3 seconds, causing another player that got in range of the attack to get hit despite a significant amount of time passing since the initial attacker got hit.
In other words, I need to somehow check for both characters getting hurt at the same time, and at the moment I can't think of a clean-cut way to do it. I suppose I can try and keep track of who hit who with which hitbox (there can be multiple active at one time, Ex. Multi-hit attacks), but that'll be a lot of unnecessary information to store considering I already have it all...
Does anyone have any suggestions for implementing such a mechanic? Thanks in advance!