Commit 3ffd9845 by BellCodeEditor

save project

parent 6858eede
Showing with 6 additions and 2 deletions
...@@ -35,6 +35,7 @@ road_x = 0 ...@@ -35,6 +35,7 @@ road_x = 0
aa=Block(bush,cacti,stone) aa=Block(bush,cacti,stone)
obstacle = Block(bush) obstacle = Block(bush)
time = 0 time = 0
True == 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -45,7 +46,7 @@ while True: ...@@ -45,7 +46,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
...@@ -61,7 +62,7 @@ while True: ...@@ -61,7 +62,7 @@ while True:
t =30 t =30
# 悟空造型 # 悟空造型
wukong = hero[index] wukong =Plaver(hero[index])
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
index += 1 index += 1
if index >= 5: if index >= 5:
...@@ -86,6 +87,9 @@ while True: ...@@ -86,6 +87,9 @@ while True:
screen.blit(sprite.tmage,(sprite.rect.x,sprite.rect.y)) screen.blit(sprite.tmage,(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.collide_rect(wukong,sprite):
gameover = pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
# 刷新画面 # 刷新画面
pygame.display.update() 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