agmcleod Posted March 7, 2014 Share Posted March 7, 2014 Wondering if there's a way to detect input on a keypress, and only register it again if the user releases and presses the key a second time. Can be useful for things like UI, or certain player interactions. Looking at the docs, I don't believe there's a specific method for this. Link to comment Share on other sites More sharing options...
lessmilk Posted March 7, 2014 Share Posted March 7, 2014 Yes, you can! Add these two lines in your create function. It will call fooFunction once every time the space key is pressed.var space_key = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);space_key.onDown.add(this.fooFunction, this); Link to comment Share on other sites More sharing options...
agmcleod Posted March 8, 2014 Author Share Posted March 8, 2014 Ah thanks very much! Link to comment Share on other sites More sharing options...
Recommended Posts