Ninjadoodle Posted October 1, 2014 Share Posted October 1, 2014 Hi guys Is there a way to get the mouse/touch position in panda? I looked around but can't seem to find anything about it. Thank you in advance! Quote Link to comment Share on other sites More sharing options...
enpu Posted October 2, 2014 Share Posted October 2, 2014 game.createScene('Main', { mousedown: function(event) { var x = event.global.x; var y = event.global.y; }, mousemove: function(event) { var x = event.global.x; var y = event.global.y; } }); Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 2, 2014 Author Share Posted October 2, 2014 Hi @enpu Thank you heaps! Quote Link to comment Share on other sites More sharing options...
gaelbeltran Posted November 29, 2015 Share Posted November 29, 2015 game.createScene('Main', { mousedown: function(event) { var x = event.global.x; var y = event.global.y; }, mousemove: function(event) { var x = event.global.x; var y = event.global.y; }});Did something on pandajs change? I tried this but didn't work Quote Link to comment Share on other sites More sharing options...
Eizch Posted November 29, 2015 Share Posted November 29, 2015 Probably changed I guess, look at the doc. http://ekelokorpi.github.io/panda.js-site/engine/docs/classes/Scene.html#method_mousedown So now it will look likegame.createScene('Main', { mousedown: function(x, y) { console.log(x, y); }, mousemove: function(x, y) { console.log(x, y); }}); Quote Link to comment Share on other sites More sharing options...
gaelbeltran Posted November 30, 2015 Share Posted November 30, 2015 Probably changed I guess, look at the doc. http://ekelokorpi.github.io/panda.js-site/engine/docs/classes/Scene.html#method_mousedown So now it will look likegame.createScene('Main', { mousedown: function(x, y) { console.log(x, y); }, mousemove: function(x, y) { console.log(x, y); }});Thanks! this worked. Quote Link to comment Share on other sites More sharing options...
enpu Posted November 30, 2015 Share Posted November 30, 2015 You can also get latest mouse position fromgame.input.mouse.xgame.input.mouse.y gaelbeltran 1 Quote Link to comment Share on other sites More sharing options...
gaelbeltran Posted November 30, 2015 Share Posted November 30, 2015 Thanks, this looks more convenient! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.