Jump to content

making a seconds clock


peteblank
 Share

Recommended Posts

Okay now this is weird.

I'm trying to make a clock in phaser and I set it so whenever it reaches 10 seconds it goes back to 0. Yet it gets stuck in 9.

Here's the code:

var timerevent=0;
var timerseconds=0;

function update() {
  if (timerseconds<9)
  {
    timerevent=Phaser.Math.CeilTo(this.time.now,[3]);
    timerseconds=timerevent/1000;
  }
  if (timerseconds>9)
  {
    timerseconds=0;
    timerevent=0;
  }
  console.log(timerseconds);
}

It also starts at 3 seconds for some reason. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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