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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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