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.
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
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
}
health ++ ;
animpos ++ ;
if (health > 30 )
{
health = 30 ; // to limit the meter to your 30-frame animation
}
Couldn't you also do, with the same animation and health settings, animpos=health ?
Users browsing this forum: No registered users and 1 guest