Commit 7d4ff591 by BellCodeEditor

save project

parent 655d8d30
Showing with 11 additions and 1 deletions
...@@ -10,6 +10,7 @@ grid_num_height = 25 # 纵向格子数量 ...@@ -10,6 +10,7 @@ grid_num_height = 25 # 纵向格子数量
FPS = 30 # 帧率 FPS = 30 # 帧率
count = 0 count = 0
states = False states = False
gameover = False
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((460, 500)) screen = pygame.display.set_mode((460, 500))
...@@ -90,7 +91,7 @@ while True: ...@@ -90,7 +91,7 @@ while True:
if check(center) == False: if check(center) == False:
index = old_index index = old_index
current_shape = shape[index] current_shape = shape[index]
if gameover == False:
if states == False: if states == False:
states = True states = True
center = [2, 8] # 第2行第8列 center = [2, 8] # 第2行第8列
...@@ -142,9 +143,18 @@ while True: ...@@ -142,9 +143,18 @@ while True:
else: else:
score +=1 score +=1
num_list = new_list num_list = new_list
if num_list[1][7] != 0:
gameover = 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:
text_surface = font.render("游戏失败,按任意键开始",True,(0,0,0))
screen.blit(text, (20,250))
score = 0
num_list = []
for i in range(25):
num_list.append([e] * 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