Adding a lifebar above a scenenode

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Ced666
Posts: 86
Joined: Fri Jan 13, 2006 10:29 am
Location: Belgium

Post by Ced666 »

So what is the problem with using billboards then?
Yes ok, in this case the drawing is the problem :lol: (yes I know, I contradict myself but in the previous case, I knew how to draw and that was not my problem).
The problem with billboard is that I would like to draw the bar myself, so be able to give it a specific color (that can change depending on the health of the unit) or have a gradient in the bar (from green to red). Both solutions are not really nice with billboards: the first one doesn't work because you need to specify a texture that will be rendered for the billboard. Ok, I can still go for one single color (or maybe three) for all life bars but that won't be very nice.
The second solution: ok, I could have a gradient in my texture, but then, when I resize my bar (because of life loss) the texture will still be completely fitted inside the bar (so, the complete gradient will be there, from green to red). Hummm, very ugly also.

One option could be to go for two billboards: one with the gradient and one completely black to mask the first one (they need to be drawn in that order). I just thought at this solution now. It is not very elegant but if this is the only solution....
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

copy CBillboardSceneNode.* and make it do 5 quads instead of 1, 1 = nice smooth green corner, 2 = variable length green bar, 3 = fixed width green/red join 4 = variable length red bar, 5= rounded red corner.
in fact, i think i need one of those myself
edit: yeah i'm making one right now, my health and shield bars have looked fugly for too long
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Ced666
Posts: 86
Joined: Fri Jan 13, 2006 10:29 am
Location: Belgium

Post by Ced666 »

That's a very interesting solution. Yup, I think this will look nice.
Thanks for the tip :)
Post Reply