Limit Mouse

Discussion and feedback on Construct 2

Post » Wed Jun 06, 2012 9:07 pm

Is there any way to limit the position of the mouse to an area of the screen?
B
27
S
2
G
3
Posts: 61
Reputation: 2,498

Post » Wed Jun 06, 2012 9:28 pm

Not possible unless using special things for every browser depending on them ... scripts/applets etc ..

So consider that :

1/ you can't move the mouse by code
2/ you can't managed effect with mouse (cursor and good X/Y pos) if out of game area

If you want to use mouse as a gamepad you can try using "touch" (in mouse mode) on a game area objet where "mouse" management is required but also the problem is that "click/touch" is needed to have data ... the good thing is that make your game "touch" compliant for "mobiles".naelian2012-06-06 22:05:33
B
16
S
5
G
3
Posts: 298
Reputation: 5,240

Post » Wed Jun 06, 2012 10:44 pm

You could set the mouse cursor to 'no cursor', make your own cursor, set position to mouse.x, mouse.y, except for certain X and Y limits you set. This would give the appearance of constraining the cursor.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Jun 07, 2012 1:10 am

If this was possible, it's generally very annoying for visitors to lose complete control of their mouse, so I would not want to add support for it. However @sqiddster's solution should work fine.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Jun 07, 2012 2:11 am

The mouselock API seems like the solution to this (once it's implemented in browsers).
@Ashley are you meaning you won't implement it ?

I understand it can have drawbacks (a malicious element onscreen capturing and locking the mouse cursor isn't indeed something we want to see), but if implemented like for audio or events of the like under user's action, it should be fine, shouldn't it ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests