Hi, i've noticed recently when testing my game that my mouse cursor often flies off screen and when it does, my game no longer registers any mouse input. Is there a way i can lock the mouse to the screen while the game is running in order to prevent this?
hmm i was thinking maybe the "Bound to layout" Behaviour? But i can't think of a way of using this on the mouse object. Is this possible?
mousex< viewport left...mouse set x to viewport left
mousex> viewport right...mouse set x to viewport right
mouse y<viewport top...mouse set y to viewport top
mouse y > viewport bottom... mouse set Y to viewport bottom...
You may not need all these...
this can get more complex depends on your needs and any layers or scrolling you have going on
I'm sorry , i don't follow. Is this in the events/actions list? I can only seem to find the options to set the mouse cursor to something else...
That are MouseEvents
If the Mouse leaves the TOP of the game, set the Mouse to the top of the game thats it
i hope that helps you understand
Develop games in your browser. Powerful, performant & highly capable.
I still can't seem to find any Mouse events that allow me to set the mouse x or y to anything, nor can i find anything about viewport left/right/top or down. I'm fairly new to this, I'm running the unlicensed , free version of construct 2 if that's the reason? I'm fairly new to this and i just can't seem to find any of these things in the event list. Am i clicking Add event>Mouse, and then these events should be there? That's what I've been trying to no avail so far.
I have a feeling the answer is going to be very obvious, but i've even tried googling words like mousex and viewport left, in different combinations and the only relevant search results are this thread.
Also interested by this and can't find any "set cursor position" action ... Any ideas ?
You can't set mouse's position.
My method is using a sprite as fake cursor (attached below).
[Plugin] Mouse Lock (v0.1)