How do I create a boss health bar with multiple segments.

Get help using Construct 2

Post » Sun May 22, 2016 9:53 am

A lot of tutorials use the trick of setting the width of a red bar, killing the player once it hits 0 width...

My boss' health bar has multiple segments, 5 in fact! They're not split or anything, there's simply parts of the health bar that are different colors.
So from left to right, it goes Red, Orange, Yellow, Greenish-yellow and then Green.
Changing the width won't do much as far as I know, unless there's a way for it to cut slices off the side instead of simply crunching it up into a smaller size!

Anyway, it's your typical health bar. Once you hit the boss, the bar will go down starting from the right, until it gets allll the way to the left - that's when the boss will die.
I have no idea how to go about this, my only thought is by using a LOT of sprites - which isn't a bad idea, I'll do it if I must, I figure there's a more efficient method though.

I'd appreciate any input! Oh and on a side note - it's not required or anything - the boss has different phases, so when the boss is at full health it'll be at phase 1, at half health, phase 2, at a quarter health, phase 3, so I'll need a way to measure it's health... if that makes sense. That might help somewhat if you need any more info!
B
24
S
10
G
1
Posts: 153
Reputation: 2,660

Post » Sun May 22, 2016 9:59 am

Hi,

Like you stated the "sprite" method is a good one. If you create a health bar sprite with six frames then you can accomplish this easily:

(0) Red Orange Yellow GreenYellow Green
(1) Red Orange Yellow GreenYellow black
(2) Red Orange Yellow black black
(3) Red Orange black black black
(4) Red black black black black
(5) black black black black black (dead)

Default frame will be (0) and then you can iterate through the remaining frames each time it takes damage or back again when it heals.

Also, you can create events that start on the following:

Monster.AnimationFrame = 2
Start Phase 2

Monster.AnimationFrrame = 4
Start Phase 3

N.b. Just remember to set the Animation speed to 0 for the healthbar, or it will iterate through the steps itself! You want to be in full control of it.
B
8
S
2
Posts: 59
Reputation: 686

Post » Sun May 22, 2016 12:43 pm

Thank you so much! Appreciate the input :)
B
24
S
10
G
1
Posts: 153
Reputation: 2,660


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 50 guests