I'm working on a 2d platformer with beat'em up / fighting mechanics and I would like to have the community's feedback on how to best handle Hit Detection.
A bit of background :I have one player and multiple instances of the same enemy active object. Each enemy has a Hurt Box active obj linked to him. This Hurt Box is used for hit detection.
The player has several attack animations which trigger the creation of a Hit Box active obj which, when colliding which enemy hurtboxes, triggers their respective "get hit" animation.
This system is very similar to what is done in 2d fighting games.
The issue is that if one specific player hitbox overlaps several different enemy's hurtboxes, I need them each to register the collision only once.
Obviously, the player's hitbox shall remain active for x number of frames and shall not be destroyed upon collision.
With another programming language, I'll simply append the enemy's hurtbox Fixed value to a player hitbox "hit_registration" list, and check during overlap test that the hurtbox's Id is not already in that list.
I was thinking of doing this using a alterable string on the hitbox and add to it the fixed value of each hurtbox it collides against (which is essentially doing what I described above but with a string instead of a proper list) but string search are not really fast and optimized... Maybe someone has a better idea for this...?
Thanks a lot !