Commit 95ca8934 by BellCodeEditor

save project

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