Commit b9255219 by BellCodeEditor

save project

parent 041a505a
Showing with 9 additions and 2 deletions
......@@ -8,6 +8,7 @@ grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量
FPS = 30
x = [2,8]
a = [(0,-1),(0,0),(0,1),(-1,0)]
# 创建窗口
screen = pygame.display.set_mode((460, 500))
pygame.display.set_caption("俄罗斯方块")
......@@ -32,8 +33,14 @@ while True:
x[1] -= 1
# 将背景图画上去
screen.blit(background,(0,0))
pygame.draw.rect(screen,(255,0,0),(x[1]*20-20,x[0]*20-20,20,20),0)
pygame.draw.rect(screen,(0,0,0),(x[1]*20-20,x[0]*20-20,20,20),1)
c = []
for e in a:
d = (e[0] + x[0], e[1] + x[1])
c.append(d)
for e in c:
pygame.draw.rect(screen,(255,0,0),(e[1]*20-20,e[0]*20-20,20,20),0)
pygame.draw.rect(screen,(0,0,0),(e[1]*20-20,e[0]*20-20,20,20),1)
# 得分
text = font.render(str(score),True,(0,0,0))
screen.blit(text,(370,70))
......
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