cocos2dx plist动画

CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("bearlist.plist","bearlist.png"); 
   //从名字很容易看出,它是用来缓存图片的,内部封装了一个字典
    CCSprite*flowSprite=CCSprite::create();
    flowSprite->autorelease();
    CCArray*frames=CCArray::create();
    for (int i=0;i<<span style="color: #103ffb">6; i++) {
        char pngName[20];
        sprintf(pngName, "bear%d.png",i+1);
        CCSpriteFrame *frame =CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(pngName);
        frames->addObject(frame);
    }
    //生成CCAnimation对象 
    CCAnimation* animation =CCAnimation::createWithSpriteFrames(frames,1./6);
     //创建动画
//    CCAnimation* animation =CCAnimation::create(frames, 1./6, 1);

    frames->release();
    CCAnimate *animate = CCAnimate::create(animation);
    flowSprite->runAction(CCRepeatForever::create(animate));
    this->addChild(flowSprite);
    flowSprite->setPosition(ccp(200, 200));
原文地址:https://www.cnblogs.com/jiackyan/p/3019890.html