ID:169613
 
I'm trying to figure out how to make my HUD system feature health similar to that seen in Zelda.

To those not familiar with the Zelda HUD, it shows a series of hearts, that can be divided in to fourths. You can have 3 hearts, 3 1/4 hearts, 3 1/2 hearts or 3 3/4 hearts.

I was wondering how this would be executed in a HUD system making each "heart" a different object.

Thanks.
How about making on object representing entire health. Giving it a list to hold each heart the player has. When a player is at full health, each heart object is at full health. If they're hit, reduce the last heart in the lists health, and call a proc to update it's look based on it's health. If there is an overdosage of pain, and a heart goes empty, return a carry over value for the next to last heart. Then, for death, just wait until every heart in the list is empty.

Prodigal Squirrel
In response to Prodigal Squirrel
How do you check which heart is last in the list?

and

How do you check when all the hearts in the list are empty?

Thanks.
In response to FireEmblem
Well, you could use associative lists.
And, to see the last item: list[list.len].
In response to Hell Ramen
'associative' lists? o.o
In response to FireEmblem
Like.
var/list/l=list("heart1"=4,"heart2"=4,"heart3"=3,"heart4"=0)

Something like that would work.
In response to Hell Ramen
Ah, thanks.

Okay, so in my HUD code right now I have

<code> client/New() new/obj/Main/a(src) new/obj/Main/b(src) new/obj/Main/c(src) new/obj/Main/d(src) new/obj/Main/e(src) new/obj/Main/f(src) new/obj/Main/g(src) new/obj/Main/h(src) new/obj/Main/i(src) new/obj/Main/j(src) new/obj/Hearts/h1(src) new/obj/Hearts/h2(src) new/obj/Hearts/h3(src) ..() </code>

How would I fit in the hearts list?
In response to FireEmblem
...bump >_<