Commit 36afad3b by BellCodeEditor

save project

parent e02b0cf5
Showing with 14 additions and 5 deletions
...@@ -63,7 +63,7 @@ while True: ...@@ -63,7 +63,7 @@ while True:
index += 1 index += 1
if index >= 5: if index >= 5:
index = 0 index = 0
background_x-=4 background_x-=2
if background_x<=-1000: if background_x<=-1000:
background_x=0 background_x=0
road_x-=8 road_x-=8
...@@ -73,10 +73,18 @@ while True: ...@@ -73,10 +73,18 @@ while True:
screen.blit(background, (background_x, 0)) # 远处背景 screen.blit(background, (background_x, 0)) # 远处背景
screen.blit(road, (road_x, 500)) # 路 screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失 time+=1
obstacle =Block(bush,stone,cacti) if time>=60:
obstacle.rect.x -= 8 num=random.randint(0,100)
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y)) if num>40:
obstacle=Block(bush,cacti,stone)
block_list.add(obstacle)
time=0
for prop in block_list:
prop.rect.x-=8
screen.blit(prop.image,(prop.rect.x,prop.rect.y))
if prop.rect.x<=0-prop.rect.width:
prop.kill()
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
\ No newline at end of file
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