hugosaintemarie / magic-maze

Online version of board game "Magic Maze"
https://magicmaze.herokuapp.com
MIT License
20 stars 11 forks source link

Support WASD keybindings #36

Closed rcjsuen closed 3 years ago

rcjsuen commented 3 years ago
Key Command
S Move map up
Z Move map down
D Move map left
Q Move map right

Can we change the movement keys to be WASD like some computer games? I recognize this will mean the other keybindings will also have to change but I want to see if people are okay with this proposal first.

rcjsuen commented 3 years ago
Command Original New Reason
Activate explore (double click on the tile to place) C F This change will help make all keys for the index finger be on the home row or the upper row.
Rotate new tile clockwise (or use Right Mouse click) T T --
Rotate new tile counter clockwise R R --
Cancel current action Esc Esc --
Pause game P Spacebar Makes this easier to hit without having to move your hand across the keyboard or off the mouse.
Toggle grid G G --
Move map up S W This is the aforementioned WASD change.
Move map down Z S This is the aforementioned WASD change.
Move map left D A This is the aforementioned WASD change.
Move map right Q D This is the aforementioned WASD change.
Zoom map in E E --
Zoom map out A Q Since zooming in is E on the top right side of the WASD keybindings, Q on the left seems to make sense.

@ashugeo What do you think of the above changes?

hugosaintemarie commented 3 years ago

Hello @rcjsuen 👋

Thank you for this issue! Indeed, I understand the keyboard shortcuts are not great for a QWERTY keyboard. I have a french keyboard and they have an AZERTY layout!

Do you think there could be an easy way to support different keyboard layouts? As in, can we reference the keys through a position rather than the key (letter) itself?

Otherwise, the most scalable option would probably be to have the shortcuts programmable/customizable with different pre-made layouts and a default one…

rcjsuen commented 3 years ago

Thank you for this issue! Indeed, I understand the keyboard shortcuts are not great for a QWERTY keyboard. I'm have a french keyboard and they're mapped on an AZERTY keyboard!

@ashugeo Ah, that explains things. :P

Do you think there could be an easy way to support different keyboard layouts? As in, can we reference the keys through a position rather than the key (letter) itself?

I think event.location may help with this.

Otherwise, the most scalable option would probably be to have the shortcuts programmable/customizable with different pre-made layouts and a default one…

Yes, full customization is most certainly the best long-term solution and would help make the game accessible for everyone.

rcjsuen commented 3 years ago

I think event.location may help with this.

Never mind, I misread this completely. We can't use this.

rcjsuen commented 3 years ago

We can use event.code instead, will work on a fix for this...

rcjsuen commented 3 years ago

@ashugeo I've opened #37 to address this.

hugosaintemarie commented 3 years ago

I think event.location may help with this.

Never mind, I misread this completely. We can't use this.

That's what I was thinking 😅

Thanks a lot for #37! Will comment on it there.

rcjsuen commented 3 years ago

@ashugeo Thanks for reviewing the change. I've confirmed that it works fine on a QWERTY keyboard. Hope it's good on your AZERTY!

hugosaintemarie commented 3 years ago

@ashugeo Thanks for reviewing the change. I've confirmed that it works fine on a QWERTY keyboard. Hope it's good on your AZERTY!

Seems to be working just fine! Thanks again for your help. 😊