Changing the color of a game object (SOLVED)

Hey guys!

I’m wondering if it is possible to generate game objects with different colors in defold (according to RGB color models).

Thank you!

Your question isn’t really clear, a game object in Defold is more like a null object or empty transform. It is the components of the game object that you can color. And you can color/tint many components with something like sprite.set_constant("#sprite", "tint", vmath.vector4(1, 0, 0, 1)).

It would probably be easier to help you if you are a bit more specific in what you want to achieve. :slight_smile:

5 Likes

Sorry about being unclear. Yeah this is exactly what I meant!
Thank you so much :grinning:

2 Likes

Sorry for asking too many questions.

I now know how to change the tint of the components of a spine object.
For example: go.set("#spinemodel", “tint”, vmath.vector4(1, 0, 0, 1))

However, my new question is: Can we actually change the tint of only specific parts of the spine model?
Example: I only want to change the color of the body of a specific character.
But the atlas and images don’t have an id
Let me know if you need more clarification
Thanks

To my knowledge you can’t programmatically tint individual bones, maybe @sicher know if there is a way?

You should however be able to tint the images in the spine animation file. Then you could trigger the tint as an animation.

1 Like

But that would only work if you know before hand what colors you want to tint the object with, right?
In my case I want the tint to be a random color, based on certain inputs.

I made things workout by having multiple spine models per object. That way I can separate the body from the rest and tint the body only and leave the rest unchanged!