My Cocos2dx version: 2.1.4
For example, there are two monsters in a game scene, I want one of monsters play animation “anim_eat”, the other play “anim_walk”.Here is my Code:
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCArmatureDataManager *pArmtureDataMgr = CCArmatureDataManager::sharedArmatureDataManager();
pArmtureDataMgr->addArmatureFileInfo("filname.png", "filename.plist", "filename.xml");
CCArmature *pArmWalk = CCArmature::create("ArmtureTag");
pArmWalk->getAnimation()->play("anim_walk", -1 , -1, 1);
pArmWalk->setAnchorPoint(CCPoint(0.5f, 0.5f));
pArmWalk->setPosition(winSize.width / 2.0f, winSize.height / 2.0f);
this->addChild(pArmWalk);
CCArmature *pArmEat = CCArmature::create("ArmtureTag");
pArmEat->getAnimation()->play("anim_eat", -1, -1, 1);
pArmEat->setAnchorPoint(CCPoint(0.5f, 0.5f));
pArmEat->setPosition(winSize.width / 3.0f, winSize.height / 3.0f);
this->addChild(pArmEat);
But actually, both of monsters are play “anim_eat”.
I exchange the code order of two animation, make “anim_eat” run before “anim_walk”.
The result is that those are play “anim_walk”.This means that which animation play is determined by the last Calling CCArmatureAnimation::Play().
Wow, Is my Code right?Or, Is a bug in Cocos2dx 2.1.4?