I made a game and used pygame module as the keyboard input. however, it does not seem to respond. there is no error, but my keypress does nothing when I run the code.
I tried using pygame.key but it does not work.
I have no idea what is wrong with this code.
import pygame
pygame.init()
class keypress():
def check(self):
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.KEYDOWN:
print("Hey, you pressed the key, '0'!")
if event.key == pygame.K_1:
print("Doing whatever")
else:
pass
a = keypress()
if __name__ == "__main__":
while True:
a.check()
When I press keys, it does basically nothing.