Commit 2a579c09 by BellCodeEditor

save project

parent 566e1a2a
Showing with 6 additions and 0 deletions
...@@ -14,11 +14,13 @@ left=pygame.image.load('left.png') ...@@ -14,11 +14,13 @@ left=pygame.image.load('left.png')
up=pygame.image.load('up.png') up=pygame.image.load('up.png')
down=pygame.image.load('down.png') down=pygame.image.load('down.png')
f=pygame.time.Clock() f=pygame.time.Clock()
my_foot=pygame.font.Font('neuropol.ttf',18)
x,y=240,120 x,y=240,120
p=[(180,90),(180,120),(210,120),(x,y)] p=[(180,90),(180,120),(210,120),(x,y)]
setheading="right" setheading="right"
apple_x=300 apple_x=300
apple_y=360 apple_y=360
ds=0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -55,10 +57,14 @@ while True: ...@@ -55,10 +57,14 @@ while True:
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
apple_x=random.randint(0,21)*30 apple_x=random.randint(0,21)*30
apple_y=random.randint(0,15)*30 apple_y=random.randint(0,15)*30
ds+=1
else: else:
p.pop(0) p.pop(0)
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x,apple_y)) screen.blit(food, (apple_x,apple_y))
info="S"+str(ds)
lp=my_foot.render(info,True,(0,0,0))
screen.blit(lp,(600,0))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
f.tick(3) f.tick(3)
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