These are all the images it takes to create this moving sprite along with adding both mouse and keyboard inuputs. The
concept of sprites is pretty straight forward. Play a sequence of images quickly to simulate the illusion of motion.
Each row is an index of images used to perform an action
Row 1 Idle
Row 2 Running
Row 3 Jumping
Row 4 Falling
Row 5 Attacking
Row 6 Hit
Row 7 Dying
The code on the left is the set of instuctions for running the index of sprites. Here it's refered to as aniIndex.
And as you can probably notice each constant, the all caps words, are also on the other image of code on the right.
The code on the right is in a Constants class that read an array of images in an index. the numbers next to the
constants refer to how many sprite images are in each constant. If you look at the sprites above you'll see that the
number of sprites in each line are the same for the given constant.
The code will cycle through each array if the critera is met. It may continue to cycle or stop after a single cycle.
For instance, if you attack the sprite will go ahead and initiate a cycle one time and stop. Most animations will do
this as most the time it isn't effecient for a program to continuously cycle through an animation.