Commit 5d02798c by BellCodeEditor

save project

parent 48a5431f
Showing with 8 additions and 4 deletions
......@@ -17,14 +17,14 @@ body = pygame.image.load('body.png') # 身体
left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下
zt = pygame.font.Font('neuropol.ttf',18)
x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_x = 360
apple_y = 300
setheading = "right"
snake_head = right
score = 0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -55,6 +55,7 @@ while True:
y += 30
position.append((x, y))
if x == apple_x and y == apple_y:
score+=100000000000000000000000000000000000000000000000
apple_x = random.randint(0,21)*30
apple_y = random.randint(0,15)*30
else:
......@@ -69,6 +70,9 @@ while True:
# 将果实画上去
screen.blit(food, (apple_x, apple_y))
info = "Score"+ str(score)
text = zt.render(info,True,(0,0,250))
screen.blit(text,(540,10))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(10)
\ No newline at end of file
FPSCLOCK.tick(8)
\ 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