美文网首页
画图之手动斜眼之亮瞎你的钛合金狗眼之牛气哄哄

画图之手动斜眼之亮瞎你的钛合金狗眼之牛气哄哄

作者: 02b2972e6a93 | 来源:发表于2018-07-29 14:32 被阅读0次
import pygame
import random
pygame.init()
window = pygame.display.set_mode((600,600))

left_eye_x = 273
right_eye_x =360
add = 0
while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            exit()

    window.fill((255, 255, 255))
    pygame.draw.ellipse(window,(0,0,255),(200,100,200,150))
    pygame.draw.line(window,(0,0,0),(228,160),(278,160),2)
    pygame.draw.line(window,(0,0,0),(314,160),(363,150),2)
    pygame.draw.line(window,(0,0,0),(314,190),(363,190),2)
    pygame.draw.circle(window,(random.randint(0,255),random.randint(0,255),random.randint(0,255)),(left_eye_x,165),6)
    pygame.draw.circle(window,(random.randint(0,255),random.randint(0,255),random.randint(0,255)),(right_eye_x,158),6)


    if left_eye_x == 273:
        add = -1
    if left_eye_x == 243:
        add = 1
    if add > 0:
        left_eye_x += add
        right_eye_x += add
    else:
        left_eye_x += add
        right_eye_x += add
    pygame.display.flip()
    pygame.time.delay(50)
1.png
4.png

相关文章

网友评论

      本文标题:画图之手动斜眼之亮瞎你的钛合金狗眼之牛气哄哄

      本文链接:https://www.haomeiwen.com/subject/ayizmftx.html