Now, let's learn how to create a simple attack animation clip for our sprite character using keyframes instead of a spritesheet.
Keyframe animation is a complex topic, and we cannot fully address it in a single recipe. Nevertheless, we'll use this opportunity to cover the basic principles so that you can get a grasp of the procedure.
Again, we keep up from where we left. Have your project open and be ready to follow our instructions.
Set the time line at frame 24 (by setting the value as we did before). Then click on the small button with a rhombus and a + icon to add a keyframe at second 24. Please refer to the following screenshot:
With respect to its general principles, keyframe animation is easy to understand, as it consists of setting keyframes and then moving single body parts in the position we want at that keyframe. Unity takes care of making the transitions between frames so that at the end of the animation process, we perceive a meaningful sequence instead of a collection of static frames.
The hard part comes with tweaking the animations to make them part of the characterization, which goes beyond the scope of this book.
The interface of the Animation panel may not look friendly at a first glance, so we recommend repeating this last group of recipes and creating an animated orc with the other sprites available in the sprite atlas we have provided.
We have just scratched the surface of animation and keyframe animation here, as several other options and tools are available; for example, transitions between frames can be adjusted using curves to slow movements down (or speed them up), and make animations nicer and more believable. Animation curves have recently gone legacy (so they are still supported but not recommended anymore), but the manual at http://docs.unity3d.com/Manual/animeditor-AnimationCurves.html still provides all the explanations you will require to make the most out of them.
For those of you who are interested in animation in general, we recommend the following links to begin with:
Dudes, animation is massive topic!
There is also this link that I love, at http://the12principles.tumblr.com/.
Last, but absolutely not least, is the king of animation manuals: The Animator's Survival Kit by former Disney's Richard Williams. It is available at popular online stores.
18.118.163.250