herksaw Posted December 10, 2013 Share Posted December 10, 2013 For example, how do I detect the 'up' key only if users trigger both 'up' and 'down' keys at the same time? Link to comment Share on other sites More sharing options...
XekeDeath Posted December 10, 2013 Share Posted December 10, 2013 Tried this?if ( up is pressed ){ do things;}else if (down is pressed ){ do other things;} Link to comment Share on other sites More sharing options...
herksaw Posted December 10, 2013 Author Share Posted December 10, 2013 Yeah, but the browser just runs both of them. Link to comment Share on other sites More sharing options...
Martiny Posted December 10, 2013 Share Posted December 10, 2013 What XekeDeath said should work. I tried this bit of code and it worked as expected: if (game.input.keyboard.isDown(Phaser.Keyboard.UP)){ console.log("UP");} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)){ console.log("DOWN");}As long as I'm pressing UP, I can press DOWN and it won't execute console.log("DOWN"). That would only work if when the user presses both keys, he presses UP first. Is that what you're looking for? Link to comment Share on other sites More sharing options...
Recommended Posts