Lately I have noticed, that animation control is often asked subject in the "How to"'s. Most of the time - just like I did - people stumble over the strange behavior of the Wait statement.
In this tutorial I'll try to show, how one can control animation purely based on events.
As in my last tutorial, you will find the complete artwork in the CAPX
The demo can be found here
Variables to control animation
To control the animation behavior two instance variables are used. One stores the direction in which the avatar is looking, the other hold the state of the animation.
Controling the Avatar
The mousebased avatar control is pretty simple and straight forward. Click left or right of the avatar to move, or direct on the tropper to stop it.
As you can see, the only thing that is influenced is the pendingAction status
Now, the fun part starts...
The Sprites for the animation
I am sure, that alot of you could do better with the animation and with the blending between them. Execuse me, that I did not spend alot of time to create the perfect sprites for this tutorial.
For the whole action in this tutorial, we need six different animation-rolls. Just take a look:
Use the crop transparancie button with the shift option to minimize the empty spaces around your sprite and try to set the image orition on all frames on the same spot - more or less.