Hi again,
In this case (a “pausing” timer), just pause bombTimer in the function “createBomb” using timer.pause(), then start another timer that executes a function to resume bombTimer after 10 seconds. You’ll want to assign this “restart” timer to another reference variable in case the user restarts the game while those 10 seconds are elapsing… in which case, you’d want to cancel that restart timer and the paused bombTimer.
So basically, this procedure:
- Start bombTimer (800 milliseconds, it appears to be set at).
- When the target function (createBomb) executes, pause bombTimer.
- Start a new timer (10 seconds) that executes a function like “resumeTimer()”
- When this function executes, resume bombTimer using
timer.resume()
That should do it! If you still have problems with the timers not canceling properly, let me know because I have an alternative method which might work a bit better.
Brent
[import]uid: 9747 topic_id: 30328 reply_id: 121907[/import]
