8 direction sprite animation

8 direction sprite animation
0.0 0



I’m new to Cocos2d and I’m trying to create an Isometric perspective game. All my sprites and animation frames have been rendered from 8 different directions and I need to be able to choose the correct frame based on the direction a sprite is facing.

I thought I could create 8 animations (1 for each direction) and then play the appropriate one based on sprite direction. Unfortunately, this looks odd when the direction changes mid animation because the new direction animation is played from the first frame. For example: The run animation has 16 frames and shows the character stepping with left and then right foot. If the direction changes half way through the animation, it looks like the character is hopping on its left foot when it changes direction.

I could create my own CCAnimation classes that have 4 CCSpriteFrams for each CCAnimationFrame, but this doesn’t feel like the right approach.

What is the recommended way to do this in Cocos2d?


Just write your own animation class, it isn’t very much code.