cocos2d-x 動畫載入 延時執行
阿新 • • 發佈:2019-02-02
void SnatchDeveloper::hechengframeCacheAction()
{
CCArray * hechengFrames=CCArray::create();
for (int i=0; i<8; i++)
{
std::string fileNmae=CCString::createWithFormat("0%d.png",i)->m_sString;
CCSpriteFrame * frame=hechengframeCache->spriteFrameByName(fileNmae.c_str());
hechengFrames->addObject(frame);
}
CCAnimation * animation = CCAnimation::createWithSpriteFrames(hechengFrames,0.3f);
animation->setRestoreOriginalFrame(true);
CCAnimate * action = CCAnimate::create(animation);
hechengSpite=CCSprite::create();
hechengSpite->runAction(CCRepeat::create(action, 1));
hechengSpite->setPosition(ccp(pageIconBg->getPositionX()+430,pageIconBg->getPositionY()+290));
addChild(hechengSpite);
CCCallFuncN * funcll= CCCallFuncN::create(this, callfuncN_selector(SnatchDeveloper::setDelayTime));
CCFiniteTimeAction * seq=CCSequence::create(action,CCDelayTime::create(0.5),funcll,NULL);
hechengSpite->runAction(seq);
}
void SnatchDeveloper::setDelayTime(CCNode * node)
{
node->removeFromParent();
PITipsMrg::Instance()->setMessageBox("合成成功!",false);
}
{
CCArray * hechengFrames=CCArray::create();
for (int i=0; i<8; i++)
{
std::string fileNmae=CCString::createWithFormat("0%d.png",i)->m_sString;
CCSpriteFrame * frame=hechengframeCache->spriteFrameByName(fileNmae.c_str());
hechengFrames->addObject(frame);
}
CCAnimation * animation = CCAnimation::createWithSpriteFrames(hechengFrames,0.3f);
animation->setRestoreOriginalFrame(true);
CCAnimate * action = CCAnimate::create(animation);
hechengSpite=CCSprite::create();
hechengSpite->runAction(CCRepeat::create(action, 1));
hechengSpite->setPosition(ccp(pageIconBg->getPositionX()+430,pageIconBg->getPositionY()+290));
addChild(hechengSpite);
CCCallFuncN * funcll= CCCallFuncN::create(this, callfuncN_selector(SnatchDeveloper::setDelayTime));
CCFiniteTimeAction * seq=CCSequence::create(action,CCDelayTime::create(0.5),funcll,NULL);
hechengSpite->runAction(seq);
}
void SnatchDeveloper::setDelayTime(CCNode * node)
{
node->removeFromParent();
PITipsMrg::Instance()->setMessageBox("合成成功!",false);
}