AnimatedSprite class for Cocos2D and TexturePaker
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


By Benoît Freslon:

Please send me feebacks ;).

##About Handle your animations with your spritesheets atlases with cocos2d-iphone 2.0. A simple class with simple methods: init, start, stop, restart, ...

The swf animations are converted and exported with TexturePacker for cocos2d-iphone 2.0.

See a tutorial example here: Tutorial: Export your Flash animations on iPhone/iPad with cocos2D and TexturePacker


##Get started

  • Include the AnimatedSprite.m and the AnimatedSprite.h into your XCode project.
  • Add a compiler flag "-fobjc-arc" in XCode on AnimatedSprite.m.


// Create the pig instance with a default sprite image
AnimatedSprite *pig = [AnimatedSprite spriteWithSpriteFrameName:@"pig_walk.swf/0000"];
// Init a looping animation
[pig addLoopingAnimation:@"walk" frame:@"pig_walk.swf/%04d" delay:0.05f];
// Init an animation
[pig addAnimation:@"dead" frame:@"pig_dead.swf/%04d" delay:0.05f target:self callback:@selector(removePig)];
// Add the sprite in the scene
[self addChild:pig];
// Start the walk animation
[pig startAnimation:@"walk"];

##Help See comments in AnimatedSprite.h