Jump to content

Psycho Timers


XekeDeath
 Share

Recommended Posts

I attached 4 events to the game timer as an experiment like this:      

//This state is the Game state in the Boot -> Preloader -> Game state sequence..create: function(){        //Timer..! Woo..!        this.game.time.events.loop(Phaser.Timer.SECOND, this.timeMinute, this);        this.game.time.events.loop(Phaser.Timer.SECOND*15, this.timeQuarterHour, this);        this.game.time.events.loop(Phaser.Timer.SECOND*30, this.timeHalfHour, this);        this.game.time.events.loop(Phaser.Timer.MINUTE, this.timeHour, this);}

I have some text fields on the screen that display an integer that is incremented in the SECOND event and the MINUTE event.

If you guessed that I was making a clock, you guessed correct.

 

I have 2 problems.

One may be because of the timer already running at the time of adding the events, not sure, but the MINUTE event fires about half a second after the 60th SECOND event, so it ticks the clocks hour number up after the minutes reset to 00 ( 1:58, 1:59, 1:00, 2:00, 2:01)

 

Problem two is more fun. If I change tabs long enough for an event to fire twice, then the events seem to never stop firing, and my clock goes psycho.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...