spinnerbox Posted May 8, 2016 Share Posted May 8, 2016 Is there a way to see the full list of keyboard buttons? For example Phaser.Keyboard.SPACEBAR, Phaser.Keyboard.ONE, Phaser.Keyboard.TWO etc... I cannot see these "constants" in the phaser 2.2.2 docs. For example I need dot, single quote, dash(minus), ~ Link to comment Share on other sites More sharing options...
in mono Posted May 9, 2016 Share Posted May 9, 2016 Here they are for 2.2.2 - https://github.com/photonstorm/phaser/blob/v2.2.2/src/input/Keyboard.js#L579 I don't know why they aren't listed in the docs. By the way, why are you using 2.2.2 (if you don't mind me asking)? spinnerbox 1 Link to comment Share on other sites More sharing options...
spinnerbox Posted May 9, 2016 Author Share Posted May 9, 2016 The previous game I made was in version 2.2.2 so I decided not to bother with newer version since problems might appear. If I find time for that will upgrade it. No forward slash? => Keycode 47 = Keyboard.HELP Link to comment Share on other sites More sharing options...
spinnerbox Posted May 20, 2016 Author Share Posted May 20, 2016 Any ideas how can i separate keys that have alphabet letters including space, dot, dash, tilde from other buttons? Yes letter buttons have keypress event additionally while other non-letter buttons have only keydown and keyup but how could I do this in Phaser? Are there some helper properties that can aid me in this task? I want to effectively disable(override default behavior) all other keys except letter keys, dot, dash and space. Could I do this somehow automatically or I have to go key by key? Here is code I use to override default behavior of some of the buttons: sendOtherKey = function (kbBtn) { // do some stuff with kbBtn }; myBackspaceKey = game.input.keyboard.addKey(Phaser.Keyboard.BACKSPACE); myBackspaceKey.onDown.add(sendOtherKey, this); Link to comment Share on other sites More sharing options...
drhayes Posted May 20, 2016 Share Posted May 20, 2016 I'm not entirely sure how to cancel/stop all other keys in Phaser. You could dip outside of Phaser and add the event listeners to the canvas directly. Then you could call "stopPropagation" and "preventDefault" on them yourself, and handle the ones you care about directly. Link to comment Share on other sites More sharing options...
spinnerbox Posted May 20, 2016 Author Share Posted May 20, 2016 Ok, whatever, will do one by one, but thanks for the JS/DOM tips Link to comment Share on other sites More sharing options...
Recommended Posts