Creating a Timer-Bar, but it gets too big...
So I'm creating a Timer-Bar. As an actor flies around the screen it lasts for 5 seconds. I created a 'health-bar' that ticks down every .1 seconds and when the actor is destroyed, the timer bar should be at 0 as well.
The actor hits other actors and as it hits them the amount of time the actors lives is increased by 2 seconds. However, my bar (in some levels) can get so long that it exceeds the screen...
Whats the best way to have a timer-bar, that grows when the actor's time is increased, but doesn't exceed a certain width? Does this make sense?
The actor hits other actors and as it hits them the amount of time the actors lives is increased by 2 seconds. However, my bar (in some levels) can get so long that it exceeds the screen...
Whats the best way to have a timer-bar, that grows when the actor's time is increased, but doesn't exceed a certain width? Does this make sense?
Comments
so it stops growing once it reaches a certain size
Is there some mathematical equation or something to change the time linearly for a maximum-sized bar?
---
What I have now:
5 seconds of a 160 pixel lengthed bar is 32 pixels per second. My timer subtracts 3.2 from 160 every .1 seconds. So, at the end of 5 seconds the bar has nothing left.
As the actor's time is increased this number goes up 64 (which is equal to 2 seconds) for each object hit.
How would setting a maximum change the way the timer subtracts 3.2 every .1 seconds?