Commit a3564cb8 by BellCodeEditor

save project

parent 5e94cb0d
Showing with 10 additions and 3 deletions
...@@ -10,7 +10,7 @@ grid_num_height = 25 # 纵向格子数量 ...@@ -10,7 +10,7 @@ grid_num_height = 25 # 纵向格子数量
FPS = 30 # 帧率 FPS = 30 # 帧率
count = 0 count = 0
states = False states = False
gameover=Fals
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((460, 500)) screen = pygame.display.set_mode((460, 500))
pygame.display.set_caption("俄罗斯方块") pygame.display.set_caption("俄罗斯方块")
...@@ -88,7 +88,7 @@ while True: ...@@ -88,7 +88,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列
...@@ -135,10 +135,17 @@ while True: ...@@ -135,10 +135,17 @@ while True:
row_index-=1 row_index-=1
else: else:
score+=1 score+=1
num_list=num_list num_list=num_list
# 得分 # 得分
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 = font_restart.render("")
screen.blit(text,(20,250))
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