是这样小弟打算实现一个变身功能
void Runner::changeModel(const char* modelname)
{
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo(“fish-040.png”,“fish-040.plist”,“fish-04.ExportJson”);
if(this->mLayer)
{
if(armatureBody){
armatureBody->removeFromParent();
this->mLayer->removeChild(armatureBody);
//armatureBody->release();
//armatureBody = NULL;
}
armatureBody = cocos2d::extension::CCArmature::create("fish-04");
initBody();
initShape("running");
armatureBody->getAnimation()->playByIndex(0);
armatureBody->setPosition(100,100);
mLayer->addChild(armatureBody);
}
}
可是总有问题 就是我的armature更换失败了 造成了armatruedate的数据野指针 应该是我使用方法不对造成的 求指导