Smoothly Regrowing Energy Bar How Too ?

JelJel Member Posts: 319
edited November -1 in Working with GS (Mac)
I have a energy bar that decrease with hits from 10 to 0. I have it so after a set amount of time it goes back to 10. How can I regrow the bar smoothly over that time instead of jumping to 10.

Thanks in advance, Jel

Comments

  • BeyondtheTechBeyondtheTech Member Posts: 809
    First, make sure you are using a real Attribute, not an integer, so you can make gradual increases. Second, use a timer that for every 0.1 seconds or so, increment the energy by 0.05.

    I use that heavily in my Spellcaster game.
  • rebumprebump Member Posts: 1,058
    And of course, stick the regrowth rate (the "0.05" in BtT's example) in a game attribute (along with the regrowth time tick if you want...the "0.1" in BtT's example) and you can adjust those in your scene controller per scene if you want another item you can adjust game difficulty with as the player gets to later levels.
  • ORBZORBZ Member Posts: 1,304
    For a neat effect check out natural log curves between 0 and 1

    http://oak.cats.ohiou.edu/~piccard/huwe/logarithm.jpg
  • JelJel Member Posts: 319
    Thanks for your help guys
Sign In or Register to comment.