 悬赏:20 学分
悬赏:20 学分                        
                    		
                                                                            	
                        
                        
                    import pygame
from pygame.locals import *
width = 800
height = 260
FPS = 30
class MyMap():
def __init__(self,x,y):
self.bg = pygame.image.load("image/bg.png")
self.x = x
self.y = y
def map_rolling(self):
if self.x < -790:
self.x = 800
else:
self.x -= 5
def map_update(self):
SCREEN.blit(self.bg,(self.x,self.y))
def mainGame():
score = 0
over = False
pygame.init()
global SCREEN,FPSCLOCK
SCREEN = pygame.display.set_mode((width,height))
pygame.display.set_caption("小恐龙")
FPSCLOCK = pygame.time.Clock()
bg1 = MyMap(0,0)
bg2 = MyMap(800,0)
while True:
for event in pygame.event.get():
if event.type == QUIT:
over = True
exit()
if over == False:
bg1.map_update()
bg1.map_rolling()
bg2.map_update()
bg2.map_rolling()
pygame.display.flip()
FPSCLOCK.tick(FPS)
if __name__ == '__main__':
mainGame()

 
	
                                                 VIP会员
VIP会员 购物车
购物车

 私信
                         私信 
                     
					 
					 
					 发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对( 
                     已解决
已解决 
                







 
                     
                     
					 
						 
						 
						 
						