/********************************添加动画***********************************/
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("ui_finger0.png", "ui_finger0.plist", "ui_finger.ExportJson");//加载资源
cocostudio::Armature* finger = cocostudio::Armature::create("ui_finger");//创建动画对象
rootNode->getChildByName("FileNode_1") -> addChild(finger);//向场景添加对象
finger->getAnimation()->play("finger");//播放名字为finger的动画
/***************************************************************************/
/***************************根据cocostudio里面的骨骼动画节点名字创建**********************/
cocostudio::Armature* hero = node->getChildByName<cocostudio::Armature*>("ArmatureNode_Hero");
hero->getAnimation()->play("wait");
/******************************************************/
/**********************Action(动作)**********************/
MoveBy* moveBy = MoveBy::create(1, Vec2(200, 0));//对于节点对象的当前位置
MoveTo* moveTo = MoveTo::create(1, Vec2(200, 0));//绝对位置
auto delay = DelayTime:: create(1);//延时
auto seq = Sequence::create(moveBy,delay,moveTo,nullptr);//组合动画
auto mySprite = Sprite::creat("mySprite.png");
mySprite->runAction(seq);
/******************************************************/
最后
以上就是含蓄白云最近收集整理的关于cocos2d Armature的全部内容,更多相关cocos2d内容请搜索靠谱客的其他文章。
发表评论 取消回复