Jump to content

Problem with phaser time


Gods
 Share

Recommended Posts

You double posted, but I'll reply to this one:

 

Working fiddle: https://jsfiddle.net/hshL1x96/

 

Timers default "autoDestroy" to true. When you call "stop()" on the timer, it gets destroyed.

You need to add the timer event again. Thus, you also need to update the "onDown" context.

Simply change like so:
 

timer = game.time.create(false);...game.input.onDown.add(this.restart, this);...restart: function () {    timer.stop()    timerEvent = timer.add(Phaser.Timer.SECOND * 1, this.endTimer, this);    timer.start();}
Link to comment
Share on other sites

 

You double posted, but I'll reply to this one:

 

Timers default "autoDestroy" to true. When you call "stop()" on the timer, it gets destroyed. Simply change the construction to this:

 

timer = game.time.create(false);

not sure why it double posted maybe my internet flaked out. How can I delete a thread?

 

also

I changed it to false but still the bugs are there. When I go out of browser window and go back in and press the canvas to reset timer it adds time. When the timer is over it doesn't display "Done!"

https://jsfiddle.net/knz4aczh/2/

Link to comment
Share on other sites

I updated my post with a more comprehensive solution.

Thanks it works but I am not sure why the time displayed gains when you leave browser and go back in to reset even tho its still 5 seconds. Tested on Safari so not sure if you see that 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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