Commit 5532b546 by BellCodeEditor

save project

parent c5e39947
Showing with 6 additions and 4 deletions
...@@ -55,8 +55,8 @@ while True: ...@@ -55,8 +55,8 @@ while True:
position.append((x, y)) position.append((x, y))
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
score+=10 score+=10
apple_x=random.randint(0,21)*30 apple_x=random.randint(0,20)*30
apple_y=random.randint(0,15)*30 apple_y=random.randint(0,14)*30
else: else:
position.pop(0) position.pop(0)
# 将背景图画上去 # 将背景图画上去
...@@ -71,7 +71,8 @@ while True: ...@@ -71,7 +71,8 @@ while True:
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x,apple_y)) screen.blit(food, (apple_x,apple_y))
# 刷新画面 # 刷新画面
my_font=pygame.font.Font("neuropol.ttf",18) my_font = pygame.font.Font("neuropol.ttf",18)
text=my_font.render('score:10',True,(0,0,0)) text = my_font.render("score:"+str(score),True,(0,0,0))
screen.blit(text, (540, 5))
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) 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