cocos2dx运行从cocos studio导出的Json到动画
cocos2dx running exported Json from cocos studio into an animation
我正在尝试从CocosStudio读取/加载导出的JSON和资源(这是一个生成动画的工具)但是,当我试图加载或读取接缝,这不是任何类或函数,以加载此文件。我做了一个网络调查,我发现的都是废弃的代码或外部库等。认为:
auto animation animation = extension::ccSkeletonAnimation::createWithFile("FILE.JSON","FILE.ATLAS");
animation->setPosition((x+y));
animation->setAnimation("a",true);
this->addChild(animation,0);
上面的代码使用了一个类似于"cocosStudio"的外部工具,叫做"Spin"
有什么可以提供一些指导关于这个…?或者适当的类来设置一个JSON文件的动画?cocos2dx版本为3.1提前感谢!最好的问候!
我使用这段代码将动画从cocostudio导入到visual studio 12
cocostudio::Armature* armature;
ArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("DemoPlayer0.png","DemoPlayer0.plist","DemoPlayer.ExportJson");
armature = Armature::create("DemoPlayer");
armature->setPosition(ccp(visibleSize.width * 0.8,visibleSize.height * 0.5));
armature->getAnimation()->playByIndex(0);
armature->setScale(0.25);
this->addChild(armature);
或者您可以在cocostudio的帮助部分查看此代码。
//async loading export file
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("Cowboy0.png","Cowboy0.plist","Cowboy.ExportJson");
//Creat armature by name
CCArmature *armature = CCArmature::create("Cowboy");
//play animation by animation index
armature->getAnimation()->playByIndex(0);
//Change Permissions
armature->setScale(0.5f);
//Set the armature position
armature->setPosition(200,300);
//add to the current scene
this->addChild(armature,2)
相关文章:
- 在执行其他功能的同时播放动画(LED矩阵和Arduino/ESP8266)
- 在c++中使用nlohmann从类到json的转换
- C++json插入数组
- nlohmann-json将一个数组插入到另一个数组中
- 如何使用curlpp通过POST方法上传文件和json数据
- JSON转换为nlohmann JSON-lib中的结构数组
- NLOHMANN 的 JSON 库将数组转换为结构向量
- 在nlohmann json中,如何将嵌套对象的数组转换为嵌套结构的向量
- 如何在 nlohmann 的 json 库中获取数组长度?
- UE4 C++ 我无法将 JSON 嵌套值获取到 TArray
- 使用 GLUT 使用键停止动画?
- 如何在特定位置追加 json 文件
- 有没有办法让编译器在我放置字符串而不是 nlohmann::json 对象时抛出错误?
- 使用 jsoncpp 解析 json 数组字符串
- 将 FlatBuffer 对象序列化为 JSON,而不使用其架构文件
- 使用对象数组对 SFML 进行动画处理
- (SFML)按下键时,播放器构造函数未使用正确的动画进行更新
- 如何在 c++ 非托管代码中反序列化 byte[] 的 json 字符串?
- 使用 cmake 生成 compile_commands.json
- cocos2dx运行从cocos studio导出的Json到动画