A character is created and want to show in cocos2d-x,but it disappears after change action from "idle" to "atk", the runtime animation,it is the runtime screen recording:
mon10_mov_fail.zip
It is the .spine and .json,.atlas,.png to use:
mon10_failed.zip
it is the code to run the character,which changes the animation from "idle" to "atk" after 5 seconds
bool HelloWorld::init(){
if ( !Layer::init() ){
return false;
}
addChild(LayerColor::create(Color4B(255,255,255,255),Director::getInstance()->getVisibleSize().width,Director::getInstance()->getVisibleSize().height));
spine::SkeletonAnimation* skeletonAnimation = spine::SkeletonAnimation::createWithFile("mon10_anim2.json","mon10_anim2.atlas",1);
addChild(skeletonAnimation);
skeletonAnimation->setPosition(Director::getInstance()->getVisibleSize()/2);
skeletonAnimation->setAnimation(0,"idle",true);
runAction(Sequence::create(DelayTime::create(5.0),CallFunc::create([=]{
skeletonAnimation->clearTracks();
skeletonAnimation->setAnimation(0,"atk",false);
}),NULL));
return true;
}
I tried change the pre computed alpha option of output,but the problem still occurs,why?
The designer said they solved the problem by "moving some layer from top to bottom"(I don't know what they say), it is the corrected screen recording:
mov10_mov_normal.zip
It is the file to use:
mon10_normal.zip
also the code (only changed file name):
bool HelloWorld::init(){
if ( !Layer::init() ){
return false;
}
addChild(LayerColor::create(Color4B(255,255,255,255),Director::getInstance()->getVisibleSize().width,Director::getInstance()->getVisibleSize().height));
spine::SkeletonAnimation* skeletonAnimation = spine::SkeletonAnimation::createWithFile("mon10.json","mon10.atlas",1);
addChild(skeletonAnimation);
skeletonAnimation->setPosition(Director::getInstance()->getVisibleSize()/2);
skeletonAnimation->setAnimation(0,"idle",true);
runAction(Sequence::create(DelayTime::create(5.0),CallFunc::create([=]{
skeletonAnimation->clearTracks();
skeletonAnimation->setAnimation(0,"atk",false);
}),NULL));
return true;
}
The designer said they want to solve the "layer problem" instead of continue using this "working example" because some effect can only be done by the above failed example, can anyone give some suggestions to that?
I tried to pull the most update spine from git and install but the problem still occurs,can anyone help?
asked the designer again,they said the problem seems appear if there is layer order change in the action, but I am not very understanding what it means, can anyone help?