Hello, i need your advice, what are you doing when you need to animate something? What are the steps? what programs do you use? How do you implement it in your code?
Currently, my steps are:
-
paint some frames, same size.
-
generate one .plist and one .png file from zwoptex flash version
-
include them to resources
-
run it with the code:
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(“texture0.plist”);
CCSpriteBatchNode *spritesheet = CCSpriteBatchNode::batchNodeWithFile(“texture0.png”);
layer->addChild(spritesheet);CCMutableArray frames = new CCMutableArray;
for (int i = 1; i <= 8; i++)
{
stringstream s;
s<<“pic”<addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(s.str().c_str()));
}
CCAnimation animation = CCAnimation::animationWithFrames(frames);
CCAnimate theAnim = CCAnimate::actionWithDuration(1.8f, animation, true);
CCAction runAction = CCRepeatForever::actionWithAction(theAnim);CCSprite* plrSprite = CCSprite::spriteWithSpriteFrameName(“pic1.png”);
layer->addChild(plrSprite);
plrSprite->runAction(runAction); -
done.
What do think of this ^^? If you know more efficient way to create animation, please share. Thank You.