Flashlight style timer

gregoirephilippegregoirephilippe Member Posts: 5
edited October 2012 in Working with GS (Mac)
Hey guys,

I want to do a visual health bar for the flashlight that my character controls.

What I've programmed is that I have a «darkness» actor that covers up all the scene. When my actor clicks, the darkness goes away for five seconds (simulating a flashlight) and comes back. Then the actor has to wait another 5 seconds to click again.

So I want to do this flashlight health bar that follows the timer. For the moment, I've been able to make the health bar work when the light is on (reducing for 5 seconds) following tshirtbooth health bar tutorial. Now the problem I have is for the recharge. In my darkness actor, I've put the rule :

if attribute self.color.alpha = 1 and game.flashlight < 5,
every 1 second
change attribute game.flashlight to game.flashlight+1

Now here what happens. When the darkness comes back, the health bar gets a visual +1 square, but then doesn't add another one for 5 seconds. After those 5 seconds of only one square, the health goes up exactly like I want it to...
So does anyone have an idea why the health goes up correctly after 5 seconds and not at the moment my darkness comes back ?

Or does anyone has a better idea how I could do this kind of timer bar.
Sign In or Register to comment.