Commit c2978afa by BellCodeEditor

auto save

parent d6a37b8d
File added
File added
File added
File added
...@@ -17,6 +17,8 @@ body = pygame.image.load('body.png') ...@@ -17,6 +17,8 @@ body = pygame.image.load('body.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')
left = pygame.image.load('left.png') left = pygame.image.load('left.png')
my_font = pygame.font.Font('neuropol.ttf')
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)]
setheading = "right" setheading = "right"
...@@ -59,7 +61,8 @@ while True: ...@@ -59,7 +61,8 @@ while True:
if x == apple_x and y == apple_y: if x == apple_x and y == apple_y:
apple_x = random.randint(0,22)*30 apple_x = random.randint(0,22)*30
apple_y = random.randint(0,16)*30 apple_y = random.randint(0,16)*30
position.pop(0) else :
position.pop(0)
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
# 将贪吃蛇画上去 # 将贪吃蛇画上去
...@@ -75,5 +78,8 @@ while True: ...@@ -75,5 +78,8 @@ while True:
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x, apple_y)) screen.blit(food, (apple_x, apple_y))
# 刷新画面 # 刷新画面
info = 'Score'+str(score)
text = my_font.render(info,True,(0,0,0))
screen.blit(text,(540 , 10))
pygame.display.update() pygame.display.update()
FpsClock.tick(3) FpsClock.tick(3)
\ 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