I have the following code for an application I am developing in pygame. When I click the down key or any key for that matter, "here" is not being printed. The code is as follows:
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
if event.type == pygame.KEYDOWN:
print("here")
if event.key == pygame.K_DOWN:
player_speed += 7
if event.key == pygame.K_UP:
player_speed -= 7
if event.type == pygame.KEYUP:
print("here")
if event.key == pygame.K_DOWN:
player_speed -= 7
if event.key == pygame.K_UP:
player_speed += 7
Where is the error here (it is not a syntax one as the code runs fine - it is just indented weirdly on this post)? Is there another requisite prior to taking in keyboard input.