Commit 096053dc by BellCodeEditor

auto save

parent 3fd9a67b
Showing with 5 additions and 4 deletions
......@@ -17,6 +17,8 @@ left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下
text
x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_x = 360
......@@ -54,8 +56,7 @@ while True:
else:
y += 30
position.append((x, y))
position.pop(0)
if x == apple_x or apple_y == y:
if x == apple_x and apple_y == y:
num1 = random.randint(1,22)
num2 = random.randint(1,16)
apple_x = num1*30-30
......@@ -75,4 +76,4 @@ while True:
screen.blit(food, (apple_x, apple_y))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(2)
\ No newline at end of file
FPSCLOCK.tick(10)
\ 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