How to setup a simple animation system for 8Directions behaiour

  • 25 favourites


2,510 visits, 4,260 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

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!:)


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