以下是部分代码预览:
"""这是我用pygame制作的一个对话小程序,一个男孩和一个女孩进行对话。""" import pygame from pygame.locals import * width,height = 960,720 sentences = ["我爱Python","真的吗?","当然是真的,我每天都用Python","我跟你学可以吗?","当然可以啊。","现在就开始吧。","。。。。。"] background_image = "饭桌.png" boy_image = "男孩.png" girl_image = "女孩.png" pygame.init() screen = pygame.display.set_mode((width,height)) pygame.display.set_caption("pygame动画制作男孩女孩by李兴球@2018") screen.blit(boy,(0,200)) screen.blit(girl,(700,200)) pygame.display.update() font = pygame.font.Font("msyh.ttf",26) colors = [(0,0,250),(205,10,150)] time_counter = 0 clock = pygame.time.Clock() running = True while running: # 单击等待结束 clock.tick(60) event = pygame.event.wait() if event.type == QUIT or event.type==MOUSEBUTTONDOWN:running = False screen.blit(background,(0,0)) screen.blit(boy,(0,200)) screen.blit(girl,(700,200)) pygame.display.update() pygame.quit()
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)