Commit 987bd17c by BellCodeEditor

save project

parent 0690d187
Showing with 6 additions and 0 deletions
......@@ -16,6 +16,7 @@ body = pygame.image.load('body.png')
left=pygame.image.load('left.png')
up=pygame.image.load('up.png')
down=pygame.image.load('down.png')
my_font=pygame.font.Font('neuropol.ttf',18)
x=240
y=120
......@@ -26,6 +27,7 @@ apple_y=300
setheading="right"
snake_head=right
score=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -58,6 +60,7 @@ while True:
num2=random.randint(1,16)
apple_x=30*num1-30
apple_y=30*num2-30
score+=1
else:
positon.pop(0)
# 将背景图画上去
......@@ -69,6 +72,9 @@ while True:
screen.blit(body, positon[i])
# 将果实画上去
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()
......
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