Why does it say NameError: name 'walk_count2' is not defined when it is defined? I also called the function in a while loop. I also called the function in a while loop.
def animations():
global walk_count1
global walk_count2
screen.fill((45,45,45))
idle[0] = pygame.transform.scale(idle[0], (20,60))
walkRight[0] = pygame.transform.scale(walkRight[0], (30,60))
if walk_count2 + 1 >= 2:
walk_count2 = 0
if walk_count1 + 1 >= 10:
walk_count1 = 0
if right:
screen.blit(walkRight[walk_count2//3], (player_location))
walk_count2 += 1
if still:
screen.blit(idle[walk_count1//3], (player_location))
walk_count1 += 1
pygame.display.update()