I'm writing a code in pygame where the user is able to hold down multiple keys at once, however I'm experiencing some strange behaviour with the following line of code:
print(pygame.key.get_pressed()[273:277])
The purpose of this line is to detect which arrow keys are currently being held down (it's using that range because the elements of pygame.key.get_pressed() from positions [273:277] correspond to the 4 arrow keys).
When I press any of the 4 arrow keys individually, it prints correctly, but I find that if I hold down more then 2 arrow keys at once, some keys stop appearing. For example, holding Up, Right, then pressing Left doesn't seem to do anything
At first, I thought it was just that maybe my keyboard was unable to detect more then 2 key presses at a time, but I don't think that's what's happening, as I noted that if I was holding down Up and Down, then pressed Left, it wouldn't register that I was holding Left. However, if I was holding down Up and Down, then pressed Right, it would register the third button press.
Any help is appreciated, thanks!