Commit 26e5efac by BellCodeEditor

save project

parent 34136a85
Showing with 8 additions and 15 deletions
...@@ -33,8 +33,6 @@ obstacle = Block(stone,bush,cacti) ...@@ -33,8 +33,6 @@ obstacle = Block(stone,bush,cacti)
bg_x=0 bg_x=0
road_x=0 road_x=0
time=0
Block_list=pygame.sprite.Group()
while True: while True:
...@@ -71,19 +69,15 @@ while True: ...@@ -71,19 +69,15 @@ while True:
screen.blit(background, (0, 0)) # 远处背景 screen.blit(background, (0, 0)) # 远处背景
screen.blit(road, (0, 500)) # 路 screen.blit(road, (0, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
if rect.x <= 0-rect.width: # 障碍物消失
# 创建障碍物对象
obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
rect.x -= 8
screen.blit(obstacle = Block(stone,bush,cacti)) screen.blit(obstacle = Block(stone,bush,cacti))
time+=1
if time>=60:
num=random.randint(0,50)
if num>40:
obstacle=Block(bush,stone,cacti)
Block_list.add(obstacle)
time=0
for p in Block_list:
p.rect.x-=0
screen.blit(p.image,(p.rect.x,p.rect.y))
if p.rect.x<=0-p.rect.width:
p.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