Is your feature request related to a problem? Please describe.
Not really but TETR.IO supports it and there is no reason not to.
Describe the solution you'd like
A way to bind multiple keys to the same action. (eg. both ArrowUp
and KeyZ
binds to CW
)
Describe alternatives you've considered
Not really any other way besides getting keyboard software or something to rebind the keys outside of the browser.
Additional context
Not high priority but worth adding later on in the future.
The current implementation of the controls is a Object
with a single key input and an action as key/value pairs:
var ctrl = {
ArrowLeft: 'L',
ArrowRight: 'R',
ArrowDown: 'SD',
Space: 'HD',
ShiftLeft: 'HL',
KeyZ: 'CW',
KeyX: 'CCW',
KeyC: 'R180',
KeyR: 'RE',
KeyT: 'UNDO',
KeyY: 'REDO',
};
A way to implement multiple keybindings is to invert this Object
and add an Array
of possible key inputs:
var ctrl = { // guideline settings
'L': [ArrowLeft],
'R': [ArrowRight],
'SD': [ArrowDown],
'HD': [Space],
'HL': [ShiftLeft, KeyC],
'CW': [KeyZ, ArrowUp],
'CCW': [KeyX, ControlLeft],
'R180': [KeyA],
'RE': [KeyR],
'UNDO': [KeyT],
'REDO': [KeyY]
};
However, checking for inputs using this method will take significantly more time as more inputs are added.
An alternative method is to keep on using the key/value pair but allow users to add more pairs but prevent duplicate or conflicting binds.