Page 1 of 3

Easy Way To Make Health Bar

PostPosted: Thu Mar 01, 2007 5:46 pm
by Caaz Games
Hey i found a easy way how to make a Heath bar So im going to tell everyone so they can know too

1.)first make a health bar with multiple frames, (mine has 11 frames).

http://i161.photobucket.com/albums/t220/_CAAZ_/HB.jpg

2.)Then change the animation to "STOPPED" in "Draw Actor".
3.)Next make two actors ( for now lets just call them "A" and "B").
4.)Again go to "Draw Actor" of the Health Bar actor and put in the code:

Code: Select all
DestroyActor("A");


Have it "Wait For Frame Action" then put in the last frame number (mine would be 11)
5.)When "A" collides with "B" use script editor and put in the code:
Code: Select all
HealthBar.animpos++;

And I think thats all!
Sorry for my misspelled words.
i hope it helps! :D

For a Health Package/whatever you want to call it use the code
Code: Select all
HealthBar.animpos--;


P.s.Why cant i name an actor "B"?

PostPosted: Thu Mar 01, 2007 11:55 pm
by Game A Gogo
you meen, b, its because its a actor variable, defining Blue.

PostPosted: Fri Mar 02, 2007 2:05 am
by Fuzzy
Good work on the health bar CAAZ. You are learning fast.

Gogo has it right. An actor is actually a structure of variables, and a variable in itself. There are three actor variables called r g and b, which are used to tint the overall color of an actor.

PostPosted: Fri Mar 02, 2007 2:44 am
by Caaz Games
Oh, I never thought About the variable thing.

PostPosted: Sun Apr 01, 2007 11:11 pm
by pavel329
good job.
but how do you make it where.
when the health bar reaches the final animation,it changes the animation on my playor instead of destroying him?

PostPosted: Sun Apr 01, 2007 11:36 pm
by Oman
change the destroy actor to a change animation

PostPosted: Sun Apr 01, 2007 11:41 pm
by pavel329
yeh i just figured out what i was doing wrong.
i kept forgetting to use wait for animation.
ty for the help though.

PostPosted: Mon Apr 02, 2007 12:22 pm
by kostis12345
Thanks a lot!!! :D :D :D :D [/code]

PostPosted: Thu Apr 05, 2007 4:05 am
by Sgt. Sparky
what is up with the [/code] ? :D
oh, and Nice HP Bar __CAAZ__ :D

PostPosted: Thu Apr 12, 2007 6:54 am
by d-soldier
That looks great, and seems so simple! It seems for me that upon collision, my heath bar flickers down a peg, then goes right back to full... What did I do wrong?!

PostPosted: Thu Apr 12, 2007 6:43 pm
by Sgt. Sparky
send me the game (.ged and the data folder) and I will fix it :D

PostPosted: Thu Apr 12, 2007 7:42 pm
by Caaz Games
you might have forgotten to set the animation to stopped

PostPosted: Thu May 31, 2007 2:14 am
by Markswii99
I am sorry if I'm being difficult but I am kinda new at this stuff could you please explain how I would use this method to make the health bar go down a little everytime I shoot the enemy and when the health bar finally reaches 0 the enemy is destroyed.

PostPosted: Thu May 31, 2007 3:48 am
by Sgt. Sparky
make a health variable called health(Actor variable)
when you shoot your enemy:
collide.health -= 5;
on the create actor event of your enemy:
health = 25;
on the draw actor event of your enemy:
if(health <= 0)DestroyActor("Event Actor");
:D

PostPosted: Thu May 31, 2007 8:00 pm
by Markswii99
Thank You very much sparky