Commit 83e33438 by BellCodeEditor

save project

parent 58258a36
Showing with 9 additions and 6 deletions
......@@ -12,8 +12,8 @@ FP=pygame.time.Clock()
screen = pygame.display.set_mode((660, 480))
x,y=210,120
position=[(150,90),(150,120),(180,120),(x,y)]
#position=[(150,90),(150,120),(180,120),(x,y)]
position=[(x,y),(180,120),(150,120),(150,90)]
# 背景
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
......@@ -27,19 +27,21 @@ while True:
exit()
x=x+30
position.append((x,y))
position.pop(0)
#position.append((x,y))
#position.pop(0)
position.insert(0,(x,y))
position.pop(-1)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
screen.blit(right, (x, y))
# 将贪吃蛇的身体画上去
for i in range(len(position)-1):
for i in range(1,len(position)):
screen.blit(body, position[i])
# 将果实画上去
screen.blit(food, (360, 300))
FP.tick(1)
FP.tick(3)
# 刷新画面
pygame.display.update()
\ No newline at end of file
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