2D Toolkit Forum

2D Toolkit => Support => Topic started by: mosquito on September 25, 2013, 10:06:23 pm

Title: Showing part of a sprite
Post by: mosquito on September 25, 2013, 10:06:23 pm
Is there any way that I can show a fraction of a texture like for example a health bar that's on 45%...

I'm not implementing a health bar but it's the simplest way to explain my problem :)

So basically,  is there a way to show only a part of texture defined with a Rect or something like that?

Tnx
Title: Re: Showing part of a sprite
Post by: unikronsoftware on September 25, 2013, 10:23:36 pm
Try using a clipped sprite. That should pretty much do what you need it to.
Title: Re: Showing part of a sprite
Post by: mosquito on September 28, 2013, 12:42:39 pm
Tnx, should of figure out that by myself..

I got it working but need another feature. Is there a way to give clipped sprite a list of rects to be shown?
Because I want to have fractions of texture to be visible which are not connected to each other
Title: Re: Showing part of a sprite
Post by: mosquito on September 28, 2013, 01:20:29 pm
Or better yet can I use clipped sprite to make a new sprite from that clipped area?

That is actually what I need...
Title: Re: Showing part of a sprite
Post by: mosquito on September 28, 2013, 03:24:20 pm
Ok, discard all of my questions I got it working...

I made a prefab from tk2dclippedsprite and I'm instantiating as much as want.
I just hope they are not copying the texture each time...

Anyway, tnx :)
Title: Re: Showing part of a sprite
Post by: unikronsoftware on September 28, 2013, 06:11:35 pm
No it doesn't copy the texture at all :)
Title: Re: Showing part of a sprite
Post by: mosquito on September 29, 2013, 10:51:33 am
Ok, tnx!

Just wanted to say I love your product and support. Keep it up... :)