- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
图层 Layer Layer实际上是带有额外信息的骨骼图片块 Layer对原有矩形图片块做了各种变换操作,如旋转,缩放等 在Cocostudio中 骨骼也是一种Layer Animation 动画 Animation就是连续播放的一系列Frame。一个动作中,每个Frame都有delay,表示在播放动作时这个Frame要持续画在屏幕上多少次。 显示过程 每个Layer的显示过程分为三个部分——提取信息、计算数据和绘制图片 对大图的处理会经过多次剪裁实现 使用Armature编辑器 1创建骨骼 2绑定图层 3创建帧和关键帧 4添加动画 5导出文件 在战斗场景加入骨骼动画C++ ArmatureDataManager::getInstance()-addArmatureFileInfoAsync(armature/Cowboy.ExportJson, this, schedule_selector(TestAsynchronousLoading::dataLoaded)); ArmatureDataManager::getInstance()-addArmatureFileInfoAsync(armature/hero.ExportJson, this, schedule_selector(TestAsynchronousLoading::dataLoaded)); armature = Armature::create(Dragon); armature-getAnimation()-playWithIndex(1); //播放第二个动画 armature-getAnimation()-setSpeedScale(0.4f); 在战斗场景加入骨骼动画lua ccs.ArmatureDataManager:getInstance():addArmatureFileInfoAsync(armature/knight.png, armature/knight.plist, armature/knight.xml, dataLoaded) ccs.ArmatureDataManager:getInstance():addArmatureFileInfoAsync(armature/weapon.png, armature/weapon.plist, armature/weapon.xml, dataLoaded) local armature = ccs.Armature:create(bear) armature:getAnimation():playWithIndex(0) 设置骨骼动画的播放速度 C++ armature-getAnimation()-setSpeedScale(0.4f); Lua armature:setScale(0.2) 侦听动画播放完成事件C++ armature-getAnimation()- setMovementEventCallFunc( CC_CALLBACK_0(TestAni::animationEvent, this)); addChild(armature); void TestAnimationEvent::animationEvent( Armature *armature, MovementEventType movementType, const std::string movementID){ if (movementType == LOOP_COMPLETE) { if (movementID == Fire) { 侦听动画播放完成事件Lua armature:getAnimation():setMovementEventCallFunc(animationEvent) local function animationEvent( armatureBack,movementType,movementID) local id = movementID if movementType == ccs.MovementEventType.loopComplete then if id == Fire then 。。。。。。 end end end 动态修改骨骼显示Node C++ std::string weapon[] = {weapon_f-sword.png, weapon_f-sword2.png, weapon_f-sword3.png, weapon_f-sword4.png, weapon_
原创力文档


文档评论(0)