Block Mouse From Moving Past Certain Point?

Hey everyone, new game designer here. I love Gdevelop so far!!

I am making a top down WW2 shooter/rts game.
The mouse rotates the player exactly like the turret example in the wiki. I have also hidden the mouse with “hide the cursor” and replaced it with a cross hair using the “change the position of” action.
TL;DR: Mouse is replaced with a crosshair.

When I test out the game everything works fine unless my mouse moves too far above the rendered area, into the File, Edit, View etc area. then the mouse appears there, and cuts off control for the player.

Is there a way to make it so the mouse does not move past a certain X or Y position? I want the mouse boundary to be a circle around the player in essence.

Restrict by always adjusting the X/Y position if the mouse cursor if far from xxxx/yyyyy

Like
----- Always
------ if Mouse.X > 120
------ if Mouse.Y > 100
----- Set Mouse.X = 120
----- Set Mouse.Y = 100

2 Likes

Thank you Ulises, I am now trying to make it so the cursor/crosshair does not go past the gun’s x or y position. I got it to work so that when on a positive side of the map’s coors, it does not go past it. but when I do negative sides, I can’t. How do i change the operators to make this work?