CocosCreator 龙骨换装
龙骨换装
- 简介
- 简单切换插槽图片
- 代码
简介
这里实现简单的插槽切换图片功能,后续会增加动态加载添加插槽图片等等
简单切换插槽图片
插槽内有多张图片时使用此方法切换图片
代码
//拿到动画脚本
this.animation = this.mecha.getComponent(dragonBones.ArmatureDisplay);
//拿到当前动画的armature
this.armature = this.animation.armature();
//切换名字为hair1插槽下面的图片
this.armature.getSlot('hair1').displayIndex = 1
CocosCreator 龙骨换装
龙骨换装
- 简介
- 简单切换插槽图片
- 代码
简介
这里实现简单的插槽切换图片功能,后续会增加动态加载添加插槽图片等等
简单切换插槽图片
插槽内有多张图片时使用此方法切换图片
代码
//拿到动画脚本
this.animation = this.mecha.getComponent(dragonBones.ArmatureDisplay);
//拿到当前动画的armature
this.armature = this.animation.armature();
//切换名字为hair1插槽下面的图片
this.armature.getSlot('hair1').displayIndex = 1