Problem Using Phaser.Time.Clock


I want to get the time elapsed (seconds) in a scene. My idea is to set a variable x to be Then before scene exit, I subtract x from the current time. My problem is that in one scene, it works fine. But in another, when I timestamp on the create method, it gives me a large number. Also, upon exit gives me a rather large value compared to how many seconds have elapsed. I wonder if launching other scenes mess up with its value.

If there are other better ways to do this, I’ll gladly change my code.



I had this problem and used

function init () {
  if ( > 1e9) {
    console.warn(' is too large',;
    this.time.update(0, 0);


I tried doing this too. But there were also problems when I launch other scenes. I opted just to use the javascript Date object for the timestamps.