Commit 5a68dac5 by BellCodeEditor

save project

parent 42f0471c
Showing with 8 additions and 0 deletions
...@@ -41,7 +41,10 @@ t = 30 ...@@ -41,7 +41,10 @@ t = 30
bg_x = 0 bg_x = 0
road_x = 0 road_x = 0
aa=Block(bush,cacti,stone) aa=Block(bush,cacti,stone)
screen = 0
old_screen = screen
block_list = pygame.sprite.Group()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -86,11 +89,16 @@ while True: ...@@ -86,11 +89,16 @@ while True:
gameover = pygame.image.load('gameover.png') gameover = pygame.image.load('gameover.png')
screen.blit(gameover, (400, 200)) screen.blit(gameover, (400, 200))
gametate = False gametate = False
else:
if(sprite.rect.x + sprite.rect.width) < wukong.rect.x:
score += sprite.score
sprite.screen = 0
if aa.rect.x <= 0-aa.rect.width: # 障碍物消失 if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
# 创建障碍物对象 # 创建障碍物对象
aa=Block(bush,cacti,stone) aa=Block(bush,cacti,stone)
aa.rect.x -= 8 aa.rect.x -= 8
screen.blit(aa.image, (aa.rect.x, aa.rect.y)) screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面 # 刷新画面
......
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