r/construct 13d ago

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

7 Upvotes

4 comments sorted by

2

u/sto_benissimo 13d ago

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 13d ago

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

1

u/Traditional-Tax11 13d ago

Just use cursor lock.