Commit bdc8cf12 by BellCodeEditor

save project

parent ec2ffa0b
Showing with 14 additions and 17 deletions
...@@ -81,24 +81,21 @@ while True: ...@@ -81,24 +81,21 @@ while True:
screen.blit(road, (road_x, 500)) screen.blit(road, (road_x, 500))
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
time+=1 time+=1
if time>=60 if time>=60:
r=random.randint(0,50) r=random.randint(0,50)
if >40 if r >40:
obstacle =Block(stone,cacti,bush) obstacle =Block(stone,cacti,bush)
block_list.add(obstacle) block_list.add(obstacle)
time(0) time=0
# ++++++++++++++++++++++ # ++++++++++++++++++++++
for sprite in block_list: for sprite in block_list:
sprite.rect_x-=8 sprite.rect.x-=8
screen.blit(sprite.imapge(sprite.rect_x,sprite,rect_y)) screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
if obstacle.rect.x <= 0-obstacle.rect.width: if sprite.rect.x <= 0-sprite.rect.width:
sprite.kill() sprite.kill()
if obstacle.rect.x <= 0-obstacle.rect.width: # ++++++++++++++++++++++
obstacle = Block(bush,cacti,stone) screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
obstacle.rect.x -= 8
# ++++++++++++++++++++++
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
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