In previous posts I talked about basic and procedural animations of the main character and his abilities. Now it is time to talk about different attack animations and some other contextual animations.

Attack!

In King, Witch and Dragon character can attack from 3 different states:

  • on the ground
  • in the air
  • from the wall or ceiling

Ground attacks

When on the ground the main character can attack in front of him or perform attack upwards, e.g. to kill airborne enemies or deflect projectiles.

Since the sword of the main character is called Talon blade and has shape of the talon or claw I wanted to make not just standard sword slash animation, but something more like ripping open or tearing up. Thats why slashes go from down position upwards.

To avoid situation when character comes back to idle pose after each animation to start the next one I made 2 animations - swing from the left and swing from the right. This allows to loop them in a simple combo and they blend seamlessly one to another.

Also for each animation I made variations on slopes (attack down slope and up to slope). Now animations always aligned with the surface that the character is standing on and prevent situations when the character is swinging his sword above the enemy that is standing down the slope.

Ground attacks

Air attacks

For the air attacks I used the same approach, but I also added downward attack to attack enemies that are below character and to perform pogo-bounce from enemies and spikes.

Air attacks

Attacks on walls and ceiling

The situation is slightly different when the character is on wall or ceiling.

When he is crawling using spider legs he is always facing camera regardless of moving direction.

From this state the character can attack in 4 directions (left, right, up and down) but only if there is no wall or ceiling on the way. Also character cannot perform combos, so he has to go back to idle pose before next attack, which means intervals between attacks are longer in this state.

Wall attacks

Contextual animations

When I was working on character animations I also extended functionality of character controller and added several new animations depends on the current context.

Bat wings glide

I was analyzing and comparing all character abilities and I ended up with conclusion that double jump (bat wings) is much less valuable for the player compared to other abilities (e.g. bot dash and grappling hook allowed to cover much longer distances and attack enemies meanwhile).

So I added ability to glide after jump (or double jump). Now character can fly over big chasms and reach places that are unavailable with other abilities.

Bat wings glide

When I posted this gif in my social networks, people in comments pointed out that it would be cool if character would prepare to land somehow. I really liked this idea and implemented close ground detection that works both for ground and wall landing.

Glide landing

Sliding down steep slope

In a normal situation, when the character lands on a steep slope (more than 45 degrees) the spider legs appear and the character can continue moving in the desired direction. But what if character doesn’t have spider legs? Well, he has to slide down and I had to make an animation for this.

Sliding down the slope

Ledge climbing

In some platformer games it is really frustrating when your character missed a couple pixels to land on the platform and fall down.

To avoid this situation I added ability to grab and climb a ledge in case when character’s jump length wasn’t enough. This also works when character need to climb a high platform but his jump height is not enough.

Ledge climbing

Death and respawn

Even though there are no enemies yes and nobody can kill the main character I made death and respawn animations for him. The idea to make it using rats came long time ago along with other “witchery” abilities, because rats are also can be related to witches alongside with bats, spiders and snakes.

It didn’t make a lot of sense to make just pure animations without FX, so as an exception I made FX for these animations.

Death

Respawn

All the rats are particles animated by vertex shader. No bones, no keyframes, only shader.

I wrote tutorial on how to create this shader and how to animate simple creatures using it.

Summary

At the moment I finished with character’s animations. To summarize my work here are some stats.

  • the main character has total 52 animations, including main animations, slope variations, additive and override animations

Animations list

Animation Controller has:

  • 3 sub-state machines
  • 25 states
  • 11 Blend trees
  • 24 parameters to control transitions between states

Script MainCharacterAnimations.cs contains 574 lines of code.

What’s next?

Most likely I will come back to character’s animations, but when I will have more context. Right now I plan to switch to something else. Probably antivania level blocking - the level that can be completed with any combination of character’s abilities.


To support project please add King, Witch and Dragon to your Steam Wishlist. To get more updates and materials about the project follow me on Twitter and Instagram.