Help with customizable animation

I need to have avatar customization in my game, where you can change both cloths and colors. How is the best way to do that?

I’m currently using DragonBones, and using the CCFactory’s replaceSlotDisplay to change the cloths, but one thing I can’t do is change the color. In 1.9 the color variable was there, but now is protected and it breaks in native.

Do I change to Spine? There is some other way to do that?

Can the Cocos Engine Team change the private slot.display._color variable to public? Or even is it possible to get the dragonbones github project and made a custom version of it? I coudn’t find the cpp library inside the engine.

Please, help, I’m completly lost on how to do it.

Hi, maybe you can refer to this document:

I am doing what this document says, and I said that.

What I’m trying to do is change a slot color, replace it I already know how.

One approach that I’m trying to do is already export the dragonbones with the nodes tinted, and then change the node sprite using the replace texture example. But in native, some things are wrong

Web (correct color configuration)

Android (Wrong color configuration)

Is it a bug or am I missing something? @pandamicro @jare

I’ve found the solution. To customize the color of the slot, do this:

var obj = JSON.parse(this.animation.dragonAsset.dragonBonesJson);
            obj.armature[0].slot.forEach(elem => {
                if ( == {
                    var dbColor = {
                        rM: Math.round(color.r * 100 / 255),
                        gM: Math.round(color.g * 100 / 255),
                        bM: Math.round(color.b * 100 / 255),
                        aM: 100
                    elem.color = dbColor;

this.animation.dragonAsset.dragonBonesJson = JSON.stringify(obj);

And re-load your armature, as if you loading an armature from resources. If in top of that you also will use the texture replace, do this, then replace-it. It will make it colored. But if you tint one node that already had the texture changed, it will reload the base armature, so be sure that the order is tint -> change.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.