diff --git a/snake.py b/snake.py index 8484262..7d37b0c 100644 --- a/snake.py +++ b/snake.py @@ -65,6 +65,8 @@ while True: apple_y = num2* 30 - 30 else: position.pop(0) + if x < 0 or x > 630 or y < 0 or y > 450: + exit() # 将背景图画上去 screen.blit(background, (0, 0)) # 将贪吃蛇的头画上去