在龙骨中的Armature上绑定了一些帧事件,但是在CocosCreator中监听不到,看了官方的案例才明白是要用addEventListener监听Armature上的事件。
这里是给龙骨添加帧事件
给fall动画添加shooting事件
这里一定要把Animation Cache改为REALTIME才能监听到事件
//拿到动画组件
this.animation = this.node.getComponentInChildren(dragonBones.ArmatureDisplay);
//循环播放某个动画
this.animation.playAnimation("fall", 0)
//拿到当前动画的armature
let arma = this.animation.armature();
//在armature上添加监听
arma.addEventListener(dragonBones.EventObject.FRAME_EVENT, (event) => {
//TODO 这里写触发事件
//event.name为事件名称
console.log(event.name)
}, this)
本文地址:https://blog.csdn.net/a71468293a/article/details/107356891
如对本文有疑问, 点击进行留言回复!!
将音频文件转二进制分包存储到Redis的实现方法(奇淫技巧操作)
网友评论