Commit 31ff69d8 by BellCodeEditor

save project

parent 2e30dad2
Showing with 8 additions and 1 deletions
......@@ -42,6 +42,7 @@ time = 0
t=30
# obstacle=Block(bush,cacti,stone)
block_list=pygame.sprite.Group()
gamestste=True
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -51,7 +52,7 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
if gamestste=='True':
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
......@@ -94,6 +95,10 @@ 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))
gamestste=False
# if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失
# # 创建障碍物对象
# obstacle=Block(bush,cacti,stone)
......@@ -102,5 +107,6 @@ while True:
# screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
# 刷新画面
pygame.display.update()
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