how do i make hp bar?

Talk about making games.

how do i make hp bar?

Postby Caaz Games » Mon Feb 19, 2007 3:28 pm

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!!!
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 Sgt. Sparky » Mon Feb 19, 2007 5:47 pm

: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
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 » Tue Feb 20, 2007 1:28 am

yea but umm i want one with a picture like the one shown below
Attachments
hb.png
this heath bar is what i want
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 DilloDude » Tue Feb 20, 2007 2:14 am

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;
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Sgt. Sparky » Thu Feb 22, 2007 3:19 pm

you stole my person I was going to help :evil:

:lol: :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 Luke playa » Thu Feb 22, 2007 5:38 pm

i didn't understand that, dillo dude, shoudln't it be
Code: Select all
animpos = health * .2;
? because 100 : 50 = 2, not 5...
Luke playa
 
Posts: 11
Joined: Tue Feb 20, 2007 4:50 pm
Location: USA
Score: 0 Give a positive score

Postby Sgt. Sparky » Thu Feb 22, 2007 6:08 pm

how many animation frames do ya' have :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 DilloDude » Thu Feb 22, 2007 11:28 pm

It is the frames divided by the total. IE 50 / 100 which is a half, or .5.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Sgt. Sparky » Sat Feb 24, 2007 10:34 pm

yeah, how many frames are there?
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


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron