cocos2d 帧动画1

    CCSize size=CCDirector::sharedDirector()->getWinSize(); 
    CCSprite* sprite=CCSprite::create("s_1.png");
    sprite->setPosition(ccp(size.width/2,size.height/2));
    this->addChild(sprite);

    CCAnimation* animation=CCAnimation::create();
    char str[50];
    for(int i=1;i<9;i++)
    {
        sprintf(str,"s_%d.png",i);
        animation->addSpriteFrameWithFileName(str);
    }
    animation->setDelayPerUnit(0.1);
    animation->setRestoreOriginalFrame(true);
    //sprite->runAction(CCAnimate::create(animation));//执行一边
    sprite->runAction(CCRepeatForever::create(CCAnimate::create(animation)));
原文地址:https://www.cnblogs.com/yufenghou/p/3640314.html