How can i change the position of the cursor?

i wanna controle stuff in my game with the mouse but for that i need to change the position of the mouse but how can i do this?!

I think it’s impossible control cursor, because it’s the mouse that do this ! Imagine you lost control of cursor in your game, you can not close the game… you lost control of cursor for all your computer too because it’s your game that control it ! I think, you must scroll one object on the cursor, and move this object where you want using events! you can hide the cursor too !

1 Like

It is not possible with GDevelop. Systems do have APIs for moving the cursor but JavaScript engines don’t implement this API in js. Imagine if someone could just send you a website link, you open it and Bam it has controll of your cursor and installs viruses on your computer and sends to your contacts the link to the website. It would be a major security issue.

2 Likes

i couldnt really understand the solution you had can you rewrite it please?

1 Like

-Create an object, and do in events set Always, “object” position to cursor.X(), cursor.Y() !

-Set small size to this object ! 8/8 pixels , and do origin point to center ( 4/4 pixels) !!

  • when you want put your cursor somewhere, put this object at the place, replace all cursor conditions by collisions with this object !

  • ( i am not so experienced, but sometimes, i think you must do other Technic ! or with size scale of different layers, or playing with " center camera and set position to object ) !!! Can you explain me why you want specially move the cursor? that seem very complicated for me…

i am thinking about how i can to do that… try to explain me better for the moment and i comeback later with some tests, i have a idea, but not sure it work… but maybe that can give you idea too :wink:

It’s good, i have find a Technique ! I don’t know if it’s really what you need, but i think that can give you good idea to move cursor in game ( virtual cursor with object…) ! This is the project ! tell me if that is good for you :wink:

i use a custom cursor in generel so ill try it later thanks! <3

okay :wink: what is your technique to custom cursor?