Attack and monster damage problem (2D)

I created a simple 2D attack sistem for my character and a basic monster that run and attack the player. The big problem I have is that i dont know how to let the monster take damage only by hitting the “sword” of my character. I didn’t find any guide concerning this.

I did something but is completely wrong because the enemy take damage even if it hit me from behind and the character dont get any damage.

This is how I set attack status and animation:

And this how monster take damage (here is the problem…)

How can i create a funtioning monster that take damage only from the character swords?

Could someone please tell me how to add specific hitbox (hurting one and simple colliding one) for each frame?

When you set the collision in the flipbook itself can you have it being around only the sword or no? Then only take damage when the characters capsule is hit. I’m making a 2d game but I’m not at this point yet.

Or you could add 2 boxs or capsules connected to the character and have it point in both positive X and negative X then an onOverlap if is Attacking is true(with a branch) cause the damage to the monster. Put in a get vector and get velocity so you can have it work to the left or right and not both at once.

Hope that makes sense.

The fact is that the attack pattern is not so simple and I would like to move the hitbox with the sword to avoid the monster to be hit before the animation has reached him. That was why i wanted to add a collision box on the sword every frame… but i dont know hot to do it. Something like in this video: