Commit df076a4a by BellCodeEditor

save project

parent a8c1e0e7
Showing with 7 additions and 1 deletions
...@@ -40,6 +40,7 @@ t = 30 ...@@ -40,6 +40,7 @@ t = 30
road_x=0 road_x=0
bg_x=0 bg_x=0
time=0 time=0
gamestate=True
Block_list=pygame.sprite.Group() Block_list=pygame.sprite.Group()
while True: while True:
...@@ -52,7 +53,7 @@ while True: ...@@ -52,7 +53,7 @@ while True:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
if gamestate==True:
if jumpState == "up": # 起跳状态 if jumpState == "up": # 起跳状态
if t > 0: if t > 0:
y -= t y -= t
...@@ -99,6 +100,11 @@ while True: ...@@ -99,6 +100,11 @@ while True:
screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y)) screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
if sprite.rect.x<=0-sprite.rect.width: if sprite.rect.x<=0-sprite.rect.width:
sprite.kill() sprite.kill()
if pygame.sprite.collde_rect(wukong,sprite):
gameover=pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate=False
#if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失 #if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失
# 创建障碍物对象 # 创建障碍物对象
#obstacle = Block(bush, stone, cacti) #obstacle = Block(bush, stone, cacti)
......
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