Commit bd82a0ef by BellCodeEditor

save project

parent 87a4021f
Showing with 7 additions and 0 deletions
......@@ -8,6 +8,7 @@ pygame.init()
screen = pygame.display.set_mode((660, 480))
FPSCLOCK=pygame.time.Clock()
# 背景
my_font=pygame.font.Font('neuropol.ttf',20)
background = pygame.image.load('bg.png')
right = pygame.image.load('right.png')
food = pygame.image.load('apple.png')
......@@ -18,6 +19,7 @@ down = pygame.image.load('down.png')
x,y=240, 120
applex=360
appley=270
score=0
pos=[(180,90),(180,120),(210,120),(x,y)]
setheading='right'
snake_head = right
......@@ -55,6 +57,7 @@ while True:
num2=random.randint(0,22)
applex=num2*30-30
appley=num1*30-30
score+=10
else:
pos.pop(0)
pos.append((x,y))
......@@ -70,5 +73,8 @@ while True:
# 将果实画上去
screen.blit(food, (applex, appley))
# 刷新画面
info='Score:'+str(score)
text=my_font.render(info,True,(0,0,0))
screen.blit(text,(530,15))
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