Commit 3cb30e41 by BellCodeEditor

save project

parent 10f16aef
Showing with 3 additions and 5 deletions
...@@ -12,7 +12,7 @@ background = pygame.image.load('bg.png') ...@@ -12,7 +12,7 @@ background = pygame.image.load('bg.png')
right = pygame.image.load('right.png') right = pygame.image.load('right.png')
food = pygame.image.load('apple.png') food = pygame.image.load('apple.png')
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
x=120 x=240
y=120 y=120
position=[(180,90),(180,120),(210,120),(x,y)] position=[(180,90),(180,120),(210,120),(x,y)]
while True: while True:
...@@ -29,11 +29,10 @@ while True: ...@@ -29,11 +29,10 @@ while True:
position.pop(0) position.pop(0)
screen.blit(right,position[-1]) screen.blit(right,position[-1])
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
for i in range(len(position)): for i in range(len(position)-1):
screen.blit(body,position[-1]) screen.blit(body,position[i])
# 将果实画上去 # 将果实画上去
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
x = x + 30
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
\ 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