Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Manuel

Hi, i'm making a game, this game had a timer that defines the limit time to finish the current level, when the player pass the level appears a message that indicates the end of the level, how ever this doesn't mean that the next level charge, the next level only charge if the player click over the message that just appear in the screen. if the player doesn't click the message he stays in the current level but the countdown timer still running, if this timer is equal to 0 the player lose a life.

Wjat can i do for stops this timer and evoid this bug

Thanks

1 decade ago by monkeyArms

I would just delete the timer by setting the variable holding it to null or false.

e.g.

this.timer = new ig.Timer();

// "delete timer
this.timer = null;

Then modify the code that is checking the timer to first check that the timer is not null (or false, depending on which way you go.)

1 decade ago by Manuel

thanks @monkeyArms, but can you give me another way to do this, this is because i dont want to destroy the timer i want to stopped, i want that the player can see his time in the current level

Thanks

1 decade ago by monkeyArms

Just capture the current time right before destroying the timer. If you are using the timer directly for screen display, then create a new variable that holds the time, update the variable with the timer, and use that for screen display instead.

I can't be any more specific without seeing some code :)

1 decade ago by Xander

Create a variable that holds the amount of time that is remaining in the timer.

When you need to resume the timer, set it with the amount of remaining time.
Page 1 of 1
« first « previous next › last »