【基础】Cocos2d-x 使用 plist播放动画只显示静态图片

代码如下,网上到处都是这样的代码:

CCSpriteFrameCache *cache=CCSpriteFrameCache::sharedSpriteFrameCache();
cache->addSpriteFramesWithFile(“hero/idle/idle.plist”,“hero/idle/idle.png”);

CCArray *splitAniframe = CCArray::createWithCapacity(4);
CCSpriteFrame *frame;
char *frameNameChar = new char;
for(int i = 0;i< 4;i++)
{
sprintf(frameNameChar, “2001%d.png”,i);
frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frameNameChar);
splitAniframe->addObject(frame);
}

CCAnimation *splitAnimation=CCAnimation::createWithSpriteFrames(splitAniframe,0.2f);
splitAnimation->setDelayPerUnit(1.0f);

CCAnimate *splitAnimate=CCAnimate::create(splitAnimation);
CCSprite *testSprite = CCSprite::createWithSpriteFrameName(“20010.png”);
testSprite->setPosition(ccp(500,500));
addChild(testSprite);

testSprite->runAction(CCRepeatForever::create(splitAnimate));

  1. 如果我创建精灵的时候直接用 CCSprite::create( ),则什么都不显示。换了createWithSpriteFrameName,则显示第一张图片。
    这说明png图片是加载了,也间接的说明 plist文件也是一起可以读取的,但是为毛动画播放不了呢?

有人吗?求助!