Commit 821e3888 by BellCodeEditor

save project

parent af0d6049
Showing with 10 additions and 2 deletions
......@@ -9,6 +9,7 @@ grid_num_height = 25 # 纵向格子数量
FPS = 30
center=[7,1]
cs=[(0,-1),(0,0),(0,1),(-1,0)]
# 创建窗口
screen = pygame.display.set_mode((460, 500))
......@@ -34,8 +35,15 @@ while True:
screen.blit(background,(0,0))
# 得分
pygame.draw.rect(screen,(255,0,0),(center[0]*20,center[1]*20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(center[0]*20,center[1]*20,20,20),1)
cp = []
for cube in cs:
pos=(cube[0]+center[0],cube[1]+center[1])
cp.append(pos)
for cube in cp:
pygame.draw.rect(screen,(255,0,0),(cube[0]*20,cube[1]*20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(cube[0]*20,cube[1]*20,20,20),1)
txt=font.render(str(score),True,(0,0,0))
screen.blit(txt,(350,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