day10-golden sun

"""__author__ = Smile"""
import pygame
from math import pi
if __name__ == '__main__':
    pygame.init()
    screen = pygame.display.set_mode((800, 600))
    screen.fill((0, 0, 0))

    # 多边形:polygon(Surface, color, pointlist, width=0)
    # 左上点起
    pygame.draw.polygon(screen, (255, 255, 0), [(297, 39), (384, 132), (443, 35), (472, 145), (596, 115), (516, 205),\
                                (622, 257), (507, 298), (538, 424), (444, 368), (403, 479), (350, 361), (260, 424),
                                                (276, 294), (179, 215), (294, 172)])

    pygame.draw.circle(screen, (255, 255, 255), (390, 250), 100)  # 圆脸

    # 眼睛
    pygame.draw.circle(screen, (0, 0, 0), (360, 230), 9)    # 左
    pygame.draw.circle(screen, (0, 0, 0), (420, 230), 9)    # 右

    # 脸庞
    pygame.draw.circle(screen, (255, 0, 0), (340, 270), 15)
    pygame.draw.circle(screen, (255, 0, 0), (445, 270), 15)

    # 鼻子
    pygame.draw.polygon(screen, (0, 0, 0), [(390, 235), (375, 265), (405, 265)])

    # 嘴巴
    pygame.draw.arc(screen, (0, 0, 0), (366, 250, 50, 50), pi/4 + pi, 3 * pi / 2 + pi / 4, 5)

    # 外边的花
    # 上
    pygame.draw.line(screen, (255, 255, 0), (384, 120), (345, 60), 6)   # 线
    pygame.draw.circle(screen, (255, 0, 0), (343, 57), 10)              # 红点
    pygame.draw.line(screen, (255, 255, 0), (384, 120), (382, 45), 6)
    pygame.draw.circle(screen, (255, 0, 0), (382, 45), 10)
    pygame.draw.line(screen, (255, 255, 0), (384, 120), (413, 60), 6)
    pygame.draw.circle(screen, (255, 0, 0), (418, 53), 10)
    # 右上
    pygame.draw.line(screen, (255, 255, 0), (476, 137), (476, 60), 6)
    pygame.draw.circle(screen, (255, 0, 0), (477, 55), 10)
    pygame.draw.line(screen, (255, 255, 0), (476, 137), (520, 62), 6)
    pygame.draw.circle(screen, (255, 0, 0), (520, 65), 10)
    pygame.draw.line(screen, (255, 255, 0), (476, 137), (550, 90), 6)
    pygame.draw.circle(screen, (255, 0, 0), (552, 92), 10)
    # 右1
    pygame.draw.line(screen, (255, 255, 0), (525, 203), (580, 160), 6)
    pygame.draw.circle(screen, (255, 0, 0), (585, 158), 10)
    pygame.draw.line(screen, (255, 255, 0), (525, 203), (600, 185), 6)
    pygame.draw.circle(screen, (255, 0, 0), (605, 185), 10)
    pygame.draw.line(screen, (255, 255, 0), (525, 203), (595, 220), 6)
    pygame.draw.circle(screen, (255, 0, 0), (600, 223), 10)
    # 左上
    pygame.draw.line(screen, (255, 255, 0), (285, 165), (260, 80), 6)
    pygame.draw.circle(screen, (255, 0, 0), (260, 80), 10)
    pygame.draw.line(screen, (255, 255, 0), (285, 165), (225, 110), 6)
    pygame.draw.circle(screen, (255, 0, 0), (220, 105), 10)
    pygame.draw.line(screen, (255, 255, 0), (285, 165), (195, 145), 6)
    pygame.draw.circle(screen, (255, 0, 0), (195, 145), 10)



    pygame.display.flip()

    while True:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                exit()

结果:


day10-golden sun_第1张图片
image.png

你可能感兴趣的:(day10-golden sun)