Graphic bar over time
SingleSparq
Member Posts: 1,339
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
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...
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...