Commit 181a57ed by BellCodeEditor

auto save

parent cb83d5da
Showing with 7 additions and 4 deletions
...@@ -19,7 +19,7 @@ body = pygame.image.load('body.png') # 身体 ...@@ -19,7 +19,7 @@ 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') # 头 朝下
sources = 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)]
...@@ -61,12 +61,13 @@ while True: ...@@ -61,12 +61,13 @@ while True:
# 将贪吃蛇的头画上去 # 将贪吃蛇的头画上去
screen.blit(snake_head, position[-1]) screen.blit(snake_head, position[-1])
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
my_font = pygame.font.Font("sources",18)
for i in range(len(position)-1): for i in range(len(position)-1):
screen.blit(body, position[i]) screen.blit(body, position[i])
a = random(1,22*30) a = random.randint(1,22*30)
b = random(1,16*30) b = random.randint(1,16*30)
# 将果实画上去 # 将果实画上去
screen.blit(food, (a, b)) screen.blit(food, (a,b))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
...@@ -76,3 +77,4 @@ while True: ...@@ -76,3 +77,4 @@ while True:
\ 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