Commit ac54a1f7 by BellCodeEditor

save project

parent fc92b3d5
Showing with 7 additions and 1 deletions
......@@ -5,7 +5,7 @@ a_x=360
a_y=300
# 初始化pygame,为使用硬件做准备
pygame.init()
f=0
x,y=240,120
fang="right"
xiang=right = pygame.image.load('right.png')
......@@ -20,6 +20,7 @@ body = pygame.image.load('body.png')
up= pygame.image.load('up.png')
left= pygame.image.load('left.png')
down= pygame.image.load('down.png')
my_font=pygame.font.Font('neuropol.ttf',18)
fps=pygame.time.Clock()
zuo=[(180, 90), (180, 120),(210, 120),(x,y)]
while True:
......@@ -55,6 +56,7 @@ while True:
b=random.randint(0,11)
a_x=a*30
a_y=b*30
f=f+10
else:
zuo.pop(0)
zuo.append((x,y))
......@@ -67,6 +69,9 @@ while True:
screen.blit(food, (a_x, a_y))
for i in range(len(zuo)-1):
screen.blit(body,zuo[i])
info="score"+str(f)
t=my_font.render(info,True,(0,0,255))
screen.blit(t,(540,10))
# 刷新画面
pygame.display.update()
fps.tick(10)
\ 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