Commit 5cc05fe9 by BellCodeEditor

save project

parent 1c259111
Showing with 7 additions and 2 deletions
......@@ -17,8 +17,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') # 头 朝下
my-font=
my_font=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=240,300
......@@ -57,6 +57,7 @@ while True:
if x==apple_x and y==apple_y:
apple_x=randint(1,21)*30
apple_y=randint(1,15)*30
score+=10
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
......@@ -67,7 +68,10 @@ while True:
screen.blit(body, position[i])
# 将果实画上去
info='score'+str(score)
screen.blit(food, (apple_x,apple_y ))
text=my_font.render(info,True,(200,0,0))
screen.blit(text,(500,30))
# 刷新画面
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