From 70ad15ed2bf1c7c23f248df2eadba51078e6e2d7 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Thu, 5 Aug 2021 17:31:52 +0800 Subject: [PATCH] auto save --- snake.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/snake.py b/snake.py index be20aba..cab3c2a 100644 --- a/snake.py +++ b/snake.py @@ -30,7 +30,7 @@ setheading = "right" snake_head = right while True: - a=random.randint(2,5) + a=random.randint(1,10) for event in pygame.event.get(): if event.type == locals.QUIT: @@ -75,11 +75,11 @@ while True: if position[-1] in position[:-1]: print('您撞到了自己') exit() + if score>100: + print('你赢了') + exit() - - # if (apple_x,apple_y) in position[:len[position]-2]: - # apple_x=(random.randint(0,630))//30*30 - # apple_y=(random.randint(0,450))//30*30 + # 将背景图画上去 screen.blit(background, (0, 0)) # 将贪吃蛇的头画上去 -- libgit2 0.25.0