Module 7 - Section 0 - Snow fall and snowmen again
7.0.1 - Drawing functions
In the previous module we have created a drawing function to draw a snowman. In the drawing function we have used variables to draw the snow man in different position inside the screen.
The function was written outside the pygame main loop:
def draw_snowman(screen, x, y):
# Draw a circle for the head
pygame.draw.circle(screen, WHITE, [60 + x, 50 + y], 15)
# Draw the middle snowman circle
pygame.draw.circle(screen, WHITE, [60 + x, 80 + y], 20)
# Draw the bottom snowman circle
pygame.draw.circle(screen, WHITE, [60 + x, 120 + y], 30)
# Draw the buttons
pygame.draw.circle(screen, BLACK, [60 + x, 120 + y], 6)
pygame.draw.circle(screen, RED, [60 + x, 120 + y], 4)
pygame.draw.circle(screen, BLACK, [60 + x, 100 + y], 6)
pygame.draw.circle(screen, RED, [60 + x, 100 + y], 4)
pygame.draw.circle(screen, BLACK, [60 + x, 80 + y], 6)
pygame.draw.circle(screen, RED, [60 + x, 80 + y], 4)
#Draw the hat
pygame.draw.rect(screen, BROWN, [45 + x, 8 + y, 30,30])
pygame.draw.rect(screen, BROWN, [30 + x, 34 + y, 60,5])
#Draw the eyes
pygame.draw.circle(screen, BLACK, [54 + x, 44 + y], 3)
pygame.draw.circle(screen, BLACK, [66 + x, 44 + y], 3)
#Draw the mouth
pygame.draw.arc(screen, RED, [50 + x, 40 + y, 20, 20] , 3.34, 6.08,3)
#Draw the nose
pygame.draw.polygon(screen, ORANGE, [[58 + x , 46 + y], [60 + x , 54 + y], [72 + x, 60 + y]], 0)