• 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!

HTML5 HTML5 mouse offset and other issues

E

Emanuel Cant

Guest
Hi all!
Has anyone had mouse_y offset issue in HTML5?
My mouse pointer seems to have an ever increasing offset on y axis. Close to y = 0 offset is 0 but as i move mouse down there appears to be an offset. All objects and buttons detect mouse enter way too early. But it is completely fine in windows.
I created new game just with buttons and it works fine.

And.. has anyone actually made any working web game???
I read article about Issues and differences with HTML5 but these issues mentioned in there seem just like a tip of an iceberg of endless bugs.

Im using GMS2
 
Last edited by a moderator:
F

FluencyGames

Guest
I also ran into this problem porting one of my apps yesterday. Digging into the problem today to see if I can find a work around. Seems related when the window size is different from the room size, mouse coordinates are not being properly calculated.

EDIT: Confirmed. mouse_x and mouse_y built in variables are not being scaled correctly when the window size is different from the room size.

You can work around this by manually checking for your mouse coordinates in a step event:

Code:
// STEP event 
var xx = mouse_x;
var yy = mouse_y;

if(os_browser != browser_not_a_browser) {
  xx *= (room_width/window_get_width());
  yy *= (room_height/window_get_height());
}

// check for mouse in our UI
if(position_meeting(xx,yy,self)) {
  if(mouse_check_button_pressed(0,mb_left)) {
    // .. handle mouse down event
 }
 if(mouse_check_button_released(0,mb_left)) {
    // .. handle mouse clicked (released) event
 }
}
Reporting bug now.
 
Last edited by a moderator:
Top