Question about setting up health bars?
ok todays question- so the project i am working on now has a power bar for health(thanks Tbooth). So my question is 2 parts, can i make it flash red when it at like 20%? and the 2nd question is, i added health power ups to the game but if you get to many the bar continues to grow is there away to cap how much goes back into the health?
Comments
To your first question :
1) You need to figure out how much 20% is from your total health , now lets say your bar is 10 pixels wide , then 2 pixels is your 20 percent .
This is the rule you'll make in your Health BAR actor-
When "Game.hero health" IS BIGGER OR EQUAL TO 2
change self.color.alpha TO 1
Otherwise
Constrain self.color.alpha TO sin(self.time*300)*0.5+0.5 (300 is the flashing speed you can change that)
To your second question :
First you need to decide what is your health limit , lets say its 10 for this example .
So this is what you do ,
When "health power up" achieved
Rule - When "Game.health" IS LESS THEN 10
Change "Game.health" TO "Game.health"+1 (or whatever value you want)
Cheers