I need help to implement a one-side vulnerable enemy

Godot Version

Godot 4.7.2 stable.mono

Question

Hi everyone, I’m currently implementing a combat system in my 2d platformer game in which I want to have some enemies that are only vulnerable from one or two sides. My player is using 2 weapons: a sword and its fists. I want the sword to be very powerful, so that I can kill an enemy on one hit. As for the fist, things are getting more complicated. If I encounter an enemy with no defense, everything is okay. But if the enemy is armed with a spear and I’m attacking while facing him, my fist will hit the spear hitbox. At that moment I want my player to take damage, without applying any damage to the enemy, even if my fist touches its hurtbox :

If I strike the enemy from behind, and even if the fist hitbox touches the spear one, I should kill the enemy without taking any damage :

Do you have some clues on how to approach such a system, as I never did it in any game project ?

Thank you !

You could achieve that by clever placement of the hitboxes and hurtboxes. They don’t have to be exactly where the objects (bodies and weapons) are, but can just be a bit off. Tweaking these to give the game a good feel is normal.

Or you could use a combination of different hitboxes, if sole displacement doesn’t do it anymore.

If that also doesn’t do it, the next step of escalation would be to take the player’s or the enemy’s facing direction during attack and see if it fits your condition.

All three approaches would probably give you the right results. I would favor a simpler and more automatic solution like hitbox placement over more complex solutions which require more manual adjustment through code.

Typically fighting games will use overlapping hitboxes, it’s actually more common for the hurtbox to encompass the hitbox, hitboxes on their own like the spear in your example are called “disjoints” by players.

— from Ultimate Frame Data

You could (and maybe should) enable a hurtbox along with the player’s fist hitbox. If you want the back handle of the spear to count as a hurtbox then add that too.

Also a reminder that big blocky hitboxes (like the one I posted from Street Fighter 6) are good, players prefer hitboxes that match the feeling of the game and big boxes do that.

Excellent ! I’m considering your solution for my game, as it is really close to what I want to achieve.