From 8133471087b67d2d65efbc515248b9a28f817c55 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 18 Apr 2021 17:28:08 +0800 Subject: [PATCH] save project --- snake.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snake.py b/snake.py index f0bad83..93b44eb 100644 --- a/snake.py +++ b/snake.py @@ -49,7 +49,7 @@ while True: if event.key == locals.K_DOWN and setheading != "up": setheading = 'down' snake_head = down - + # 设置贪吃蛇的头部坐标 if setheading == "right": x += 30 @@ -69,6 +69,8 @@ while True: score=score+10 else: position.pop(0) + if x>630 or x<0 or y<0 or y>450: + exit() # 将背景图画上去 screen.blit(background, (0, 0)) # 将贪吃蛇的头画上去 -- libgit2 0.25.0