"""
闪电侠接金币的滚动背景类。
"""
import pygame
from pygame.locals import *
class Background:
"""不断向后移动的滚动背景"""
def __init__(self,image,screen):
"""初始化函数"""
self.screen = screen
self.w = screen.get_width() # 记录屏幕宽度
self.h = screen.get_height() # 记录屏幕高度
def update(self):
"""更新两个矩形的坐标"""
def draw(self):
"""重画"""
if __name__ == "__main__":
width,height = 960,720
screen = pygame.display.set_mode((width,height))
pygame.display.set_caption("闪电侠接金币滚动背景类 www.lixingqiu.com")
bgs = pygame.image.load("space.png")
background = Background(bgs,screen)
clock = pygame.time.Clock()
running = True
while running:
for event in pygame.event.get():
if event.type == QUIT:running = False
background.update()
background.draw()
pygame.display.update()
pygame.quit()
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)


