Irregular Health Bar

Started by
16 comments, last by bluelobster 14 years, 3 months ago
Hello, So I have an irregular health bar and I am trying to figure out how to render/animate it properly. What are some ways this is usually done? In the past I have always just used a uniformly colored rectangle that I can grow and shrink as need be... But in this case my bar isn't a rectangle and it isn't uniform (i.e. there are different colors etc). Any advice would be greatly appreciated. Best regards, Josh Here is what my bar will look like: Photobucket
Advertisement
That's a static view, but what do you expect it to look like when displaying different health values? Do the circle shrink/grow, change colour, appear/disappear, or something else?
Yeah so that would be full...

What I want to happen is as you lose health the circles will "drain" of green color...make sense?
That isn't nearly descriptive enough.

Try drawing a picture of what the bar should look like at 0% health, at 10%, 20%... up to 100%. And what's this about "animation"?
Quote:Original post by Zahlman
Try drawing a picture of what the bar should look like at 0% health, at 10%, 20%... up to 100%. And what's this about "animation"?
In fact, if you do that, the algorithm for describing them at any % value should become clearer.

90% of the battle when designing software is coming up with precise requirements in the first place. Once you've got that, the implementation will usually just fall into place.
Well it seems to me it is a pretty standard health bar animation/function...

Here is what it would look like as us lose health for example (these are just random snap shots)

Photobucket

Photobucket

Photobucket

Photobucket

Photobucket

And obviously as you get health it would fill back up.

So imagine that the entire bar represents 100% each percentage point lost would cut off a 1% slice of the whole, make sense?

As I said earlier this would be simple if the bar was just a rectangle as I could just scale it depending on how much health the player has...but in this case scaling doesn't achieve the correct effect.

@Zahlman - I guess what I mean by animation isn't really animation but if the player loses health you should see the health reduce in the bar. So if the bar is |----| and let's say getting hit removes three ticks you wouldn't just see |-| immediately you would see (over the course of a second or so: |---| => |--| => |-|
Hmm, I had a very different idea in my head. I honestly don't see where the difficulty is, here...

So create a texture with the "full" bitmap, and then just render the left-hand size of it, proportional to the current health value.
Quote:Original post by Codeka
Hmm, I had a very different idea in my head. I honestly don't see where the difficulty is, here...

So create a texture with the "full" bitmap, and then just render the left-hand size of it, proportional to the current health value.


"left-hand size of it"? I'm sorry I don't understand. Can you clarify?

Are you saying I have to mask out the area of lost health?
Well it depends on lot on how you're drawing things to begin with. Are you using textured quads, or a 2D library such as SDL or something else? Whatever you're using, there will be some method for drawing only a subset of an image.
Yeah currently I am using a single textured quad...

Maybe it is easier to think of the health in a contaner:

Photobucket

So as you gain and lose health my original image would grow and shrink within this.

Like this:

Photobucket

This topic is closed to new replies.

Advertisement