Skeleton Damage Animation
Making our Skeleton Enemy respond to sword attack
Since we are working with the Attack Sequence for the player, we might as well add in some player feedback when the enemies are being hit by the player sword. To achieve this we are going to use an Hit Animation that will be triggered during any state and toggled by the On Trigger Event of the hitbox component.
Prepping the Hit Animation:
Following the same procedure since we have started this project, by importing the animation sheet and slicing it according to the cell size. Then Create a new animation state for the Skeleton and call the animation “Hit”. Drag and drop the entire Hit animation sequence into the dope sheet so we can have a proper hit animation.
In the Animator window we are going to create a new parameter Trigger called “Hit” and this will be the condition to toggle the animation. Since being hit can happen during any state of the Skeleton animation cycle, we can use the “Any State” state for the transition.
In the next article we will learn how to use Another type of object orient scripting called polymorphism that brings the damage function into the our game.