A
aGreenCrystal
Guest
Hello.
I'm trying to make an instance move with the mouse,
but I want the camera to move with it, too.
I tried simply testing for mouse_x changes,
but when it moved the camera, the mouse_x changed,
and it moved the camera, ...
So I made it that the mouse gets put into the middle,
you move it, the position get saved, the mouse gets put into the middle,
and you move the difference between before mouse to middle and after mouse to middle.
Any idea why that doesn't work?
Code:
oldmx = mouse_x;
oldmy = mouse_y;
display_mouse_set(display_get_width()/2, display_get_height()/2);
x += oldmx - mouse_x;
y += oldmy - mouse_y;
I'm trying to make an instance move with the mouse,
but I want the camera to move with it, too.
I tried simply testing for mouse_x changes,
but when it moved the camera, the mouse_x changed,
and it moved the camera, ...
So I made it that the mouse gets put into the middle,
you move it, the position get saved, the mouse gets put into the middle,
and you move the difference between before mouse to middle and after mouse to middle.
Any idea why that doesn't work?
Code:
oldmx = mouse_x;
oldmy = mouse_y;
display_mouse_set(display_get_width()/2, display_get_height()/2);
x += oldmx - mouse_x;
y += oldmy - mouse_y;