"""婷婷的舞蹈.py,伴随着舞台音响灯光,这是在演示一个小女孩在舞台上跳舞的小动画""" __author__ = "李兴球" __date__ = "2018年7月" import pygame from pygame.locals import * import time class Sprite(): def __init__(self,images,x,y,间隔,screen): self.images = images self.造型总数 = len(images) self.index = 0 self.image = self.images[self.index] #初始造型 self.造型切换间隔 = 间隔 self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y self.start = time.time() self.screen = screen def main(): pygame.init() screen = pygame.display.set_mode((480,360)) pygame.display.set_caption("婷婷的舞蹈_小女孩跳舞pygame小动画_作者:李兴球") pass bg = Sprite(背景列表,0,0,0.5,screen) girl = Sprite(girl_images,190,80,0.6,screen) clock = pygame.time.Clock() running = True while running: for event in pygame.event.get(): if event.type==QUIT:running = False pass pygame.display.update() clock.tick(30) pygame.quit() if __name__=="__main__": main()
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)