Page 1 of 1

need help changing health bar animation

PostPosted: Sat Jul 14, 2007 12:56 am
by cyber ruler
I made a health bar with 8 animations, I want to include a health bar and health number. I can't get my health bar to change and match my hp number, cause for sum stupid reason g-e doesn't know wat equal to
( == ) means.

anyone know how i can do this?

Re: need help changing health bar animation

PostPosted: Sat Jul 14, 2007 1:35 am
by platformkid
cyber ruler wrote:I made a health bar with 8 animations, I want to include a health bar and health number. I can't get my health bar to change and match my hp number, cause for sum stupid reason g-e doesn't know wat equal to
( == ) means.

anyone know how i can do this?


Hi, could you post the sample of the code that doesn't do what you want ?

Maybe the health number, when decreasing, doesn't reach the exact value
you're trying to match with the == comparison, but nonetheless continues
to decrease.

In the code that choses which of the 8 animations to display for the health
bar, maybe you should better use range tests like that (names and values
given as examples) :

Code: Select all
if ( (health < 10) && (health >= 8) )
{
    ChangeAnimation("Bar", "State2", FORWARD);

} else if ( ( health < 8) && (health >= 5) ) {

    ChangeAnimation("Bar", "State3", FORWARD);
}

// etc. etc.




Hope I understood your problem.

Good luck.