This is the enemy that I have made for the game that is able to kill the player, this is practically the exact same as the Cowboy with colours changed and a bandana. Honestly making the colour change the only difference probably saved me a lot of time and effort and I think he looks suitable for the role of Robber/Bad Guy.

For the Robber sprite animation, I took the walking animation from the Cowboy and changed the colours and made two more basic animations which are the Robber showing that he's been hurt/hit and the Robber being dead.
The Robber doesn't need as many animations as the player/Cowboy as they are merely an object and don't have a need to be controlled or really appear lifelike. The Robber will be a patrolling enemy hence the need for him walking and as he's an enemy he needs to die. The hurt animation is just a visual indication for the player to show that he has been hit.

This is the sprite sheet that I've had to edit to make it possible to be able to see the full hurt cycle, when the enemy is hit with the lasso he will stand still and flash white for a moment and when he's been hit enough times to die he lays on his side when dead. These are 3 simple animations. I do the same as I did with the Cowboy animations where I make them into little clips and save them then I take the clips to the Animator where the transitions, parameters and conditions are set up.

As you can see there are not as many transitions for the Robber, again this is due to him not needing as many animations. Again with the Robber, he has an Entry animation but for him, he starts off with walking. This enemy is a patrolling enemy which means that he will be patrolling(walking) on a platform or the ground. And for the other two animations; one can be played from Any State(Robber Hurt) and the other can only be played if the Robber is hurt(Robber Death). I've made it so that even if the Robber is hurt he will still continue to walk until he is dead and once he dies he will not be able to walk.
I've made three Parameters for the Robber which consists of 2 booleans and a trigger. The plan for these 3 is to make if statements that check if the booleans are true or false and depending on that the animations will play. And for the trigger, the trigger is activated when a condition is met, such as the Robber taking damage. Now that the variables have been created I have to add the parameters to the transitions between the animations. The Parameters are recognised as Conditions when linked between animations.
from Any State to Robber Hurt = Robber needs to take damage for the trigger to work.
from Robber Hurt to Robber Dead = isDead is True. When the Robber is hurt enough he will die.
from Robber Hurt to Robber Walk = isDead is False. If the Robber is not dead then he should go back to walking.
Now that my animations have all been coded and linked up I am able to test and make sure they work okay. I have recorded a video demonstrating the animations.
There is a bug with the Robber where he falls through the map, I have solved the issue but I will explain how I have done that in my blog regarding the programming this is just to show that the animations are working as they are supposed to be.
https://www.piskelapp.com/user/4731559194132480/public This is the link to access the full animations for the Robber.
Comentarios