Commit d2360919 by BellCodeEditor

save project

parent 39924c85
Showing with 5 additions and 3 deletions
...@@ -32,7 +32,8 @@ y = 400 ...@@ -32,7 +32,8 @@ y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
obstacle=Block(bush,cacti,stone) obstacle=Block(bush,cacti,stone)
while True: if gamestate==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:
# 接收到退出事件后退出程序 # 接收到退出事件后退出程序
...@@ -77,8 +78,9 @@ while True: ...@@ -77,8 +78,9 @@ while True:
# 创建障碍物对象 # 创建障碍物对象
obstacle=Block(bush,cacti,stone) obstacle=Block(bush,cacti,stone)
obstacle.rect.x -= 8 obstacle.rect.x -= 8
if pygame.sprite.collide_rect(wukong,sprite):
gameover=pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y)) screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
# 刷新画面 # 刷新画面
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