Jump to content

Detect one key pressed at a time


herksaw
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...