Commit 4b3543b8 by BellCodeEditor

save project

parent 27a26dc1
Showing with 14 additions and 3 deletions
...@@ -15,7 +15,7 @@ grid_size = 20 # 格子大小 ...@@ -15,7 +15,7 @@ grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量 grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量 grid_num_height = 25 # 纵向格子数量
FPS = 30 FPS = 30
cube = [(0,-1),(0,0),(-1,0),(0,1),]
xy = [2,8] xy = [2,8]
...@@ -42,10 +42,21 @@ while True: ...@@ -42,10 +42,21 @@ while True:
elif event.key == locals.K_DOWN: elif event.key == locals.K_DOWN:
if xy[0] < 25: if xy[0] < 25:
xy[0] = xy[0]+1 xy[0] = xy[0]+1
# 将背景图画上去 # 将背景图画上去
screen.blit(background,(0,0)) screen.blit(background,(0,0))
pygame.draw.rect(screen,(255,0,0),(xy[1]*20-20,xy[0]*20-20,20,20),0) cos = []
pygame.draw.rect(screen,(255,255,255),(xy[1]*20-20,xy[0]*20-20,20,20),1) for abc in cube:
aa = (abc[0]+xy[0],abc[1]+xy[1])
cos.append(aa)
for abc in cos:
pygame.draw.rect(screen,(255,0,0),(abc[1]*20-20,abc[0]*20-20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(abc[1]*20-20,abc[0]*20-20,20,20),1)
# 得分 # 得分
score_text = font.render("分数:"+str(score), True, (255,255,255)) score_text = font.render("分数:"+str(score), True, (255,255,255))
screen.blit(score_text,(880,20)) screen.blit(score_text,(880,20))
......
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