How do I keep the cursor in game frame or window?

Get help using Construct 2

Post » Mon Aug 27, 2012 8:02 am

I noticed in some games the cursor likes to leave the window. This becomes somewhat a problem when games require constant attention and reaction when playing, whether it be shooting a horde of zombies or moving a bar to keep objects from leaving the level, etc. Is there a way to keep the cursor in the game window or frame during play?

I do apologize if the question on a related subject has been asked already. I had trouble finding it if so.DiGiCORE2012-08-27 08:04:20
- Diji
B
23
S
4
G
4
Posts: 54
Reputation: 3,996

Post » Mon Aug 27, 2012 2:27 pm

If you could do this, you would be able to trap someone's cursor inside an application!

Just make sure the cursor is visible, and it should be fairly difficult for someone to lose it.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Aug 27, 2012 3:00 pm

only workaround I would know at the moment is to set the game to fullscreen and let the player press F11 to switch the browser into real full screen mode too.
B
42
S
9
G
6
Posts: 437
Reputation: 5,626

Post » Mon Aug 27, 2012 3:03 pm

Another option might be to pause the game when the mouse cursor leaves the view port.

Here is an example: https://dl.dropbox.com/u/38038537/examples/MouseInGame_example.capx
Wastrel2012-08-27 15:09:59
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Tue Aug 28, 2012 12:21 am

@sqiddster Good point. I do see how that could very well be misused. Understandable why it can't and shouldn't be implemented.

@Ubivis Yea, usually what I like to do.

@Wastrel Very useful, thank you! Why didn't I think of that?

Thanks, guys!
- Diji
B
23
S
4
G
4
Posts: 54
Reputation: 3,996


Return to How do I....?

Who is online

Users browsing this forum: bluemonkey, MarkThomas and 20 guests