Commit 672d144d by BellCodeEditor

save project

parent 3b7c0183
Showing with 6 additions and 5 deletions
......@@ -23,9 +23,9 @@ position = [(180, 90), (180, 120), (210, 120), (x, y)]
setheading = "right"
snake_head = right
n=30
apple_x=12*n
apple_y=10*n
apple_x=12
apple_y=10
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -56,8 +56,9 @@ while True:
y += 30
position.append((x, y))
if x == apple_x and y == apple_y:
apple_x = random.randint(0,21*n)
apple_y = random.randint(0,15*n)
apple_x = 30*random.randint(0,21)
apple_y = 30*random.randint(0,15)
else:
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 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