titmael Posted April 19, 2014 Share Posted April 19, 2014 Hi, I'd like to pause the game when the mouse is leaving the game area (on the rest of the page for example). Is it possible ? I didn't find any example of that and can't find a way to do it. Thx Link to comment Share on other sites More sharing options...
Heppell08 Posted April 19, 2014 Share Posted April 19, 2014 if(pointer.x > this.game.width || pointer.x < this.game.width && pointer.y > this.game.height || pointer.y < this.game.height) { //pause game stuff here }Its a bit long winded and I'm more than sure someone knows a super shortened version of that code above but that should work. Link to comment Share on other sites More sharing options...
titmael Posted April 19, 2014 Author Share Posted April 19, 2014 When game is paused can I unpause it same way (but defining mouse in game area) ? Link to comment Share on other sites More sharing options...
Heppell08 Posted April 19, 2014 Share Posted April 19, 2014 Just reverse the code and yes it should unpause depending on your pause method. Link to comment Share on other sites More sharing options...
titmael Posted April 19, 2014 Author Share Posted April 19, 2014 Nice I'll try it soon, thx Link to comment Share on other sites More sharing options...
Recommended Posts