Commit b67ce890 by BellCodeEditor

save project

parent a9f63ccd
Showing with 8 additions and 5 deletions
...@@ -9,6 +9,7 @@ apple=pygame.image.load('apple.png') ...@@ -9,6 +9,7 @@ apple=pygame.image.load('apple.png')
body=pygame.image.load('body.png') body=pygame.image.load('body.png')
x,y=240,120 x,y=240,120
CLOCK=pygame.time.Clock() CLOCK=pygame.time.Clock()
position=[(180,90),(180,120),(210,120),(x,y)]
# 创建一个窗口 # 创建一个窗口
a=pygame.display.set_mode((660,480)) a=pygame.display.set_mode((660,480))
...@@ -17,11 +18,12 @@ while True: ...@@ -17,11 +18,12 @@ while True:
for i in pygame.event.get(): for i in pygame.event.get():
if(i.type==locals.QUIT): if(i.type==locals.QUIT):
exit() exit()
x=x+30 x=x+30
a.blit(bg,(0,0)) a.blit(bg,(0,0))
a.blit(head,(x,y))
a.blit(apple,(330,360)) a.blit(apple,(330,360))
a.blit(body,(210,120)) position.append((x,y))
a.blit(body,(180,120)) position.pop(0)
a.blit(body,(180,90)) a.blit(head,(x,y))
for i in range(len(position)-1):
a.blit(body,position[i])
pygame.display.update() 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