0

I use cocostudio to create some animation export files , it has .ExportJson , .plist , .png .And I use following code to load it in cocos2dx 3.2:

cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_die/monkey_die.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_jump/monkey_jump.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_run/monkey_run.ExportJson");

But when I want play the monkey_run animation use :

cocostudio::Armature * armature = cocostudio::Armature::create("monkey_run");
addChild(armature);
armature->playWithIndex(0);

The animation is monkey_die! So I change the code :

cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_run/monkey_run.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_die/monkey_die.ExportJson");
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("monkey_jump/monkey_jump.ExportJson");

I just let run in front of die . The I can play the monkey_run correctly.

I'm green hand to cocostudio. So I think it must be the export files' problem . I use some default name in cocostudio. Which of them can cause the problem?

CodeSmile
  • 64,284
  • 20
  • 132
  • 217
zzy
  • 1,771
  • 1
  • 13
  • 48

1 Answers1

1

I got this resolved recently. It is because the same image file name. For example, in your three animations, you may have this file: monkey_head.png. Try to rename the image file into different names, like monkey_head_die.png, monkey_head_jump.png. And do the same thing for rest of images. Hope it helps.

Leo

Leo Liu
  • 26
  • 1
  • Yes , I have found it after I changed every pic resource name in plist and json files :-) – zzy Nov 12 '14 at 03:13