Commit 8adedd28 by BellCodeEditor

save project

parent 4ffc3a06
Showing with 10 additions and 8 deletions
...@@ -67,6 +67,8 @@ while True: ...@@ -67,6 +67,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_LEFT: # 向左 if event.key == locals.K_LEFT: # 向左
center[1] = center[1] - 1 # 左移1列 center[1] = center[1] - 1 # 左移1列
if check(center) == False: if check(center) == False:
...@@ -94,9 +96,9 @@ while True: ...@@ -94,9 +96,9 @@ 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 event
# 生成新俄罗斯方块 # 生成新俄罗斯方块
if num_list[1][7]!=0: if num_list[1][7]!=0:
gameover=True gameover=True
if gameover==False: if gameover==False:
if states == False: if states == False:
...@@ -114,8 +116,7 @@ while True: ...@@ -114,8 +116,7 @@ while True:
states = False states = False
for cube in current_pos: for cube in current_pos:
num_list[cube[0]-1][cube[1]-1] = color num_list[cube[0]-1][cube[1]-1] = color
if num_list[1][7]!=0:
gameover=true
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 计算出所有小方块的行、列位置 # 计算出所有小方块的行、列位置
...@@ -156,12 +157,13 @@ while True: ...@@ -156,12 +157,13 @@ 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_surface = font.render(str("anjian", True, (0, 0, 0)) text_surface1 = font1.render("anjian", True, (0, 0, 0))
screen.blit(text_surface, (20,250)) screen.blit(text_surface1, (20,250))
num_list=[]
for i in range(25): for i in range(25):
num_list.append([0]*15) num_list.append([0]*15)
score score=0
# 刷新画面 # 刷新画面
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