We will create a control that will handle the animations of a character. It will follow jMonkeyEngine's control pattern and extend AbstractControl
. We won't actually use most of the functions of AbstractControl
right away, but it's a neat way to offset some of the code from a possible Character
class. It will also be easy to add functionalities later on.
To create a control that will handle the animations of a character, perform the following steps:
Create a class called
CharacterAnimationManager
and have it extendAbstractControl
. This class should also implementAnimEventListener
, whichAnimControl
uses to tell our class when animations have finished playing.We're going to map Jaime's animations into an enum. This is so we don't have to do a lot of string comparisons. While we're at it, we'll add some basic logic to the enum as well. The name of the animation, whether the animation should loop or not, and the time
AnimControl
should take...