How to setup a simple animation system for 8Directions behaiour

  • 23 favourites

Stats

1,234 visits, 2,732 views

Translations

This tutorial hasn't been translated.

Tools

The idea is to build a string that corresponds to the name of the animation you want to play. The only requirment is that you have a strict naming convention on your animations.

The first thing you need to do is to make sure your animations are properly named. I chose to do Action+Direction but you're welcome to use whatever feels natural to you.

Second, you check which direction the player is facing and add that to a global string (CurrentAngle):

Then you simply do conditions to check what the player is doing and combine the CurrentAngle with the right action to set the appropriate animation.

Note that in my particular example I have one arrow sprite called "Player" that drives the controls and behaviour and one sprite called "PlayerSprite" that performs all the visuals. On runtime I hide "Player" and set the "PlayerSprite" the same position as "Player".

You can download the example scene here

Hope this helps and good luck!:)

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!