Help with MouseX() and MouseY()
Monkey Forums/Monkey Programming/Help with MouseX() and MouseY()
| ||
Hi! I'm making some tests on a HTML5 application! I have the following behavior : - If the "cursor" is left of the player, then Player move Left - If the "cursor" is rigth of the player, then Player move Right But I have a problem! My device width is 800. If the current MouseX is 700, and the player quickly move the mouse outside the html5 canvas, the MouseX stay with a value<800, 740 by example, because it does not detect the mouse anymore on canvas. This causes a Bug, because when the player reaches X=740, it thinks that it needs to move left, but this is wrong, because the mouse is on right of the player, but outside the HTML5 canvas. Do you understand my problem? Is it possible to solve this? |
| ||
Use a difference value of MouseX and MouseY, then it doesn't matter if the mouse is outside of the canvas. For example: omx=mx omy=my mx=MouseX my=MouseY dmx=mx-omx dmy=my-omy MovePlayer dmx,dmy |