Howdy,

I've got another question, I'm interested in using 2 sprite graphics, one is
a picture of a full health bar,
and the other is a picture of an empty health bar, the empty bar has the
full bar copied on top of it*layered over*
now whenever the player get's hurt, I wan't it to only copy the remaining
part of the fullbar that represents their
 remaining health, Now I've designed an equation for this which seem's
sound,
--Health.cpp--
...
float fHealthPer = m_iHealth == 0 ? ((m_iHealth + 1)/ 100) : (m_iHealth/
100);
...
//Reset the rectangle if the health is back to 100% i.e. we died and
respawned
                if (fHealthPer >= 1)
                        HealthBarArea->top = OrigHealthBarArea->top;

                HealthBarArea->top -= OrigHealthBarArea->top - (OrigHealthBarArea->top 
*
fHealthPer);
...
--End of Health.cpp
Now i'm sure you see what i'm doing, This is what i THOUGHT would work, I
slimply lower the top member
of the HealthBarArea wrect_t pointer but it doesn't ...it merely add's more
transparent pixel's(I assume), and end's up
just lowering the full healthbar sprite lower and lower as if I wasn't
changing the rect at all but merely increasing
the y position.  Is their another way to uhh ...decrease certain dimension
of the area I want to blit ? because the bar
is a vertical bar, that should decrease from the top down to the bottom and
it hits the last bottom pixel when it hit's 0 health, now I understand, the
precision of this bar won't be perfect ...if it will in fact work at all,
But at 5 am
it seemed like a good idea and I honestly can't think of anything better.
Any feedback/advice ?  Thanks.

Pj Bean
Lead coder of Sr(http://www.sr.flagrun.net)


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to