mrkiwiman Posted September 18, 2018 Share Posted September 18, 2018 This is my code right now to check if left or right mouse button is down: // Left button down app.stage.on("mousedown", function() { // code... }); // Right button down app.stage.on("rightdown", function() { // code... }); But it doesn't seems to be possible that both events happen at the same time. How would I check if both mouse buttons are pressed? Left and right. Quote Link to comment Share on other sites More sharing options...
Wilco93 Posted September 19, 2018 Share Posted September 19, 2018 I would code it as follows: var rightDown = false; // Left button down app.stage.on("mousedown", function() { if (rightDown){ // both buttons are down // only need this functionality of course on one button } }); // Right button down app.stage.on("rightdown", function() { rightDown = true; }); // Right button up app.stage.on("rightup", function() { rightDown = false; }); Quote Link to comment Share on other sites More sharing options...
mrkiwiman Posted September 19, 2018 Author Share Posted September 19, 2018 Or can I maybe just somehow check in this loop app.ticker.add(function(delta) { }); if a key is down or not? Instead of doing it via events 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.