Commit faf9a4ec by BellCodeEditor

save project

parent e2de3717
Showing with 11 additions and 6 deletions
...@@ -14,9 +14,11 @@ food = pygame.image.load('apple.png') # 食物 苹果 ...@@ -14,9 +14,11 @@ food = pygame.image.load('apple.png') # 食物 苹果
body = pygame.image.load('body.png') # 身体 body = pygame.image.load('body.png') # 身体
left = pygame.image.load('left.png') # 头 朝左 left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上 up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下 down = pygame.image.load('down.png')
apple_x=300 apple_x=60
apple_y=360 apple_y=120 # 头 朝下
jx=300
jy=360
x, y = 240, 120 x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)] position = [(180, 90), (180, 120), (210, 120), (x, y)]
...@@ -51,9 +53,12 @@ while True: ...@@ -51,9 +53,12 @@ while True:
y -= 30 y -= 30
else: else:
y += 30 y += 30
if x==apple_x and y==apple_y: if x==jx and y==jy:
apple_x=random.randint(0,660) jx=random.randint(0,22)
apple_y=random.randint(0,480) jy=random.randint(0,16)
apple_x=jx*30-30
apple_y=jy*30-30
position.append((x, y)) position.append((x, y))
position.pop(0) 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