-
1. Re: how to make energy bar increase by 1 each minute and set a timer for it?
Ned Murphy Oct 31, 2014 8:11 AM (in response to Eslam Yosef)You can use the Timer class to have a Timer object repeatedly execute a function every minute. You define the Timer....
var energyTimer:Timer = new Timer(60000); // one minute delay - repeats indefinitely
energyTimer.addEventListener(TimerEvent.TIMER, addEnergy);
function addEnergy(evt:TimerEvent):void {
// adjust the energy value and the displays of it here
}
energyTimer.start(); // use when you want the Timer to begin
-
2. Re: how to make energy bar increase by 1 each minute and set a timer for it?
Eslam Yosef Oct 31, 2014 10:45 AM (in response to Ned Murphy)and i shall use energytimer.stop() to stop it when it full, well thank you Ned, was very helpful
-
3. Re: how to make energy bar increase by 1 each minute and set a timer for it?
Ned Murphy Oct 31, 2014 3:06 PM (in response to Eslam Yosef)You can stop it or you can put a condition in the function that inhibits adding more when the maximum is reached.
-
4. Re: how to make energy bar increase by 1 each minute and set a timer for it?
Eslam Yosef Oct 31, 2014 9:17 PM (in response to Ned Murphy)i don't know if that will work with my case, because there's no maximum, the player can have more than the full value by some ways, but the timer shall stop at the full value and full value+, i'm not sure about stopping the timer when the real value become more than the full value, i will give it a try if failed i think i will set anther q.
-
5. Re: how to make energy bar increase by 1 each minute and set a timer for it?
Ned Murphy Nov 1, 2014 6:02 AM (in response to Eslam Yosef)If you would havr some condition that would stoip the timer then that same condition can be used to prohibit the event handler function from processing anything while the timer continues running.


