the r or the escape press isn't when i press esc it shuts down and gives an error (AttributeError: 'Event' object has no attribute 'KEY') i cant figur out why it gives that error. and the r press just isn't working
collision = iscollision(player_x, player_y, apple_x, apple_y)
if collision:
game_over(over_x, over_y)
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
run = False
if event.KEY == pygame.K_r:
score = 0
apple_speed = 0.05
apple_x = random.randint(0, 550)
apple_y = random.randint(0, 500)