Commit 795a5092 by BellCodeEditor

save project

parent 7fe51f93
Showing with 3 additions and 3 deletions
...@@ -15,7 +15,7 @@ clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) ...@@ -15,7 +15,7 @@ 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) # 字体
weizhi = [2,8]#方块位置 weizhi = [2,8]#方块位置,2、weizhi[0]行,8、weizhi[1]列
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -35,8 +35,8 @@ while True: ...@@ -35,8 +35,8 @@ while True:
screen.blit(background,(0,0)) screen.blit(background,(0,0))
#画方块 #画方块
pygame.draw.rect(screen,(255,0,0),(weizhi[1]*20-20,weizhi[0]*20-20,20,20),0)#画方块 pygame.draw.rect(screen,(255,0,0),(weizhi[1]*20-20,weizhi[0]*20-20,20,20),0)#在屏幕中weizhi[1]*20-20(x坐标),weizhi[0]*20-20(y坐标)的位置画出红色且内部填充(width=0)的20宽20高的正方形
pygame.draw.rect(screen,(255,255,255),(weizhi[1]*20-20,weizhi[0]*20-20,20,20),1)#边框 pygame.draw.rect(screen,(255,255,255),(weizhi[1]*20-20,weizhi[0]*20-20,20,20),1)#在屏幕中weizhi[1]*20-20(x坐标),weizhi[0]*20-20(y坐标)的位置画出20宽20高的白色边框(width=1),为正方形的边框
# 得分 # 得分
score_text = font.render(str(score),True,(0,0,0)) score_text = font.render(str(score),True,(0,0,0))
......
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