Jump to content

game.time.elapsed has a bug? (Phaser 2.6.2)


Recommended Posts

Hi, has anyone seen this bug?

I am testing onBlur/onPause and onFocus/onResume.

When I am out of focus by tapping out of the game window, both onBlue and onPause triggers and the game stops updating. And when resume everything resumes as expected.

BUT, if I go out of focus by tapping another tab on my chrome browser and then go back to the game tab; based on logs, the game did pause and resume as expected;

however, the game.time.elapsed value is wrong, as if it is accumulates the total time from when the game pauses till when it resumes.

This issue also happens on mobile, for example I have a url button to click out of the game and open a browser, the game indeed pause but when i go back to the game, the game.time.elapsed returns incorrect value; it returns the accumulated time it is pausing same as the out of focus through tab issue.

Is this a known bug? It just doesn't make sense because onBlur/onPause, onFocus/onResume triggers correctly. Perhaps something is not pausing or not reseting when you go out of focus by clicking on other tabs or click out from the game into a browser on mobile.

Currently, I just have to add a check if game.time.elapsed returns a large number, I just reset that value to 1.0 

Link to comment
Share on other sites


  • Recently Browsing   0 members

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