Commit 1e6872ef by BellCodeEditor

save project

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