How do I see when the game is unfocused?

0 favourites
  • 3 posts
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • I am making a game to be hosted on Newgrounds. The game uses mouse control, and what I want is when the player clicks outside the game's area, the game should be paused.

    I already got the logic part in my event sheet about game pausing, but is there any way in Construct 2 to see if the player has left click/right click outside the game's window or if the game has lost focus?

  • in the browser plugin there is a "on suspended" and "on resumed" conditions - might be what you are after ?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • RamPackWobble Ah, this works when the player changes tabs, etc., but there is one problem left unresolved - suppose you run the game (either preview or exported to HTML5 and upload to Dropbox) and you right click on the black area that is outside the game's window, "on suspended" won't be fired in this case. Also, the right click contextual menu will pop up and the game will not be "focused", meaning all the keyboard events will not be fired.

    What you suggested works to a certain extent but it does not solve the whole problem fully. Nevertheless, thank you for your answer.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)