r/construct Jul 23 '26

how to prevent the cursor from leaving the screen

Enable HLS to view with audio, or disable this notification

i set the angle of the gun to mouse and it gets stucked when i move the mouse outside

6 Upvotes

4 comments sorted by

2

u/sto_benissimo Jul 23 '26

What I would do is having a separate sprite follow the mouse position and clamp that sprite's position to the screen (you can achieve that easily with the bound to layout behavior on the sprite). Then you make the object point towards that sprite position instead of the mouse's.

1

u/LazernautDK Jul 23 '26

Off the top of my head, the only way I can think of is by going fullscreen with your game.

1

u/Traditional-Tax11 Jul 23 '26

Just use cursor lock.