read WASD/ZQSD specifically

It might be useful to detect the arrow keys and WASD separately (eg for a multiplayer game), and while you can just do keyboard.W and keyboard.ARROW_UP, you would lose support for different keyboard layouts.

It would be nice to have something like keyboard.WASD_UP to detect only WASD, ZQSD, etc.

+1 this is definitely needed

I just added it here: https://github.com/pmgl/microstudio/issues/141

Actually I just remembered that you can already rely on:

  • keyboard.KEY_W
  • keyboard.KEY_A
  • keyboard.KEY_S
  • keyboard.KEY_D

These reflect the position of the keys on the keyboard, rather than the actual key label ; thus they will automatically be mapped to ZQSD or any other natural WASD scheme on the keyboard layout you are using.

What about people who are writing their code on ZQSD keyboards? I don't have one, so I don't know, but wouldn't it be a bit confusing that when they press Z they get a result for W?

@JmeJuniper, if you press Z on a ZQSD (AZERTY) keyboard, you will get both fields set:

  • keyboard.Z - user pressed key labelled Z
  • keyboard.KEY_W - the key pressed corresponds to a W on a QWERTY keyboard

If you press W on a WASD (QWERTY) keyboard, you will get:

  • keyboard.W - user pressed key labelled W
  • keyboard.KEY_W - the key pressed corresponds to a W on a QWERTY keyboard

Thus you can safely rely on keyboard.KEY_* for WASD input and on keyboard.[A-Z] for text input.

Ohh that makes sense, thank you :)

Right, I actually did notice the KEY_* fields a while ago and assumed that's what they were for, but I couldn't test since I only have a standard QWERTY keyboard.

This topic should have been me asking if that's how they work, but I completely forgot about them as well.

Post a reply



Validate your e-mail address to participate in the community