Game Development Community

Shaped Health Bar

by Scott Warren · in Technical Issues · 03/15/2008 (2:20 pm) · 3 replies

I need a method to fill an odd shaped image with a color.

The current Health bar is rectangular and filled with a square background shape but this method means my health bar must also be square or rectangular.

Any advice?

#1
03/16/2008 (1:37 am)
I'm not dead certain I understand your question, first of all. But, what I did with my jetpack meter was I had 9 different PNG's for each state of the meter depletion, 1-9. Point being, you can use any PNG you want for your health bar, or for any of the states of it.

It's ghetto, but it works. If you don't screw it up :-)
#2
03/16/2008 (6:14 am)
Your method sounds good.
Just a quick question then. If your Jet Pack is upgraded and can therefore hold more fuel, do you need more .PNG files to incrementally fill it ?
See, i like your method but curious if this means many .PNG files for me.

Ok, i just completed a new Background Image in GIMP and Paint.Net.
What I now have is essentially a rectangular shape Image with 2 irregular shapes cut from it and those shapes are made Transparent.
This gives me the effect i was seeking. The Red health bar sits behind my PNG image and placed so that it appears to fill / deplete as normal.
However, the Blue bar will not sit behind my Image and behave as expected. The blue Bar will stay on top of my Image instead. GuiHealthBar is used for both Red / Blue colors. And I'm wondering if anyone might have experienced this problem and how did you fix it ?
#3
03/16/2008 (4:56 pm)
Hmmm, I could be wrong, but you may not be grasping my ghetto hack. Feel free to download my game (check my profile) and check out what I've done. I've included script source with the game :-)

Short answer: I have 9 possible jetpack states, and therefore 9 PNG's.

I say all this because I don't really understand your second problem, and I think it's possible that my method would fix that...I'm not sure sorry.