Commit aed84821 by BellCodeEditor

save project

parent 956c24bd
Showing with 6 additions and 2 deletions
...@@ -10,12 +10,14 @@ body=pygame.image.load('body.png') ...@@ -10,12 +10,14 @@ 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')
my_font=pygame.font.Font("neuropol.ttf",18)
x,y=240,120 x,y=240,120
position=[(180,90),(180,120),(210,120),(x,y)] position=[(180,90),(180,120),(210,120),(x,y)]
apple_x=360 apple_x=360
apple_y=360 apple_y=360
setheading="right" setheading="right"
snake_head=right snake_head=right
score=0
# 创建一个窗口 # 创建一个窗口
screen=pygame.display.set_mode((660,480)) screen=pygame.display.set_mode((660,480))
FPSCLOCK=pygame.time.Clock() FPSCLOCK=pygame.time.Clock()
...@@ -51,6 +53,7 @@ while True: ...@@ -51,6 +53,7 @@ while True:
num2=random.randint(1,16) num2=random.randint(1,16)
apple_x=30*num1-30 apple_x=30*num1-30
apple_y=30*num2-30 apple_y=30*num2-30
score+=2
else: else:
position.pop(0) position.pop(0)
screen.blit(background,(0,0)) screen.blit(background,(0,0))
...@@ -60,8 +63,9 @@ while True: ...@@ -60,8 +63,9 @@ while True:
screen.blit(body,position[i]) screen.blit(body,position[i])
screen.blit(food,(apple_x,apple_y)) screen.blit(food,(apple_x,apple_y))
# screen.blit(body,(210,120)) info="Score"+str(score)
# screen.blit(body,(180,120)) text=my_font.render(info,True,(0,0,0))
screen.blit(text,(540,10))
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.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