diff --git a/snake.py b/snake.py index ca6aef2..e0dd6bb 100644 --- a/snake.py +++ b/snake.py @@ -60,14 +60,15 @@ while True: ya = n2 * 30 else: position.pop(0) - + if x < 0 or x > 630 or y < 0 or y > 450: + exit() screen.blit(background, (0, 0)) screen.blit(snake_head, position[-1]) for i in range(len(position)-1): screen.blit(body, position[i]) - + screen.blit(food, (xa,ya)) info = "Score:" + str(score) text = font.render(info,True,(0,0,0))