Game Automatically Pauses

127 views
Skip to first unread message

Gen

unread,
Feb 15, 2016, 1:40:20 PM2/15/16
to HaxeFlixel
Hi Haxeflixel team,

I'm trying to write an 'idle' HTML5 game using this game engine, I therefore need the game to continue running even when it is sitting in an inactive tab.

I've set FlxG.autoPause = false;, this works to prevent the game from pausing when the game window loses focus, however, it's still pauses if it is not the primary tab in its respective window.

Is there anything you could suggest to avoid this behaviour?  

Thanks!

Sam Bellman

unread,
Feb 16, 2016, 3:48:56 AM2/16/16
to HaxeFlixel
I don't think you can with haxeflixel on it's own. The best thing to do is probably to just keep track of the time and do your updates based on the time elapsed. It leaves the possibility of the player cheating by manipulating their computer clock, but hey, it's a javascript game so they could easily cheat using the console if they want to (cookie clicker actually gives an achievement for this).

I suppose you could write some web workers that run independently of the game but that would probably be over complicated + they don't have the best browser support.

Gen

unread,
Feb 23, 2016, 12:54:43 PM2/23/16
to HaxeFlixel
Thanks Sam,

Thought for sure I had replied and marked this as completed several days ago.  

In the end, I decided to calculate some reward based on how long the game was left paused.
Reply all
Reply to author
Forward
0 new messages