Commit 8fc36848 by BellCodeEditor

save project

parent 8ec2c7e4
Showing with 4 additions and 3 deletions
......@@ -42,9 +42,7 @@ while True:
if event.key == locals.K_DOWN and setheading != "up":
setheading = 'down'
snake_head = down
if x == apple_x and y == apple_y:
apple_x = random.randint(0,660)
apple_y = random.randint(0,480)
# 设置贪吃蛇的头部坐标
if setheading == "right":
......@@ -55,6 +53,9 @@ while True:
y -= 30
else:
y += 30
if x == apple_x and y == apple_y:
apple_x = ra
apple_y = random.randint(0,480)
position.append((x, y))
position.pop(0)
# 将背景图画上去
......
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