Jump to content

Phaser browser Next Tab Update is stopped


Balamurugan
 Share

Recommended Posts

In Phaser i use ES5,

 

this is my boot state.

------------------------------------

var initGame = function(game) {};

initGame.prototype =
{
    init: function()
    {
        console.log("INIT GAME");
        this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
        this.game.stage.disableVisibilityChange = true;
    },

    preload:function ()
    {
        console.log("Preload");
        
    },
    create:function ()
    {        
        game.state.start("STAGE_ASSETS");
    },
}

------------------------------------------------------------------------------------------------------------------------------------------------------

This is My Second State-

-----------------------------------------

var stageAssets = function ()
{
     i =0;
}

stageAssets.prototype =
{
    create: function ()
    {
        console.log("STAGE ASSETS");
    },

    update: function ()
    {
        wheel.angle +=1;
        console.log("----------------i----->"+i++);
    },

}

In this game i just trace i in update, In browser i just move to next tab update is stopped, I also put

Quote

this.game.stage.disableVisibilityChange = true;

In my boot state, still Update is not Working when i minimize window or move to next tab, update is stopped. In my game i put some main functions in update. that function are not working at that time. I google is lots of time, still no one give solution. Please Help us rectify this problem.

Link to comment
Share on other sites

In regards to your timer, you could incorporate logic to use a starting timestamp, getting the current time, and comparing the difference to a set value (limit):

var date = new Date();
var timestamp = date.getTime();

 

Link to comment
Share on other sites

18 hours ago, prob said:

In regards to your timer, you could incorporate logic to use a starting timestamp, getting the current time, and comparing the difference to a set value (limit):


var date = new Date();
var timestamp = date.getTime();

Thanks. But How to get browser focus and Out focus, in Phaser CE v2.10.0

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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