2D Toolkit Forum

2D Toolkit => Support => Topic started by: eklavyaa on December 18, 2014, 05:08:22 am

Title: How to add new Pant to the existing character.
Post by: eklavyaa on December 18, 2014, 05:08:22 am
I have a character with 10 frames. I have created a sprite collection for these 10 frames and using 2dtoolkits own animation I am animating it.
I understand that atlas is created for these 10 frames .
Now I want to change the appearance of the character say I want to apply new pant. How I can do it with minimal efforts, I mean do artist really need to develop another character with new pant and its 10 frames ?
Title: Re: How to add new Pant to the existing character.
Post by: unikronsoftware on December 18, 2014, 09:33:44 am
You can draw clothes on a separate sprite and draw it on top of your character sprite if you want. tk2d doesn't have any special features for this apart from the sprite attach points.
Title: Re: How to add new Pant to the existing character.
Post by: eklavyaa on December 20, 2014, 05:49:42 am
Quote
You can draw clothes on a separate sprite and draw it on top of your character sprite if you want

How to do it ?

What I was thinking is to change texture of the legs from current to the texture of pants , for all the 10 frames and then create atlas for these 10 frames to create animation and this will be done only when pant is finalized as the selection .

 Can this be done programmatically ?
Title: Re: How to add new Pant to the existing character.
Post by: unikronsoftware on December 20, 2014, 10:47:50 pm
You can do it using GetPixel / SetPixel with Unity textures.
Title: Re: How to add new Pant to the existing character.
Post by: eklavyaa on December 23, 2014, 07:46:49 am
Quote
You can do it using GetPixel / SetPixel with Unity textures.

So using these function if I want to change the shirt of the character: I will read the pixels which represent the shirt  , then set the pixels of selected shirt on this existing shirt .

But how to detect , which pixels represents shirt ?
and
how to get UV coords of these pixels ?


Title: Re: How to add new Pant to the existing character.
Post by: unikronsoftware on December 23, 2014, 10:44:08 am
Quote
But how to detect , which pixels represents shirt ?
and
how to get UV coords of these pixels ?

That is outside the scope of tk2d, you'd probably need to store that in a format you can read, and write out the atlas suitable for tk2d.