Commit 19c62f6e by BellCodeEditor

save project

parent 2ec7e92d
Showing with 13 additions and 4 deletions
......@@ -6,6 +6,7 @@ score = 0
grid_size = 20 # 格子大小
grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量
aq=[2,8]
FPS = 30
# 创建窗口
......@@ -20,13 +21,21 @@ while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if event.type == locals.KEYDOWN:
if event.key == locals.K_DOWN and aq[0] < 25:
aq[0]+=1
elif event.key == locals.K_RIGHT and aq[1] < 15:
aq[1]+=1
elif event.key == locals.K_LEFT and aq[1] > 1:
aq[1]-=1
# 将背景图画上去
screen.blit(background,(0,0))
pygame.draw.rect(screen,(255,0,0),(140,20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(140,20,20,20),1)
pygame.draw.rect(screen,(255,0,0),
(aq[1]*20-20,aq[0]*20-20,20,20),0)
pygame.draw.rect(screen,(255,255,255),
(aq[1]*20-20,aq[0]*20-20,20,20),1)
# 得分
ts = font.render(str(score),True,(0,250,0))
ts = font.render(str(score),True,(0,0,0))
screen.blit(ts,(350,70))
# 刷新画面
pygame.display.update()
......
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