我使用以下代码运行动画
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("kid1.plist");
CCSpriteBatchNode *spritesheet = CCSpriteBatchNode::create("kid1.png");
this->addChild(spritesheet);
CCArray *kidframes = new CCArray;
for(int i=1; i<3; i++){
CCString *filename = CCString::createWithFormat("kid%d.png",i);
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(filename->getCString());
kidframes->addObject(frame);
}
CCAnimation *runanim = CCAnimation::createWithSpriteFrames(kidframes, 0.1);
CCSprite *kiddo = CCSprite::createWithSpriteFrameName("kid2.png");
kiddo->setPositionX(100*setScreenX);
kiddo->setPositionY(100*setScreenY);
kiddo->setScaleX(setScreenX);
kiddo->setScaleY(setScreenY);
CCAction *action = CCRepeatForever::create(CCAnimate::create(runanim));
kiddo->runAction(action);
spritesheet->addChild(kiddo);
当我将帧添加到儿童帧 CCAssert(m_uReference > 0, "reference count should greater than 0"); 有什么帮助吗?