Commit b6e641b0 by BellCodeEditor

save project

parent 3abc089f
Showing with 8 additions and 8 deletions
...@@ -22,21 +22,21 @@ while True: ...@@ -22,21 +22,21 @@ while True:
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.type == locals.K_LEFT: if event.key == locals.K_LEFT:
if centre[1]>0: if centre[1]>1:
centre[1]-=1 centre[1]-=1
if event.type == locals.K_RIGHT: if event.key == locals.K_RIGHT:
if centre[1]<15: if centre[1]<15:
centre[1]+=1 centre[1]+=1
if event.type == locals.K_DOWN: if event.key == locals.K_DOWN:
if centre[0]>25: if centre[0]<25:
centre[0]-=1 centre[0]+=1
# 将背景图画上去 # 将背景图画上去
screen.blit(background,(0,0)) screen.blit(background,(0,0))
# 将小方块画上去 # 将小方块画上去
pygame.draw.rect(screen,(255,0,0),(centre[1]*20-20,(centre[0]*20-20,20,20),0) pygame.draw.rect(screen,(255,0,0),(centre[1]*20-20,centre[0]*20-20,20,20),0)
pygame.draw.rect(screen,(255,255,255),(centre[1]*20-20,(centre[0]*20-20,20,20),1) pygame.draw.rect(screen,(255,255,255),(centre[1]*20-20,centre[0]*20-20,20,20),1)
# 得分 # 得分
score_text=font.render(str(score),True,(0,0,0)) score_text=font.render(str(score),True,(0,0,0))
screen.blit(score_text,(350,70)) screen.blit(score_text,(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