• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM mouse following object

Y

Yvalson

Guest
So I looked around and I have seen alot of how do I make my object follow the mouse threads. but my question is: how can I make my mouse follow an object.
I need this so I can use a custom cursor object that acts like a mouse but I can't find any functions that let you change the mouse position (this is also for android which makes it even more difficult
 

Rivo

7014
the mouse has an x and y position: mouse_x and mouse_y. You can make the mouse_x and mouse_y = the object x and y e.g. mouse_x = x mouse_y = y; yeah??? if you wanna use custom cursor thats easy look it up in the manual no prob mate
 
Y

Yvalson

Guest
the mouse has an x and y position: mouse_x and mouse_y. You can make the mouse_x and mouse_y = the object x and y e.g. mouse_x = x mouse_y = y; yeah??? if you wanna use custom cursor thats easy look it up in the manual no prob mate
mouse_x and mouse_y are both read only and because of that you can't change them
 

TheouAegis

Member
You need to use the mouse_set_position functions. And if for some reason those aren't going to work for you, then perhaps you should try to create your own Mouse coordinates and use those instead of the built-in ones. It's a bit odd, but it is doable.
 
Y

Yvalson

Guest
You need to use the mouse_set_position functions. And if for some reason those aren't going to work for you, then perhaps you should try to create your own Mouse coordinates and use those instead of the built-in ones. It's a bit odd, but it is doable.
will try that
but how can I create my own mouse coördinates when I need the mouse pressed event for my object but by creating my own coördinates I'm basically dismissing the existence of the mouse
 

TheouAegis

Member
Is it the event for clicking on an object or event for just clicking anywhere? The global mouse event? As long as you don't use the event that requires the mouse to be clicking on an actual object, so as long as you're using the global mouse events, van it would be handled just like any other Collision detection code.

if position_meeting(fakemouse_x, fakemouse_y, id) {
 
Top