Commit cb50855a by BellCodeEditor

auto save

parent c060d663
Showing with 9 additions and 3 deletions
...@@ -15,7 +15,8 @@ clock = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) ...@@ -15,7 +15,8 @@ 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) # 字体
SB = [1,1] SB = [2,2]
SB1 = [(0,-1),(0,0),(-1,0),(0,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:
...@@ -32,8 +33,13 @@ while True: ...@@ -32,8 +33,13 @@ while True:
SB[0]+=1 SB[0]+=1
# 将背景图画上去 # 将背景图画上去
screen.blit(background,(0,0)) screen.blit(background,(0,0))
pygame.draw.rect(screen,(200,0,100),(SB[1]*20-20,SB[0]*20-20,20,20),0) SB2 = []
pygame.draw.rect(screen,(255,255,255),(SB[1]*20-20,SB[0]*20-20,20,20),1) for cube in SB1:
pos = (cube[0]+SB[0],cube[1]+SB[1])
SB2.append(pos)
for cube in SB2:
pygame.draw.rect(screen,(200,0,100),(cube[1]*20-20,cube[0]*20-20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(cube[1]*20-20,cube[0]*20-20,20,20),1)
# 得分 # 得分
text = font.render(str(score),True,(0,0,0)) text = font.render(str(score),True,(0,0,0))
screen.blit(text,(375,50)) screen.blit(text,(375,50))
......
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