Commit bc500774 by BellCodeEditor

save project

parent 2d446cf9
Showing with 6 additions and 3 deletions
......@@ -22,7 +22,7 @@ head='right'
fps=pygame.time.Clock()
a_x=360
a_y=300
myfont=pygame.font.Font(neuropol.ttf)
myfont=pygame.font.Font('neuropol.ttf',18)
score=0
while True:
for event in pygame.event.get():
......@@ -55,11 +55,14 @@ while True:
if x==a_x and y==a_y:
a_x=random.randint(0,21)*30
a_y=random.randint(0,15)*30
score+=1
score+=100
else:
pos.pop(0)
if x<0 or x>630 or y<0 or y>450:
exit()
for i,j in pos[:-1]:
if x==i and y==j:
exit()
# 将背景图画上去
screen.blit(background,(0,0))
# 将贪吃蛇画上去
......@@ -69,7 +72,7 @@ while True:
screen.blit(body,pos[i])
# 将果实画上去
screen.blit(food,(a_x, a_y))
tdxt=myfont.render('Score:'+str(score),True,(0,0,0))
text=myfont.render('Score:'+str(score),True,(0,0,0))
screen.blit(text,(540,10))
# 刷新画面
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