Limit Mouse

0 favourites
  • 5 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Is there any way to limit the position of the mouse to an area of the screen?

  • 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".

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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 ?

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