Commit 98e55910 by BellCodeEditor

save project

parent cd2397be
Showing with 5 additions and 4 deletions
...@@ -14,6 +14,7 @@ food = pygame.image.load('apple.png') ...@@ -14,6 +14,7 @@ food = pygame.image.load('apple.png')
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
x=240 x=240
y=120 y=120
a=[(180,90),(180,120),(210,120),(x,y)]
Fps=pygame.time.Clock() Fps=pygame.time.Clock()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -27,12 +28,12 @@ while True: ...@@ -27,12 +28,12 @@ while True:
screen.blit(right, (x,y)) screen.blit(right, (x,y))
x+=30 x+=30
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
for i in range(len(a)-1):
screen.blit(body, (210, 120)) screen.blit(body,a[i])
screen.blit(body, (180, 120))
screen.blit(body, (180, 90))
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
a.append((x,y))
a.pop(0)
# 刷新画面 # 刷新画面
pygame.display.update() 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