Commit 95ca8934 by BellCodeEditor

save project

parent 8e6026f0
Showing with 14 additions and 4 deletions
...@@ -18,6 +18,8 @@ body = pygame.image.load('body.png') ...@@ -18,6 +18,8 @@ body = pygame.image.load('body.png')
left = pygame.image.load('left.png') 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')
ziti=pygame.font.Font('neuropol.ttf',10)
fenshu=0
head=right head=right
x, y = 120, 240 x, y = 120, 240
heading='right' heading='right'
...@@ -50,13 +52,21 @@ while True: ...@@ -50,13 +52,21 @@ while True:
y-=30 y-=30
else: else:
y+=30 y+=30
snake.append((x,y))
if x==ap1 and y==ap2: if x==ap1 and y==ap2:
ap1=random.(randint(0,21))30 ap1=(random.randint(0,21))*30
ap2=random.(randint(0,15))*30 ap2=(random.randint(0,15))*30
snake.append((x,y)) fenshu+=1
snake.pop(0) else:
snake.pop(0)
info = "fenshu" + str(fenshu)
yanse = ziti.render(info,False,(0,0,0))
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(yanse,(600,60))
# 将贪吃蛇画上去 # 将贪吃蛇画上去
screen.blit(head, snake[-1]) screen.blit(head, snake[-1])
# 将贪吃蛇的身体画上去 # 将贪吃蛇的身体画上去
......
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