Commit 294a3b11 by BellCodeEditor

save project

parent 0a0e0d30
Showing with 8 additions and 4 deletions
......@@ -54,9 +54,12 @@ while True:
else:
y += 30
position.append((x, y))
if x==apply_x and apply_y:
apply_x=random.randint(0,630)
apply_y=random.randint(0,450)
if x==apply_x and y==apply_y:
num1=random.randint(0,22)
num2=random.randint(0,16)
apply_x=num1*30-30
apply_y=num2*30-30
else:
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
......@@ -67,7 +70,7 @@ while True:
screen.blit(body, position[i])
# 将果实画上去
screen.blit(food, (apply_x, apply_y))
screen.blit(food, (apply_x,apply_y))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
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