C
C
Creator God2019-10-13 03:28:34
C++ / C#
Creator God, 2019-10-13 03:28:34

How to make a sword strike in Unity 2D?

How to make the character hit the enemy when pressing a certain button in Unity.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GavriKos, 2019-10-13
@GavriKos

Obviously, write code. Lots of code.
Start with input detection - found in any unity tutorial.

K
Konstantin Kitmanov, 2019-10-13
@k12th

First you need animation, sprite or skeletal - depending on how the character is made. In the AnimationController, you need to allocate a separate state for this animation.
In the Update character script, we check if the button that is responsible for the sword strike is pressed, if so, we start the animation.
There should be enough keywords here to google the details.

D
dollar, 2019-10-13
@dollar

Make a hitbox .
I hope it's obvious what it is ( wikipedia ).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question