Commit 8a97cdab by BellCodeEditor

save project

parent d081ae70
Showing with 4 additions and 2 deletions
...@@ -49,17 +49,19 @@ while True: ...@@ -49,17 +49,19 @@ while True:
num2=random.randint(1,16) num2=random.randint(1,16)
apple_x= num1*30-30 apple_x= num1*30-30
apple_y= num2*30-30 apple_y= num2*30-30
score=score+10
else: else:
position.pop(0) position.pop(0)
position.append((x, y)) position.append((x, y))
info="Score"+str(score) info="Score"+str(score)
text=my_font.render(info,True,(0,0,0)) text=my_font.render(info,True,(0,0,0))
screen.blit(text,(0,0))
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(snake_head, position[-1]) screen.blit(snake_head, position[-1])
for i in range(len(position)-1): for i in range(len(position)-1):
screen.blit(body, position[i]) screen.blit(body, position[i])
screen.blit(apple, (apple_x, apple_y)) screen.blit(apple, (apple_x, apple_y))
screen.blit(text,(0,0))
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
......
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