Hello Guest

Author Topic: Showing part of a sprite  (Read 5257 times)

mosquito

  • Newbie
  • *
  • Posts: 10
    • View Profile
Showing part of a sprite
« 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

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Showing part of a sprite
« Reply #1 on: September 25, 2013, 10:23:36 pm »
Try using a clipped sprite. That should pretty much do what you need it to.

mosquito

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Showing part of a sprite
« Reply #2 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

mosquito

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Showing part of a sprite
« Reply #3 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...

mosquito

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Showing part of a sprite
« Reply #4 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 :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Showing part of a sprite
« Reply #5 on: September 28, 2013, 06:11:35 pm »
No it doesn't copy the texture at all :)

mosquito

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Showing part of a sprite
« Reply #6 on: September 29, 2013, 10:51:33 am »
Ok, tnx!

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