Commit a6bb0871 by BellCodeEditor

save project

parent 2ed09236
Showing with 9 additions and 3 deletions
......@@ -13,9 +13,13 @@ FPSCLOCK = pygame.time.Clock()
# 背景
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
apple = pygame.image.load('apple.png')
body = pygame.image.load('body.png')
down = pygame.image.load('down.png')
left = pygame.image.load('left.png')
right = pygame.image.load('right.png')
up = pygame.image.load('up.png')
x,y=240,120
position=[(180,90),(180,120),(210,120),(x,y)]
setheading='right'
......@@ -50,10 +54,12 @@ while True:
position.append((x,y))
position.pop(0)
screen.blit(background, (0, 0))
screen.blit(apple,(360,300))
# 将贪吃蛇画上去
screen.blit(snake_head,position[-1])
# 刷新画面
for i in range(len(position)-1):
screen.blit(body,position[i])
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
FPSCLOCK.tick(5)
\ 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