Bound the players mouse cursor to the game window?

Get help using Construct 2

Post » Fri May 17, 2013 5:57 am

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?

Thanks,Paul.
B
5
Posts: 47
Reputation: 392

Post » Sat May 18, 2013 2:07 am

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?

Paul
B
5
Posts: 47
Reputation: 392

Post » Sat May 18, 2013 3:01 am

Simply put...

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
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sat May 18, 2013 4:43 pm

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

Paul.
B
5
Posts: 47
Reputation: 392

Post » Sat May 18, 2013 6:09 pm

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
B
18
S
6
G
3
Posts: 197
Reputation: 4,129

Post » Fri May 24, 2013 6:57 am

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.

Paul.
B
5
Posts: 47
Reputation: 392

Post » Fri May 24, 2013 7:03 am

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.
B
5
Posts: 47
Reputation: 392

Post » Thu Apr 10, 2014 4:24 pm

Also interested by this and can't find any "set cursor position" action ... Any ideas ?
B
7
S
4
Posts: 124
Reputation: 1,164

Post » Thu Apr 10, 2014 4:51 pm

You can't set mouse's position.
My method is using a sprite as fake cursor (attached below).
You do not have the required permissions to view the files attached to this post.
B
23
S
4
G
2
Posts: 41
Reputation: 1,513

Post » Thu May 01, 2014 7:37 am

B
5
S
1
Posts: 6
Reputation: 287

Next

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul, Yahoo [Bot] and 24 guests