This is kind of pathetic, but I will need help making it a 3-frame animation, considering everything I am trying jacks up the process, this is the code that actually runs the 2-frame animation while the player is walking:
if (dir == 0) {
sprite = Sprite.playerF;
if (walking) {
if (anim % 40 > 20) {
sprite = Sprite.playerF_1;
} else {
sprite = Sprite.playerF_2;
}
}
}
The variable
dir is used to keep track of what way the player is facing, in this case it is equal to zero, which will display them going up on the y-axis (forward).
The variable
anim is short for animation, which I am using to get the 2-frame animation by getting the remainder (using a modulus '%' for those who don't know).