Page 1 of 1

Trigun 2D Mega Man Style Health

PostPosted: Mon Jul 04, 2005 4:41 pm
by josh_sg1
I need help making a mega man style health meter for my character.

I also need to know how to make it decrese and increase like mega man when he gets damaged.

PostPosted: Tue Jul 05, 2005 3:36 am
by jazz_e_bob
What does it look like?

How does it behave?

PostPosted: Tue Jul 05, 2005 6:55 am
by ingsan
Image

Hello,
You should have an animated health bar. If you have, let's say 5 lives in the meter, you should have something like this :

Image

Image

Image

Image

Image

Image

Then Download the demo here

Hope it helps.
See you 8)

:p

PostPosted: Thu Jul 07, 2005 3:49 pm
by josh_sg1
Thank you. My only problem is that after I made the animated health bar.... I attached It to the view. Now how to get it to change the animation every time he looses health. There is 30 bars.

I also want the health bars to be able to be increased during the game but that I will get into later. Like mega man, when in game you find health and it restores your health meter.

Do I use scripting? I use donuts to re-fill the health.

Right now I just need to know how to change the animation on projectile collision. All projectiles decrease a different amount of health.

Lasers, bullets, machine gun bullets, bombs, fire, explosions, metal cannon balls, and so on.

||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||
||||||||||||||||||
|||||||
||
0
Destroy actor, creat actor-explosion (like mega man but different)

That is my main concern at the moment is getting that health metter to decrease like changing the animation a certain number of frames. The moon defender tutorial did'nt realy help but ill do it again if thats what it takes.

PostPosted: Sat Jul 09, 2005 8:59 am
by ingsan
Hello :)

What you want to do is very simple to deal in GE. In fact, you'll need only one conditional variable.
Let's call it health (integer variable that you'll have to create in the Script Editor)

On your Healthmeter Actor :
Event CreateActor > Action Script, write :
Code: Select all
health = 30 ;  // Use 30 because of your 30-frame animation

ChangeAnimationDirection("Event Actor", STOPPED); // to stop your animation from launching at game start

animpos = 30 ; // Remember, animpos starts at 0. If your first animation sprite is numbered 0, then animpos is called from 0 to 30. Else, if it is numbered 1, animpos is called from 0 to 29. Here, let's say that it starts at frame 0


    ------------------------------------------------------------------------------------------
Quote : Now how to get it to change the animation every time he looses health
On Collision Event with each ennemy (Lasers, bullets, machine gun bullets, bombs, fire, explosions, metal cannon balls, and so on) > Action Script, write :
Code: Select all
health = health - B ;
// where B is to be replaced by the amount of decrease you want, depending on the colliding actor
// Ex : Colliding with laser means health = health - 5, Colliding with bombs means health = health - 10, and so on

animpos = animpos - B ; // your meter animation will change animation by B frames

if (health < 0)
{

// DestroyActor
// Change animation to Explosion animation

}
 


Quote : I use donuts to re-fill the health
On Collision with Donuts, Action Script, write :
Code: Select all
health ++ ;

animpos ++ ;

if (health > 30 )
{

health = 30 ; // to limit the meter to your 30-frame animation

}


Bingo ! Now, good luck 8)

PostPosted: Sat Jul 09, 2005 7:12 pm
by willg101
Couldn't you also do, with the same animation and health settings, animpos=health ?

wow

PostPosted: Sun Jul 10, 2005 3:50 pm
by josh_sg1
Oh my god. Thank you so much.

You have no idea how much I needed that. That was exactly explained how I needed it to be. Holy cow.

I have another hard question but I am going to pm it to you.

Here is my health meter
Image

PostPosted: Tue Jul 26, 2005 3:12 pm
by ingsan
Couldn't you also do, with the same animation and health settings, animpos=health ?

Of course Yes 8)

PostPosted: Sun Aug 21, 2005 3:32 am
by josh_sg1
cool. So this will help alot.