#Sprite subimages / 9-slice scaling

5 messages · Page 1 of 1 (latest)

left flame
#

Not sure what best to title this, but in case it's an XY problem I figure I'd start at the root. I'm not sure what terms to search.

I'm playing around with health bars. I have a collection of assets for this from humblebundle, I have backgrounds/borders and foregrounds. The 'interesting' ones, have patterns on the ends (making the health bar look like a pill 💊 ).

What I've tried is just scaling the x axis as health decreases, but naturally this begins to look odd when health gets lower.

What I'd like to try is 9 slice scaling, or just cropping the end of the image. However idk if I'm on the right path, or how to implement it in bevy.

left flame
#

Some images for reference. I could try splitting up the background/border into two separate images, and having it so the border is on top of the bar

late latch
#

indeed, it's called 9-slicing

#

there's a PR adding that which might land in the next bevy release (.13)