Commit f09a1dfa by BellCodeEditor

auto save

parent 1c7e7e19
Showing with 11 additions and 0 deletions
...@@ -18,6 +18,9 @@ clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) ...@@ -18,6 +18,9 @@ clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 载入素材 # 载入素材
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60) # 字体 font = pygame.font.Font('STKAITI.TTF', 60) # 字体
num_list=[]
for i in range(25):
num_list.append([0]*15)
# 俄罗斯方块所有形状 # 俄罗斯方块所有形状
O = [[(0, 0), (0, 1), (1, 0), (1, 1)]] O = [[(0, 0), (0, 1), (1, 0), (1, 1)]]
...@@ -111,9 +114,17 @@ while True: ...@@ -111,9 +114,17 @@ while True:
(cube[1] * 20-20, cube[0] * 20-20, 20, 20), 0) (cube[1] * 20-20, cube[0] * 20-20, 20, 20), 0)
pygame.draw.rect(screen, (255, 255, 255), pygame.draw.rect(screen, (255, 255, 255),
(cube[1] * 20-20, cube[0] * 20-20, 20, 20), 1) (cube[1] * 20-20, cube[0] * 20-20, 20, 20), 1)
for i, row in zip(range(1, 26), num_list):
for j, color in zip(range(1, 16), row):
if color != 0:
pygame.draw.rest(screen, colors,
(j * 20-20, i * 20-20, 20, 20))
pygame.draw.rest(screen, (255, 255, 255),
(j * 20-20, i * 20-20, 20, 20), 183)
# 得分 # 得分
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))
# 刷新画面 # 刷新画面
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