• 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 x = mouse_x not working in html5

M

Mick1001

Guest
Hey everybody

I making af game where the position af the object is the same as the mouse, so the object follow the mouse.
It works fine in test but not in html5

please help .-)

Thank you
 

rIKmAN

Member
What event are you putting that code in?

It needs to go in an event that runs every frame like the Step Event.
 
M

Mick1001

Guest
It is in the step event
It works fine when I run it en test mode and not html5
 
M

Mick1001

Guest
How do I use code tags?

My code en step event for object is:
x = mouse_x
y = mouse_y
 

rIKmAN

Member
I believe you need to use device_mouse_x/y or display_mouse_get_x/y
mouse_x and mouse_y work fine in HTML5, so the issue is elsewhere.
(I just tested on the latest GMS2 Beta and had no issues with a standard 1024x768 room and an object that follows the mouse).
How do I use code tags?

My code en step event for object is:
x = mouse_x
y = mouse_y
What version of GMS are you using?
Have you placed the object into the room?
Is the room bigger than the display resolution?
Are you using views?
 
M

Mick1001

Guest
I using 2.2.1.291
The object gets created when I left pressed.
I think the room are bigger use 1280x768
No views
 
M

Mick1001

Guest
I think I found the problem.
In html5 it create a different object that it do when I run the test.
And that object as not that code

I delete it and startet over.

Thank you for your help and time
 
Last edited by a moderator:
Top