Commit 20c57e7b by BellCodeEditor

auto save

parent 506a7058
File added
File added
File added
File added
File added
......@@ -23,7 +23,8 @@ position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_x,apple_y = 360,300
setheading = "right"
snake_head = right
my_font=pygame.font.Font('neuropol.ttf',18)
score=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -56,6 +57,8 @@ while True:
if x == apple_x and y == apple_y:
apple_x = (randint(0,630)//30)*30
apple_y = (randint(0,450)//30)*30
score+=10
else:
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
......@@ -67,6 +70,11 @@ while True:
# 将果实画上去
screen.blit(food, (apple_x, apple_y))
#将文本信息画上去
info = 'Score' + str(score)
text=my_font.render(info,True,(0,0,0))
screen.blit(text,(540,10))
# 刷新画面
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