Easy Way To Make Health Bar

Talk about making games.

Easy Way To Make Health Bar

Postby Caaz Games » Thu Mar 01, 2007 5:46 pm

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"?
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby Game A Gogo » Thu Mar 01, 2007 11:55 pm

you meen, b, its because its a actor variable, defining Blue.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Fuzzy » Fri Mar 02, 2007 2:05 am

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.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby Caaz Games » Fri Mar 02, 2007 2:44 am

Oh, I never thought About the variable thing.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby pavel329 » Sun Apr 01, 2007 11:11 pm

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?
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby Oman » Sun Apr 01, 2007 11:36 pm

change the destroy actor to a change animation
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby pavel329 » Sun Apr 01, 2007 11:41 pm

yeh i just figured out what i was doing wrong.
i kept forgetting to use wait for animation.
ty for the help though.
Drugs r bad.
Mgaay?

Image
User avatar
pavel329
 
Posts: 269
Joined: Thu May 25, 2006 2:05 pm
Location: Behind you
Score: 5 Give a positive score

Postby kostis12345 » Mon Apr 02, 2007 12:22 pm

Thanks a lot!!! :D :D :D :D [/code]
kostis12345
 
Posts: 15
Joined: Sun Apr 01, 2007 12:41 pm
Location: Greece
Score: 0 Give a positive score

Postby Sgt. Sparky » Thu Apr 05, 2007 4:05 am

what is up with the [/code] ? :D
oh, and Nice HP Bar __CAAZ__ :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby d-soldier » Thu Apr 12, 2007 6:54 am

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?!
User avatar
d-soldier
 
Posts: 703
Joined: Sun Apr 08, 2007 2:13 am
Score: 61 Give a positive score

Postby Sgt. Sparky » Thu Apr 12, 2007 6:43 pm

send me the game (.ged and the data folder) and I will fix it :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Caaz Games » Thu Apr 12, 2007 7:42 pm

you might have forgotten to set the animation to stopped
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby Markswii99 » Thu May 31, 2007 2:14 am

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.
User avatar
Markswii99
 
Posts: 6
Joined: Mon May 28, 2007 3:42 am
Location: Who Knows...
Score: 0 Give a positive score

Postby Sgt. Sparky » Thu May 31, 2007 3:48 am

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
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Markswii99 » Thu May 31, 2007 8:00 pm

Thank You very much sparky
User avatar
Markswii99
 
Posts: 6
Joined: Mon May 28, 2007 3:42 am
Location: Who Knows...
Score: 0 Give a positive score

Next

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron