CVP认证学习笔记--李天宇022使用animationEditor编辑帧动画

CVP认证学习笔记--李天宇022使用animationEditor编辑帧动画,第1张

概述本节课主要学习了如何使用Animation Editor制作帧动画和如何在cocosjs环境下加载这些帧动画。首先通过查阅资料: 添加骨骼文件信息,由骨骼数据管理器管理。采用ccs.ArmatureFileInfo这个类添加动画文件,然后添加动画层,然后播放哪一帧的动画。当然在此之前一定要在我们的配置文件中加入”extensions”,只有加入这个才可以用cocostudio的内容......还有

本节课主要学习了如何使用@H_404_1@Animation Editor制作帧动画和如何在@H_404_1@cocosJs环境下加载这些帧动画。首先通过查阅资料:

添加骨骼文件信息,由骨骼数据管理器管理。采用@[email protected]这个类添加动画文件,然后添加动画层,然后播放哪一帧的动画。当然在此之前一定要在我们的配置文件中加入”extensions”,只有加入这个才可以用@H_404_1@cocostudio的内容@H_404_1@......还有不能忘记在@[email protected]添加@[email protected] .png .Json文件。具体代码如下:
var HelloWorldLayer = cc.Layer.extend({
sprite:null,
isAttack:null,
ctor:function () {
this._super();
var size = cc.winSize;
cc.eventManager.addListener({
event:cc.EventListener.touch_ONE_BY_ONE,
swallowtouches:true,
ontouchBegan:this.ontouchbegan.bind(this),
ontouchmoved:this.ontouchmoved,
ontouchended:this.ontouchended.bind(this)
},this);
//添加动画文件
ccs.armatureDataManager.addArmaturefileInfo(res.ani_attack_Json);
//添加动画层
var ani = new ccs.Armature("NewAnimationAttack");
//添加标记
ani.setTag(100);
ani.setposition(size.wIDth/2,size.height/2);
this.addChild(ani);
return true;
},
ontouchbegan: function (touch,event) {
var ani = event.getCurrentTarget().getChildByTag(100);
//播放刚刚添加的动画
ani.getAnimation().playWithIndex(0);
this.isAttack=false;
//当动画播放结束后@H_404_1@,执行监听
ani.getAnimation().setMovementEventCallFunc(this.animationEvent,this);
return true;
},
animationEvent:function (armature,movementType,movementID) {
var size = cc.winSize;
if(!this.isAttack){
//移除之前的动画
this.removeChildByTag(100);
ccs.armatureDataManager.addArmaturefileInfo(res.ani_walk_Json);
var ani1 = new ccs.Armature("NewAnimationWalk");
ani1.getAnimation().playWithIndex(0);
ani1.getAnimation().s
ani1.setposition(size.wIDth/2,size.height/2);
this.addChild(ani1);
}
},
ontouchmoved:function(){

},
ontouchended: function () {
}
});

var HelloWorldScene = cc.Scene.extend({
onEnter:function () {
this._super();
var layer = new HelloWorldLayer();
this.addChild(layer);
}
});

最后附上作业链接:

http://www.cocoscvp.com/usercode/3355e343a7cf923a23fbfb9cbf9551b1b6e73f48/

总结

以上是内存溢出为你收集整理的CVP认证学习笔记--李天宇022使用animationEditor编辑帧动画全部内容,希望文章能够帮你解决CVP认证学习笔记--李天宇022使用animationEditor编辑帧动画所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1080529.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存