Commit c1f10eac by BellCodeEditor

save project

parent 68936972
Showing with 10 additions and 0 deletions
......@@ -57,6 +57,7 @@ bg_x = 0
time=0
gamestate = True
obstacle = Block(bush,stone,cacti)
block_list = pygame.sprite.Group()
......@@ -125,6 +126,15 @@ while True:
screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
if sprite.rect.x <= 0-sprite.rect.width:
sprite.kill()
if pygame.sprite.collide_rect(wukong,sprite):#检测精灵是否发生变化
gameover = pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate = False
else:
if sprite.rect.x + sprite.rect.width < wukong.rect.x:
score += sprite.score
sprite.score = 0
#print(score)
# 刷新画面
pygame.display.update()
......
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