-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyboard input won't work #4164
Labels
Comments
Instead of using pygame.K_d, you should use pygame.K_d + 32 to get the equivalent ASCII value. You can try: import pygame pygame.init() GameWindow = pygame.display.set_mode((1280, 720)) def input():
while True:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment:
i want to control my role's movement by press "a", "d", and i used "pygame.key.get_pressed()[pygame.K_d]:", but it won't work.
Current behavior:
it seems only receive arrow-key signal like :
when i use those (K_RIGHT , K_LEFT), it dose work, but dysfunctional in "K_d" or other letters.
even if i write this:
when i run this code, if i press right arrow key, it will give me "right", but when i press "d", i got nothing. even worse, after i pressed key_d, the whole input function turn into dysfunctional, which means now i press right arrow key, i also get nothing.
no error hint.
Expected behavior:
is there anyway can fix this problem?
Test code
If possible add a simple test program that shows the problem described in this report.
The text was updated successfully, but these errors were encountered: