Sep-28-2018, 10:16 PM
I can't get it to detect what key is being pressed.
if i'm pressing w, s, a, or d it won't print 'w', 's', 'a' or 'd'
I don't know what i'm doing wrong here
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((640, 400))
while True:
for event in pygame.event.get():
print('e')
if event.type == pygame.KEYDOWN:
print('q')
if event.type == K_w:
print('w')
if event.type == K_s:
print('s')
if event.type == K_a:
print('a')
if event.type == K_d:
print('d')it will print 'e', and if i'm pressing a key it will print 'q', butif i'm pressing w, s, a, or d it won't print 'w', 's', 'a' or 'd'
I don't know what i'm doing wrong here
