Page 1 of 1

how do i make hp bar?

PostPosted: Mon Feb 19, 2007 3:28 pm
by Caaz Games
how do i make an hp bar i tried to make one with animations but it didnt work! please help!





p.s. im bored!

p.p.s. i have no idea why i posted the other p.s.

p.p.p.s. i stayed up all night!!!

PostPosted: Mon Feb 19, 2007 5:47 pm
by Sgt. Sparky
:shock: whoah,
you do have way to much free time!
well,
make a text actor,
and make a var called Health.
on the create actor event of the text actor:
Code: Select all
Health = 100;

on the draw actor vent of the text actor
Code: Select all
textNumber = Health;

when the player collides with the enemy or whatever hurts em'
Code: Select all
Health -= 25

or whatever you want it to be subtacted by.
on the draw actor event of the player:
Code: Select all
if (Health < 1)
{
    DestroyActor("Event Actor");
}

I hope that helps! :D

PostPosted: Tue Feb 20, 2007 1:28 am
by Caaz Games
yea but umm i want one with a picture like the one shown below

PostPosted: Tue Feb 20, 2007 2:14 am
by DilloDude
Mkae an animation of the health bar from empty to full. Set up the Health variable as Sgt. Sparky mentioned above. The health bar actor needs a create actor script:
Code: Select all
ChangeAnimationDirection("Event Actor", STOPPED);

alternatively, use the changeanimationdirection event. Also add adraw actor script:
Code: Select all
animpos = (Health / 100) * nframes;
This can be done more efficiently if you know the number of frames. Use calculater to find the number of frames divided by the maximum value for your health. Multiply this figure and multiply it by health. For examle, if the maximum amount of health is 100 and the health bar has 50 frames, you would use:
Code: Select all
animpos = Health * .5;

PostPosted: Thu Feb 22, 2007 3:19 pm
by Sgt. Sparky
you stole my person I was going to help :evil:

:lol: :D

PostPosted: Thu Feb 22, 2007 5:38 pm
by Luke playa
i didn't understand that, dillo dude, shoudln't it be
Code: Select all
animpos = health * .2;
? because 100 : 50 = 2, not 5...

PostPosted: Thu Feb 22, 2007 6:08 pm
by Sgt. Sparky
how many animation frames do ya' have :D

PostPosted: Thu Feb 22, 2007 11:28 pm
by DilloDude
It is the frames divided by the total. IE 50 / 100 which is a half, or .5.

PostPosted: Sat Feb 24, 2007 10:34 pm
by Sgt. Sparky
yeah, how many frames are there?