0

我使用 cocostudio 创建一些动画导出文件,它有 .ExportJson 、 .plist 、 .png 。我使用以下代码在 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");

但是当我想播放 monkey_run 动画时,请使用:

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

动画是monkey_die!所以我改变了代码:

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");

我只是让跑在死前。我可以正确播放monkey_run。

我是 cocostudio 的新手。所以我认为这一定是导出文件的问题。我在 cocostudio 中使用了一些默认名称。其中哪一个会导致问题?

4

1 回答 1

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

于 2014-11-11T08:12:15.097 回答