gabrielflorit / script-8.github.io

A JavaScript-based (React + Redux) fantasy computer for making, sharing, and playing tiny retro-looking games.
https://script-8.github.io/
MIT License
646 stars 35 forks source link

Reassign key layout (e.g. from A-B to A-Z) #233

Open colxi opened 5 years ago

colxi commented 5 years ago

In my opinion the usage of A , B , SELECTand START (as labels) is very appropriate considering structure of the classical controllers. However when using a regular keyboard as input interface, the distance between the keys 'A' and 'B' makes the experience very hard. Is almost impossible to achieve any natural mechanics.

What do you think about providing a way to re-map the default keys to a custom layout ?

Something like this l: inputMap( keyboardKeyID , controllerButtonID ) Generate a binding between the provided key, and one of the four available buttons.

// Map any press on the key 83 ('S') to the key B
inputMap( 83 , 'B'  ); 
// Map any press on the key 68 ('D') to the key SELECT
inputMap( 68 , 'SELECT'  ); 
gabrielflorit commented 5 years ago

I agree with A and B being just too far away. I am annoyed by it too! I don't know that I want to provide the ability to re-map keys, but I am considering switching it to A/Z.

colxi commented 5 years ago

I think A-S would be a more relaxed position for the fingers, and even make Space (SELECT) usable with the thumb simultaneously