(noob) Weapons in 2D game?

Hey I am a noob rying to find how things work in regards to weapons and colliders in a 2D game. I am messing around with top-down zelda type game and I was wondering how collider and collision works on a sword.

Would I just create the sword swinging animation with sprites like I do with movement? Or do you make the sword a separate object/animation with its own collider?

I am just kind of confused as how to you make it “hit” the enemy since it will be reaching outside the collider of the character.

Thank you

You’ve got a few choices. You could as you say attach the collider to an animated sword - or you could have 2 colliders on the character and move one of them as the animation progresses (you can do this with an animation you build to shape the collider or move it as the frames are animated).