-
Notifications
You must be signed in to change notification settings - Fork 2
Mouse
Joel Martinez edited this page Jul 1, 2013
·
3 revisions
This feature has a dependency on jQuery
-
engineInstance.InputManager.mouse.y
- the mouse's vertical position, relative to the canvas. coordinates begin at 0,0 in the top left. -
engineInstance.InputManager.mouse.x
- the mouse's horizontal position, relative to the canvas. coordinates begin at 0,0 in the top left. -
engineInstance.InputManager.mouse.worldX
- the mouse's horizontal position in world space -
engineInstance.InputManager.mouse.worldY
- the mouse's vertical position in world space (inverted Y) -
engineInstance.InputManager.mouse.leftButton
- will be true if the button is being held down -
engineInstance.InputManager.mouse.rightButton
- will be true if the button is being held down -
engineInstance.InputManager.mouse.middleButton
- will be true if the button is being held down
You can make a sprite follow the mouse by using:
game.ball.x = engineInstance.InputManager.mouse.worldX;
game.ball.y = engineInstance.InputManager.mouse.worldY;