Creating Frame Animation in Cocos2d-X 2.0 Using a Sprite Sheet   2 comments

Since the Cocos2d-X 2.0 rc2 a lot of the initialisation has changed so this code works in Cocos2d-X 2.0.

First create a sprite sheet so we can load it in.

Once you have created the Sprite Sheet you will end up with a image file and plist.

mySprites.png
mySprites.plist

I like to name my sprites like this:

jumpAnimation_00
jumpAnimation_01
jumpAnimation_02
jumpAnimation_03
jumpAnimation_04
jumpAnimation_05

walkAnimations_00
walkAnimations_01
walkAnimations_02
walkAnimations_03
walkAnimations_04
walkAnimations_05

It makes creating the animations easier. My code below is depended on the above naming convention.

Posted July 28, 2012 by abe in android, cocos2d-X, cocos2dx, cpp, Games Development, iOS, iPhone, Mobile, plist

Tagged with

2 responses to Creating Frame Animation in Cocos2d-X 2.0 Using a Sprite Sheet

Subscribe to comments with RSS.

  1. Good! could be please post how to apply this animation on multiple sprites, like gold coins , collectables ?

    • Since the sprite is a pointer you would need to create a class that generates a new instance when requested. When I have some time I will knock out a post with an example.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">