Question about setting up health bars?

gotyoursgotyours Member Posts: 246
edited March 2012 in Working with GS (Mac)
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

  • POMPOM Member Posts: 2,599
    edited March 2012
    Hey ,
    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
    Photobucket Roy
  • gotyoursgotyours Member Posts: 246
    perfect thanks Roy
Sign In or Register to comment.