Commit 742ece9b by BellCodeEditor

save project

parent 0729f9a8
Showing with 12 additions and 8 deletions
...@@ -45,16 +45,20 @@ while True: ...@@ -45,16 +45,20 @@ while True:
for i in position[:-1]: for i in position[:-1]:
if i==(x,y): if i==(x,y):
exit() exit()
if x>630 or x<0 or y>450 or y<0:
exit()
else:
# 设置贪吃蛇的头部坐标 # 设置贪吃蛇的头部坐标
if setheading == "right": if setheading == "right":
x += 30 x += 30
elif setheading == "left": elif setheading == "left":
x -= 30 x -= 30
elif setheading == "up": elif setheading == "up":
y -= 30 y -= 30
else: else:
y += 30 y += 30
position.append((x, y)) position.append((x, y))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment