Jump to content

Game running in the background


CaptKiwi
 Share

Recommended Posts

Hi Guys,

 

I have a game that is sending out sprites to the canvas at certain time delays. If I click on another tab in the browser for a minute or so and come back to the game, then all the spites come on the screen at the same time. For example, if there was a new sprite every four seconds, once I comeback to the canvas, after a minute there would be 15 sprites all at once entering the screen.

 

Is there a way to pause the game if the player clicks out of the canvas or out of the web browser tab?

 

Cheers!

Link to comment
Share on other sites

By default the game should pause when you just click out of it, unless you've turned this off? Also it depends how you were timing the release of new sprites - what code did you use for the timer?

 

Thanks rich,

 

I'm using the following  :  enemyTimer = setInterval(function() {addEnemy()}, 4000);

 

The game action does pause, but I guess my timers are still running and hit all at once when I click back in the canvas.

Link to comment
Share on other sites

By default the game should pause when you just click out of it, unless you've turned this off? 

 

I was searching for this option but couldn't find it ?

 

I want this behaviour cause I want a running game and open chrome/firebug console to type in :P 

 

Please share the setting... I thought also that there was such a topic but couldn't find it in the forum.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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