What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
So right now the way this game works, basically, is that the Main class places the Level class on the stage once the play button has been clicked.
The Leven class has a few arguments including the amount of objects being created and the delay between each creation. This is done by creating a timer.
The problem is that also in the main class I have added a pause button that sets the framerate to 0 and stops the timer, as well as getting rid of events and etc. The problem is that when the game is unpaused, the timer is reset to 0.
Is there a good way to get around that, so the timer remembers its location? Why did Adobe not include that function?
Sorry I wasn’t clear.
What I mean to say is that the delay is restarted when the start() method is called.
So, the game stops, the frameRate is set to 0, the timer is stopped.
Then the game continues, frameRate is brought back to 24 and the timer starts(), however not from where it left off. So, if the player presses the pause button every 4 seconds (it’s a 5 second timer), the timer event listener function is never called.
So I guess the question is, how do you get a timer to remember where it was when it stopped and start it at that point?
Interesting problem. Unfortunately I can’t think of a way of solving it in a simple way using AS3’s Timer. I’d recommend building your own timer class which would have a start() and stop() method that behaves the way you want. Use flash.utils.getTimer to keep track of time and listen for ENTER\_FRAME events. Or hope that someone else knows a better solution w/ AS3’s Timer.
It might be easier to handle all your timer needs through an enter-frame event. Then, when you kill the framerate to pause your game, everything will properly pick up where it’s supposed to when the game resumes.