Chinese Music花瓣飞舞的春天_pygame动态背景样本

"""Chinese Music花瓣飞舞的春天,制作一个标准的帧动画以肆世人,2019/6/2,李兴球@萍乡"""

import time
import pygame
from pygame.locals import *

def main():
    """主要函数"""
    width,height = 960,538
    screen = pygame.display.set_mode((width,height))
    pygame.display.set_caption("Chinese Music花瓣飞舞的春天 by www.lixingqiu.com")

    pygame.mixer.init()
    pygame.mixer.music.load("Andy Lau - Wu (piano) [mp3clan.com].mp3.wav")
    pygame.mixer.music.play(-1,0)

    clock = pygame.time.Clock()
    running = True
    
    frames = [pygame.image.load(f"frames/{index}.png") for index in range(22)]
    background = Dynamic_background(frames)
    
    while pygame.event.poll().type != QUIT:
        background.update()
        screen.blit(background.image,(0,0))
        pygame.display.update()
        clock.tick(60)

    pygame.quit()


class Dynamic_background:
    

You must log in to read the rest of this article. Please log in or register as a user.