Commit 91cf843c by BellCodeEditor

save project

parent 427ccb2a
Showing with 17 additions and 3 deletions
......@@ -7,6 +7,13 @@ grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量
FPS = 30
I = [(0,-1),(0,0),(0,1),(0,2)]
T = [(0,-1),(0,0),(0,1),(1,0)]
O = [(1,0),(0,0),(1,1),(0,1)]
L = [(0,2),(0,1),(0,0),(1,0)]
J = [(1,0),(0,0),(-1,0),(1,-1)]
S = [(0,0),(0,1),(1,0),(1,-1)]
Z = [(0,0),(0,1),(1,1),(1,2)]
# 创建窗口
screen = pygame.display.set_mode((460, 500))
......@@ -36,9 +43,16 @@ while True:
# 将背景图画上去
a =font.render("0",True,(0,0,0))
screen.blit(background,(0,0))
screen.blit(a,(360,80))
pygame.draw.rect(screen,(225,0,0),(center[1]*20-20,center[0]*20-20,20,20),0)
pygame.draw.rect(screen,(225,225,225),(center[1]*20-20,center[0]*20-20,20,20),1)
screen.blit(a,(360,80))
pos1 = []
for i in Z:
pos = (i[0] + center[0],i[1]+center[1])
pos1.append(pos)
for i in pos1:
pygame.draw.rect(screen,(225,0,0),(i[1]*20-20,i[0]*20-20,20,20),0)
pygame.draw.rect(screen,(225,225,225),(i[1]*20-20,i[0]*20-20,20,20),1)
# 刷新画面
pygame.display.update()
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