Commit c3f5a0ae by BellCodeEditor

save project

parent 248cd42d
Showing with 10 additions and 7 deletions
......@@ -23,10 +23,9 @@ position = [(180, 90), (180, 120), (210, 120), (x, y)]
setheading = "right"
snake_head = right
nam1=random.randint(0,22)
nam2=random.randint(0,16)
apple_x = 30*nam1-30
apple_y = 30*nam2-30
apple_x = 360
apple_y = 300
while True:
for event in pygame.event.get():
......@@ -57,9 +56,13 @@ while True:
else:
y += 30
position.append((x, y))
if x == apple_y and y == apple_y:
apple_x = 30*nam1-30
apple_y = 30*nam2-30
print("x="+str(x),"y="+str(y))
print("apple_x="+str(apple_y),"apple_y="+str(apple_y))
if x == apple_x and y == apple_y:
num1 = random.randint(0,22)
num2 = random.randint(0,16)
apple_x = 30*num1-30
apple_y = 30*num2-30
else:
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