Setting a maximum length for a breath bar.

In my game the user must get as high as possible by collecting bubbles to refill their breath bar. The breath bar decreases over time. The problem i am having is that if you collect lots of bubbles the breath bar gets extremely long, i want to have it just refill it maximum, not just keep on making it longer. how do i do this?
Thanks

Comments

  • LooseMooseLooseMoose Member Posts: 224
    It's hard to answer this question without seeing your code but I'll give it a go. Does your breath bar rely on an attribute?

    If it does, lets say your attribute is called 'breath' and the max you want it to go to is 10.
    When your hero collects a bubble have a rule that changes the attribute 'breath' to 'breath + 1' if 'breath' is less than 10

    Like I said i'm not sure how you are performing this action so if this example doesn't help you it will be faster for you to post a snip of your code. Goodluck
  • thanks, but when i do this the health bar gets stuck at the maximum width and glitches back and forth?
  • LooseMooseLooseMoose Member Posts: 224
    Is that when you use my rules or uptimistik's?
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Try to put this code in it. If it ad hp> 10 make it 10 . So it will become 10 oly when it's above 10 . Doesn't matter of how much you add or subtract.
  • i think i got it to work, i created a new attribute called full breath, and then said when player collides with bubble change attribute game.breath to game.fullbreath
    thanks everyone
  • i dunno is i should make another thread for this, but also for the game i want the background to wrap y, so it can scroll down, but i dont want all the bubbles and coins to also wrap, anyone know how to do that?
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Scrolling backgrounds are a big problem, if you can avoid it. Or what you can do is create a looping animation, use that as a background, it will not wrap or scroll but will give the effect of scrolling.
Sign In or Register to comment.