You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i use those (K_RIGHT , K_LEFT), it dose work, but dysfunctional in "K_d" or other letters.
even if i write this:
def input():
if pygame.key.get_pressed()[pygame.K_RIGHT]:
print("right")
elif pygame.key.get_pressed()[pygame.K_d]:
print("d")
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.
import pygame
import sys
pygame.init()
GameWindow = pygame.display.set_mode((1280,720))
pygame.display.set_caption("test")
def input():
if pygame.key.get_pressed()[pygame.K_RIGHT]:
print("right")
elif pygame.key.get_pressed()[pygame.K_d]:
print("d")
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
input()
The text was updated successfully, but these errors were encountered:
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: