- Home /
Good method to display and control a life bar like in Megaman X games?
Hi!
I wonder how should I make a lifebar like this? (picture below, the left one.) What is the most efficient way? I don't want unnecessary drawcalls.
My player's health is stored as an integer. I want to represent the player's health with horizontal bars like in this picture instead of a long, continous bar. Also, I want to stay at this pixelated look, because my game itself will be retro pixelated style (the textures, not the screen itself, I have Unity Free, so I can't use pixelation image effect)
I know about the alpha cutoff method. Is it suitable for this? If yes, how? Or is there an other, better way?
Note: sorry, if it is answered somewhere else on this site, search function didn't respond and gave me error code 504

Yes, use the cut-off method as given by Eric5h5 here : http://answers.unity3d.com/questions/14770/creating-a-circular-progressbar-timer.html
Use a back texture for the outline, then a separate texture for your yellow filler bars. Then use the alpha cutoff effect on the yellow indicators. You could get clever and make your alpha cutoff texture in segments rather than smooth linear, so that you don't get part of the yellow bars showing. Or modify the cutoff command so it only modifies the texture when the values line up with the next yellow bar.
Your answer