pandavigoureux29 Posted February 24, 2014 Share Posted February 24, 2014 Hi all, I searched a long time for a callback that would be called each update when a key is pressed, like a key.onHold.add(this.onHold, this); I wasn't able to find anything close in the doc or the forum, so I decided to do my own manager, and share it here. Bascically the usage is like that : this.keyManager = new InputKeyEventsManager(game,this); That creates an Instance of InputKeyEventsManager. It "inherits" from Phaser.Sprite so the update is automatically called from the game.The parameters are :- the current game reference- the targeted object, on which the callback will be called Then to monitor a key: this.key = this.keyManager.createKey(<Phaser.Keyboard.KeyCode>,<onDown>,<onHold>,<onUp>); That's it. Now that this is done, here's my question :Why would not this be implemented ? Don't misunderstand me, I'm sure there's a good reason and I'm just trying to understand it. It's just ... I was sure this would be implemented when I first saw the Key.onDown and Key.onUp function. So I was very disappointed not seeing an onHold one.Maybe what I'm doing is drastically cutting the performances? Please let me know. Thanks Mefteg 1 Link to comment Share on other sites More sharing options...
rich Posted February 24, 2014 Share Posted February 24, 2014 You may want to look at the revised Keyboard handler in 1.2 Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted February 24, 2014 Author Share Posted February 24, 2014 I'll wait for the release, then (can't seem to find anything on Phaser 1.2 on the github, but I may be retarded ^^ ) Thanks. Link to comment Share on other sites More sharing options...
rich Posted February 24, 2014 Share Posted February 24, 2014 Go to the Phaser github and change the 'branch' drop-down to 1.2. Then you'll see all the changes, the revised code, etc. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted February 24, 2014 Author Share Posted February 24, 2014 Ah yes thanks ! I guess I'm still a newbie on github Link to comment Share on other sites More sharing options...
Mefteg Posted February 24, 2014 Share Posted February 24, 2014 Oh poor boy, you're lost without me, aren't you? Link to comment Share on other sites More sharing options...
Recommended Posts