Commit 7ef95a0d by BellCodeEditor

auto save

parent 34c24f70
Showing with 7 additions and 6 deletions
...@@ -35,8 +35,7 @@ t = 30 ...@@ -35,8 +35,7 @@ t = 30
road_x = 0 road_x = 0
background_x = 0 background_x = 0
obstacle = Block(bush,stone,cacti) block_list = pygame.sprite.Group()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -78,10 +77,11 @@ while True: ...@@ -78,10 +77,11 @@ while True:
background_x = 0 background_x = 0
screen.blit(wukong, (150, y)) screen.blit(wukong, (150, y))
if obstacle.rect.x <= 0-obstacle.rect.width: obstacle = Block(bush,cacti,stone)
obstacle = Block(bush,stone,cacti) block_list.add(obstacle)
obstacle.rect.x -= 8 for sprite in block_list:
screen.blit(obstacle.image,(obstacle.rect.x,obstacle.rect.y)) sprite.rect.x -= 8
screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
# 刷新画面 # 刷新画面
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