Legacy GM How to invert mouse movement?

paulog

Member
Hello! I'm making a game in GM1.4 and the room has a draggable view, that can be rotated 90º at a time.

Everything works fine if I compile it to Windows, but in the HTML5 version the mouse movement is flipped when the view is rotated. I don't know why.

Is there an easy way to simply invert mouse X and Y movement in just one object? And if so, is there a way to ask GameMaker to check where the game is running so it can automatically change a variable so that the mouse can work correctly?

Thanks in advance!
 

Sabnock

Member
is this what you want?

draw_sprite(spr_whatever, 0, room_width / 2 - mouse_x, room_height - mouse_y);
 

paulog

Member
is this what you want?

draw_sprite(spr_whatever, 0, room_width / 2 - mouse_x, room_height - mouse_y);
Not exactly

I'm using this code:
GML:
if (mouse_check_button_pressed(mb_right))
{
drag_x  = mouse_x
drag_y = mouse_y
}

if (mouse_check_button(mb_right))
{
view_xview = (drag_x - (mouse_x - view_xview))
view_yview = (drag_y - (mouse_y - view_yview))
}
And when I rotate the view, for example, 180º, when I drag the view down it goes up and when I drag it up it goes down

I want to invert the mouse when I invert the view, but I don't know how to

If I just change (drag_x - (mouse_x - view_xview)) to (drag_x + (mouse_x - view_xview)) it works, but when I click the view jumps to the top left corner of the room
 
Last edited:

paulog

Member
I was changing some options and I found out that disabling WebGL fixes these problems in the HTLM5 compile. It was very simple yet haven't found anyone saying this anywhere.

edit: It was way to easy, now I see that does not solve my problem. By doing this the game view can't rotate at all so it's even worse.

I still want some help if anyone knows how to solve this problem, please
 
Last edited:
Top