0
我有9个不同场景的34个.png图像文件。每当用户挑选的那些9个方案1,并根据该予使用生成动画以下使用.png文件的动画cocos2dx
std::string name;
MixingScreen::animation = CCAnimation::create();
// load image file from local file system to CCSpriteFrame, then add into CCAnimation
for (int i = 0; i < 34; i++)
{
std::stringstream st,ii;
st << Constants::flav;
if (i<10)
{
ii<<i;
name="screen/screen02/fx/sugar/0" + st.str()+"/a_0000"+ii.str()+".png";
}
else
{
ii<<i;
name="screen/screen02/fx/sugar/0" + st.str()+"/a_000"+ii.str()+".png";
}
//sprintf(szImageFileName, "Images/grossini_dance_%02d.png", i);
MixingScreen::animation->addSpriteFrameWithFileName(name.c_str());
}
MixingScreen::animation->setDelayPerUnit(5.0f/34.0f);
action = CCAnimate::create(MixingScreen::animation);
CCCallFunc *done = CCCallFunc::create(this, callfunc_selector(MixingScreen::doneMixing));
CCSequence *readySequence = CCSequence::create(action,done,NULL);
particles->runAction(readySequence);
我面临的问题是,当该动画运行,有一个时间滞后(一切都停止几秒)然后开始动画。任何解决方案
'CCSpriteFrameCache :: sharedSpriteFrameCache()'现在已被弃用。改为使用'CCSpriteFrameCache :: getInstance()'。 – namezero