diff --git a/snake.py b/snake.py index 27e9fd5..d1fd113 100644 --- a/snake.py +++ b/snake.py @@ -67,6 +67,9 @@ while True: position.pop(0) # 将背景图画上去 screen.blit(background, (0, 0)) + if x<0 or x>630 or y<0 or y>450: + exit() + # 将贪吃蛇的头画上去 screen.blit(snake_head, position[-1]) # 将贪吃蛇的身体画上去