Commit 773a1302 by BellCodeEditor

save project

parent 84551ce8
Showing with 6 additions and 1 deletions
......@@ -16,7 +16,8 @@ body = pygame.image.load('body.png') # 身体
left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下
myfont = pygame.font.Font('neuropol.ttf',18)
score = 0
x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_x,apple_y = 360,300
......@@ -53,6 +54,7 @@ while True:
y += 30
position.append((x, y))
if apple_x == x and apple_y == y:
score += 20
apple_x = random.randint(0,15)*30
apple_y = random.randint(0,21)*30
else:
......@@ -66,6 +68,9 @@ while True:
screen.blit(body, position[i])
# 将果实画上去
text = 'Score:'+str(score)
info = myfont.render(text,True,(20,20,20))
screen.blit(info, (540,10))
screen.blit(food, (apple_x, apple_y))
# 刷新画面
pygame.display.update()
......
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