Click outside the game screen

Get help using Construct 2

Post » Fri Jun 15, 2012 8:42 pm

Hello, I need to know if there is a way to determine if the user clicked outside the game screen, so I can pause the game if this happens.

Thanks.
B
4
S
1
Posts: 22
Reputation: 671

Post » Fri Jun 15, 2012 8:54 pm

Outside your game window your are not in your game ... so mouse events are managed by os and not by your code. The best is not use the mouse to go in pause mode but a keyboard input for desktop computers.
naelian2012-06-15 20:54:27
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Fri Jun 15, 2012 9:02 pm

is just I wanted to pause the game if accidentally the user clicks out of it, for example if click on a button that is not in my game screen... I wanted it to be a global function to always pause if this happens, trying to make it easy instead of communicating to the html of the page, but I guess is not that simple :/
B
4
S
1
Posts: 22
Reputation: 671

Post » Fri Jun 15, 2012 10:59 pm

You could pause the game when the cursor leaves the window of your game, but if you clicked outside the game would need input from the html page in your case.

Also worth mentioning, if the window (or tab) is not in focus, the game automatically pauses.
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Sat Jun 16, 2012 8:29 pm

oh thanks KFC, I found a workaround without the html page :)
B
4
S
1
Posts: 22
Reputation: 671

Post » Thu Jun 20, 2013 2:26 pm

@Ga2z
Sorry for bumping an old thread but what was your workaround?
I'm currently having the exact same issue and any help would be appreciated.
B
13
S
2
Posts: 87
Reputation: 1,244


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 34 guests