Graphic bar over time

SingleSparqSingleSparq Member Posts: 1,339
edited November -1 in Working with GS (Mac)
Whats the best way to have a bar (like energy level) grow over time? If the timer (game.timer) is different each time (as in could be 10 mins could be 20 mins depending on input) and I want the bar to be consistent with that (as in, if we're half way through the time, the bar would be half way). Thoughts?

Comments

  • KamazarKamazar Member Posts: 287
    Create a new scene integer variable, and have a timer add +1 to it ever second. Constrain the size of the bar to that variable, but with a couple of adjustments so that the bar is the right size. Do you get the gist of what I'm saying?
  • SingleSparqSingleSparq Member Posts: 1,339
    Not yet but thats where experimentation comes in! - thanks
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    how did you get it working in the end?

    I'm confusing myself with some very simple maths...

    a bar that is 380 long, and a timer that is 1000 seconds long...

    How can I tell it to scale down to 0 over 1000 seconds....

    wil no doubt work it out eventually but if anyone is in the giving mood be good if you can see the needed maths easily.

    Also tried using the interpolate behavior to scale the width down to 0 over 1000 seconds, if timer is active, but no such luck there either yet...
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    managed it with interpolate.

    if timer active:

    every 0.1 second,

    interpolate

    self.size.width to self.size.width - (self.size.width - original.width/100000)
    for 0.1

    so that works, but now I want it to scale down from the left rather than the middle. Sure I read how to do that somewhere....the hunt continues...
  • SingleSparqSingleSparq Member Posts: 1,339
    Sorry didn't see you reply - yeah same situation - got it working but it eats away at each end of the bar down to the middle - just want it to grow from left to right. I'm about to take a stapler to my monitor to make it stay.
Sign In or Register to comment.