Commit 24ccea5d by BellCodeEditor

auto save

parent c706e79d
Showing with 6 additions and 1 deletions
......@@ -14,13 +14,15 @@ body = pygame.image.load('body.png')
left = pygame.image.load('left.png')
up = pygame.image.load('up.png')
down = pygame.image.load('down.png')
my_font = pygame.font.Font("neuropol.ttf", 18)
x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
apple_x = random.randrange(0,660,30)
apple_y = random.randrange(0,480,30)
setheading = "right"
snake_head = right
score = 0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -55,6 +57,9 @@ while True:
position.pop(0)
# 将背景图画上去
screen.blit(background, (0, 0))
info = "Score" + str(score)
text = my_font.render(info, True, (0,0,0))
screen.blit (text,(540,10))
# 将贪吃蛇画上去
screen.blit(snake_head, position[-1])
for i in range(len(position)-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