Commit 44927bda by BellCodeEditor

save project

parent 195db8de
Showing with 9 additions and 1 deletions
......@@ -18,6 +18,7 @@ left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下
text = pygame.font.Font("neuropol.ttf",20)
over = pygame.font.Font("neuropol.ttf",40)
x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
......@@ -60,10 +61,12 @@ while True:
Score+=10
else:
position.pop(0)
if x>630 or x<0 or y>450 or y<0:
over_txt=over.render("Game Over",True,(0,0,0))
break
out_score="Score:"+str(Score)
# 将背景图画上去
screen.blit(background, (0, 0))
# 将果实画上去
screen.blit(food, (apple_X,apple_Y))
# 将贪吃蛇的头画上去
......@@ -77,3 +80,7 @@ while True:
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(ticktime)
screen.blit(over_txt,(175,200))
for i in range(6):
pygame.display.update()
FPSCLOCK.tick(ticktime)
\ 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