Commit 441adf93 by BellCodeEditor

save project

parent f935cb8f
Showing with 9 additions and 2 deletions
...@@ -68,6 +68,8 @@ while True: ...@@ -68,6 +68,8 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if gameover == True:
gameover = False
if event.key == locals.K_RIGHT: # 向右 if event.key == locals.K_RIGHT: # 向右
center[1] = center[1] + 1 center[1] = center[1] + 1
if check(center) == False: if check(center) == False:
...@@ -151,9 +153,14 @@ while True: ...@@ -151,9 +153,14 @@ while True:
text_surface = font.render(str(score), True, (0, 0, 0)) text_surface = font.render(str(score), True, (0, 0, 0))
screen.blit(text_surface, (350,70)) screen.blit(text_surface, (350,70))
if gameover == True: if gameover == True:
text = font_restart.render("Gameover,You are low!!! :)",True,(0,0,0)) text = font_restart.render("Gameover,You are low!!! :) ",True,(0,0,0))
text_re = font_restart.render("Press any key to restart your life :) ",True,(0,0,0))
screen.blit(text, (20,250)) screen.blit(text, (20,250))
screen.blit(text_re, (20,300))
score = 0
num_list = []
for i in range(25):
num_list.append([0] * 15)
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
clock.tick(FPS) clock.tick(FPS)
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