Commit d2fc1ef6 by BellCodeEditor

auto save

parent 2cf28b6e
Showing with 2 additions and 3 deletions
...@@ -14,7 +14,7 @@ class Block(pygame.sprite.Sprite): ...@@ -14,7 +14,7 @@ class Block(pygame.sprite.Sprite):
self.image=random.choice([image1,image2,image3]) self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect() self.rect=self.image.get_rect()
self.rect.x=1000 self.rect.x=1000
self.rect.y=500-rect.height self.rect.y=500-self.rect.height
# 载入图片 # 载入图片
background = pygame.image.load('bg.png') # 背景 background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路 road = pygame.image.load('road.png') # 路
...@@ -76,8 +76,7 @@ while True: ...@@ -76,8 +76,7 @@ while True:
if road_x<-1000: if road_x<-1000:
road_x=0 road_x=0
screen.blit(road, (road_x, 500)) # 路 screen.blit(road, (road_x, 500)) # 路
if rect.x <= 0-rect.width: # 障碍物消失 if zhangai.rect.x<=0-zhangai.rect.width: # 障碍物消失
if zhangai.rect.x<=0-zhangai.rect.width:
# 创建障碍物对象 # 创建障碍物对象
zhangai = zhangai = Block(bush, stone, cacti) zhangai = zhangai = Block(bush, stone, cacti)
rect = zhangai.get_rect() rect = zhangai.get_rect()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment