Commit abb0189d by BellCodeEditor

save project

parent dc5e4c8a
Showing with 9 additions and 2 deletions
...@@ -13,9 +13,10 @@ background = pygame.image.load('bg.png') ...@@ -13,9 +13,10 @@ 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') # 身体
left = pygame.image.load('left.png') # 头 朝左 left = pygame.image.load('left.png') # 头 朝左--
up = pygame.image.load('up.png') # 头 朝上 up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下 down = pygame.image.load('down.png') # 头 朝下
my_font = pygame.font.Font("neuropol.ttf",18)
x, y = 240, 120 x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)] position = [(180, 90), (180, 120), (210, 120), (x, y)]
...@@ -63,7 +64,9 @@ while True: ...@@ -63,7 +64,9 @@ while True:
else: else:
position.pop(0) position.pop(0)
# 将背景图画上去 if x < 0 or x > 630 or y < 0 or y > 450:
exit()
# 将背景图画上去+
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇的头画上去 # 将贪吃蛇的头画上去
screen.blit(snake_head, position[-1]) screen.blit(snake_head, position[-1])
...@@ -76,3 +79,6 @@ while True: ...@@ -76,3 +79,6 @@ while True:
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
info = "Score"+ str(score)
text = my_font.render(info,True,(0,0,0))
screen.blit
\ 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