In addition to mouse clicks (or tablet finger-pointing), can I connect up keypresses to UI events?
In my card game, after a player selects 1 card, the player might want to discard it, or they might want to put it in a different location in their hand (e.g. to group up like-cards).
Now I show buttons for SORT and DISCARD and force them to click. How can I add keyboard shortcuts "S" and "D" so that after they use the mouse to select a card, when they press D then the card is discarded?
I've looked at some other games but do not see this capability. Also when I type, the chat window opens automatically. It would be OK for my game to show a toggle ALLOW KEYBOARD SHORTCUTS ON/OFF or similar to allow interested players to do this, and I would filter the keypresses or send them through to chat.
Any ideas? Thanks!
Code: Select all
// This works
dojo.connect( this.playerHand, 'onChangeSelection', this, 'onPlayerHandSelectionChanged' );
// I would like to also have this:
dojo.connect( this.playerHand, 'onkeypress', this, 'onPlayerHandKeypress' );
Now I show buttons for SORT and DISCARD and force them to click. How can I add keyboard shortcuts "S" and "D" so that after they use the mouse to select a card, when they press D then the card is discarded?
I've looked at some other games but do not see this capability. Also when I type, the chat window opens automatically. It would be OK for my game to show a toggle ALLOW KEYBOARD SHORTCUTS ON/OFF or similar to allow interested players to do this, and I would filter the keypresses or send them through to chat.
Any ideas? Thanks!