Commit d57ad405 by BellCodeEditor

save project

parent 5d496c2d
Showing with 6 additions and 0 deletions
...@@ -42,6 +42,7 @@ time=0 ...@@ -42,6 +42,7 @@ time=0
road_x=0 road_x=0
bg_x=0 bg_x=0
wukong=wukong(hero[0]) wukong=wukong(hero[0])
gameState=True
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:
...@@ -66,6 +67,7 @@ while True: ...@@ -66,6 +67,7 @@ while True:
jumpState = "runing" jumpState = "runing"
t =30 t =30
if gameState==True:
# 悟空造型 # 悟空造型
wukong.image = hero[index] wukong.image = hero[index]
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
...@@ -96,6 +98,9 @@ while True: ...@@ -96,6 +98,9 @@ while True:
screen.blit(obstacle.image, (obstacle.rect.x,obstacle.rect.y)) screen.blit(obstacle.image, (obstacle.rect.x,obstacle.rect.y))
if obstacle.rect.x <= 0- obstacle.rect.width: if obstacle.rect.x <= 0- obstacle.rect.width:
obstacle.kill() obstacle.kill()
if pygame.sprite.collide_rect(wukong,obstacle):
gameOver=pygame.image.load('gameover.png'
gameState=False
# 刷新画面 # 刷新画面
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