ZeCryptic / osu-cat

141 stars 29 forks source link

Keybindings #17

Open hdmxxy opened 6 years ago

hdmxxy commented 6 years ago

Is there any way to make my key 1 and 2 to arrows? I've tried putting "left arrow" or ← but none work. Thanks in advance and great project.

GarrettBurroughs commented 6 years ago

Looking at how the code is written, the correct binding would be "up", "down", "left", and "right", for arrow keys, because of how key_pressed() works You can read about it here

but there is also a check that makes it so that the key codes are 1 character wrong.

I would suggest changing the code from

if len(k1) == 1 and len(k2) == 1:
        break
    else:
        print('Keys can only be 1 character long')

to

arrowKeys = ["up", "down", "left", "right"]
if len(k1) == 0 or k1 in arrowKeys and len(k2) == 0 or k2 in arrowKeys:
    break;
else:
    print('Keys can only be 1 character long, or arrow keys such as \'up\', \'right\', \'left\', or \'down\'')

I'll test this out on my own and submit a PR for it if it works