Commit ca147088 by BellCodeEditor

save project

parent 9f31455b
Showing with 7 additions and 1 deletions
...@@ -10,8 +10,10 @@ screen = pygame.display.set_mode((660, 480)) ...@@ -10,8 +10,10 @@ screen = pygame.display.set_mode((660, 480))
x,y=240, 120 x,y=240, 120
food_x=360 food_x=360
food_y=300 food_y=300
score=0
aaa=[(180, 90),(180, 120),(210, 120),(x,y)] aaa=[(180, 90),(180, 120),(210, 120),(x,y)]
# 背景 # 背景
taxt=pygame.font.Font('neuropol.ttf',18)
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
right = pygame.image.load('right.png') right = pygame.image.load('right.png')
left = pygame.image.load('left.png') left = pygame.image.load('left.png')
...@@ -56,6 +58,7 @@ while True: ...@@ -56,6 +58,7 @@ while True:
umb_2=random.randint(0,16) umb_2=random.randint(0,16)
food_x=(umb_1-1)*30 food_x=(umb_1-1)*30
food_y=(umb_2-1)*30 food_y=(umb_2-1)*30
score+=10
else: else:
aaa.pop(0) aaa.pop(0)
...@@ -68,7 +71,9 @@ while True: ...@@ -68,7 +71,9 @@ while True:
screen.blit(body,aaa[i]) screen.blit(body,aaa[i])
# 将果实画上去 # 将果实画上去
screen.blit(food, (food_x, food_y)) screen.blit(food, (food_x, food_y))
info='Score:'+str(score)
Taxt=taxt.render(info,True,(0,0,0))
screen.blit(Taxt,(540,10))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
aa.tick(4) aa.tick(4)
\ 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