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

10 years ago by DaveVoyles

I'm trying to create a timer that allows me to have text flashing on the screen, at 1 second intervals.

I'm running into some issues here, so perhaps one of you has some experience with it.

Here is what my draw function looks like:

init: function(){
   textTimer = new ig.Timer(1);

    draw: function(){
        if (this.textTimer) {
            this.font.draw('Bullet Time!', this.pos.x, this.pos.y - 20, ig.Font.ALIGN.CENTER);
            if ( > 0) {
                this.textTimer = null;

So after 1 second, the text disappears, but how can I make it reappear?

10 years ago by lazer

You are destroying your timer when .delta() > 0, so the text doesn't reappear because the timer doesn't exist anymore. One option would be to set a textDisplay variable and toggle it on and off every time delta() > 0, resetting (as opposed to destroying) the timer each time. Then if textDisplay is true, draw the text.
Page 1 of 1
« first « previous next › last »