Main Menu

health bar

Started by fireside, October 21, 2010, 06:37:23 PM

Previous topic - Next topic

fireside

This is looking ahead, because I'm still working out re-scaling my program, but I'm thinking of ways to do a billboarded health bar.  So far, the idea I have is to have 10 health bars like for 10%, 20%, etc and switch them because I don't know how I could move the texture.  Any other ideas on that?
click here->Fireside 7 Games<-

raft

having one healt-bar object and 10 textures and instead of switching object, switch texture might be a better alternative

EgonOlsen

I would simply blit the health bar as a scaled blit on top of the entity (did this in Paradroidz for example). It doesn't have to be a real object nor part of the world IMHO.

fireside

#3
Quotehaving one healt-bar object and 10 textures and instead of switching object, switch texture might be a better alternative

My thoughts on that is there is a 256x256 minimum texture, and I could put all the textures on one panel, but that would mean different texture coordinates, so changing textures wouldn't work, unless you know some way to do that.  If you did, I could just move the texture coordinates on one health bar on a transparent background.  It possible to use smaller textures, but something gets done and it's kicking up errors once in a while for me, though not fatal.

QuoteI would simply blit the health bar as a scaled blit on top of the entity (did this in Paradroidz for example). It doesn't have to be a real object nor part of the world IMHO

I'm printing damage stats right now that way, and it's really hard to tell which character they apply to when they are close together.  I'm not sure if it would be any better with a billboard or not.  I just have a feeling it would as the character further away would have a smaller bar.  I guess I'll experiment with the two methods.

Thanks for the suggestions.



click here->Fireside 7 Games<-

paulscode

Another couple options if blitting doesn't work for you, if it is just a 2-color bar you could make a texture twice the width of the bar with the health color on the left half and the no-health color on the right.  Then just change the u/v coordinates to the right to lose health and to the left to gain health.  For more complicated graphics I would use frames tiled on a single "mosaic" texture and switch the uv coordinates as necessary (see my GIF texture project for an example).  This is what I'm doing for the HUD and shield strength pannels for the game I'm working on.  If you need help figuring out the uv switching code or setting up the texture let me know.

fireside

#5
QuoteIf you need help figuring out the uv switching code or setting up the texture let me know.

Yes, I need help with that.  I was trying to find some way of doing it but couldn't find any.  I had thought of having one side transparent and one side red.

edit: Just noticed your reference to the GIF project, I'll check that out first, thanks.
click here->Fireside 7 Games<-