Hitbox Attack System Unity2D

2D Mobile Game

Objective: Create a Hitbox for player attack which will allow the sword to damage the enemies when it hits them

We add a 2d sprite which then will be used to wrap around the sword and move along with its movement, name it Hit_Box for clarity.

Now add a box collider to the created sprite and set the trigger to true so that we can hit the enemies and detect them as well.

Now create a attack animation in which we will make changes to the shape, size and direction of the box collider in hit box to match that of a sword.

And this is the result.

--

--

Unity Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store