Timer Bar... I am stumped.
I need some help fellow GS members. I have looked at tshirtbooths tutorials on health bars, but can't seem to figure this out.
I am building 1 scene for many different levels. Each level has a Timer, but they change depending on the difficulty. Each level has a timer between 25 and 15 seconds. Its a mix.
I have created a horizontal timer bar that shrinks to the left. I am adding a power up that will allow the player to add 5 seconds. Using interpolate will not work because once interpolate starts counting down to 0, there is no adding to it and the power up fails.
The only workaround I could find was using a timer
every .01 seconds -> change.attribute Level.timer to level.timer -.01.
This kind of works, but not sure how to get the timer bar to constrain to it.
Any help would be appreciated.
Thanks!
Crestwood
Comments
This thread has examples, videos, etc.: http://forums.gamesalad.com/discussion/62217/health-bar-that-gets-smaller-from-1-side-only
I also have a health bar demo here: http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang thanks for the help, but I am still a bit confused.
Your exampled has the following to constrain the size.
50*(self.health/10)
Actor is 50px wide, and every collision takes 10 away.
This works fine if every time the actor is hit they lose health by 10. What I am trying to figure out is a smooth countdown.
My timer bar is 300px wide. I am wanting to countdown from 25 seconds to 0 and have the bar shrink smoothly with it. All of the formulas I try seem to make my bar really small, or really big.
Interpolate does not work if I want to add to the time every time the person adds to it during the countdown. They have a power up that they can use to add 5 seconds when they need it.
I know I am probably making this a lot more complicated than it has to be Lol.
Any help is appreciated.
Thanks!
I made a demo for you.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang Thank you very much! That's some serious coding and I would not have not figured that out.