spinnerbox

Browse full list of keyboard buttons

Recommended Posts

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), ~ 

Share this post


Link to post
Share on other sites

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);

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.