Is it possible to lock the cursor to the window?

Get help using Construct 2

Post » Wed Sep 02, 2015 1:54 am

When exporting with NW.js and not running the game in full-screen, I have a glitch where when the cursor goes out of the window it changes it to the default mouse and it's not changed back upon re-entering the screen. The game is also based on the mouse location so this makes it possible to cheat. Is there anyway to lock the cursor within the window, or emulate such a feature?
B
72
S
24
G
11
Posts: 452
Reputation: 12,385

Post » Fri Sep 04, 2015 7:36 pm

Bump
B
72
S
24
G
11
Posts: 452
Reputation: 12,385

Post » Fri Sep 04, 2015 7:46 pm

As far as I know, no. The engine is based around HTML5 exports so that's probably why we have no mouse cursor control. There may be some NW specific settings, somewhere, but I highly doubt it.
B
56
S
15
G
13
Posts: 826
Reputation: 17,675

Post » Fri Sep 04, 2015 8:01 pm

I never tested but you can try to compare mouse.x with windows width and pause the game when mouse.X is greater than windows width
Image Image
B
25
S
14
G
139
Posts: 876
Reputation: 72,510

Post » Sat Sep 05, 2015 6:56 pm

B
94
S
33
G
114
Posts: 5,359
Reputation: 73,779

Post » Mon Sep 14, 2015 8:46 pm

Most of the mouse conditionals don't work with this because the game doesn't recognize the mouses coordinates if you go outside the window. Mouselock plugin is kind of weird because when you lock the mouse it disappears and that's not an elegant solution.

What I ended up doing was testing if an invisible object following the mouse was within 10 pixels of the border and killing the player then. Thanks for the help!
B
72
S
24
G
11
Posts: 452
Reputation: 12,385

Post » Thu Sep 17, 2015 11:27 pm

ReflextionsDev wrote:What I ended up doing was testing if an invisible object following the mouse was within 10 pixels of the border and killing the player


As the urchins say, "Savage."
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests