Commit 69249b33 by BellCodeEditor

save project

parent 6d056ec4
Showing with 17 additions and 0 deletions
......@@ -15,6 +15,8 @@ background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
body = pygame.image.load('body.png')
body = pygame.image.load('body.png')
while True:
for event in pygame.event.get():
......@@ -25,6 +27,19 @@ while True:
a.append((x,y))
a.pop(0)
print(a)
if setheading=="r":
x+=30
elif setheading=="l":
x-=30
elif setheading=="up":
y-=30
else :
y+=30
position.append((x,y))
position.pop(0)
if x==apple_x and y==apple_y:
apple_x=r
# 将背景图画上去
screen.blit(background, (0, 0))
# 将贪吃蛇画上去
......@@ -41,3 +56,4 @@ while True:
pygame.display.update()
FPSCLOOK=pygame.time.Clock()
FPSCLOOK.tick(FPS)
\ 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