cocos2d-x 动画加载 延时执行

来源:互联网 发布:sma4软件下载 编辑:程序博客网 时间:2024/05/19 20:57
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);
}
0 0