I'm trying to learn about pygame, and in this course I have been asked to use event.key to check if the user presses a certain key and to perform actions accordingly. However, the system doesn't recognize "key" (inside the for loop) as an attribute of any of my classes, and VSC reads "any" when I hover my cursor over it...
def run_game_loop(self):
    player_direction = 0
    self.draw_objects()
    while True:
        events = pygame.event.get()
        for event in events:
            if event.type == pygame.QUIT:
                return
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_UP:
                    player_direction = -1
                if event.key == pygame.K_DOWN:
                    player_direction = 1
        self.player.move(player_direction) 
        self.clock.tick(60)
Any idea why this happening and how I can solve it? I know it is probably a silly problem with an even sillier solution, but I am a complete noob at coding so please bear with me :)
