My problem appeared when I tried to make my character walk by changing one variable and thus starting an animation.The problem however is that i get an AttributeError where "'Event' object has no attribute 'key'". I find it very strange as I have written this exact code before put this problem has never appeared in previous uses. I have tried rewriting the code many times, putting it outside of the event check and inside but nothing have worked.
while turnoff == False:
screen.fill(white)
# event checks
for event in pygame.event.get():
if event.type == pygame.QUIT:
turnoff = True
elif event.type == pygame.MOUSEBUTTONDOWN:
#supposed to identify which key but can't make it work
if event.key == pygame.K_DOWN:
action -= 1
frame = 0
if event.key == pygame.K_UP:
action -= 3
frame = 0
The error I get is if event.key == pygame.K_DOWN: AttributeError: 'Event' object has no attribute 'key'