Commit 739f41ec by BellCodeEditor

auto save

parent 20c57e7b
Showing with 3 additions and 0 deletions
...@@ -43,6 +43,7 @@ while True: ...@@ -43,6 +43,7 @@ while True:
if event.key == locals.K_DOWN and setheading != "up": if event.key == locals.K_DOWN and setheading != "up":
setheading = 'down' setheading = 'down'
snake_head = down snake_head = down
# 设置贪吃蛇的头部坐标 # 设置贪吃蛇的头部坐标
if setheading == "right": if setheading == "right":
...@@ -53,6 +54,8 @@ while True: ...@@ -53,6 +54,8 @@ while True:
y -= 30 y -= 30
else: else:
y += 30 y += 30
if x<0 or x>630 or y < 0 or y > 450 :
exit()
position.append((x, y)) position.append((x, y))
if x == apple_x and y == apple_y: if x == apple_x and y == apple_y:
apple_x = (randint(0,630)//30)*30 apple_x = (randint(0,630)//30)*30
......
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