Commit 761729c4 by BellCodeEditor

save project

parent a9879301
Showing with 7 additions and 2 deletions
......@@ -13,10 +13,12 @@ body = pygame.image.load('body.png')
down = pygame.image.load('down.png')
up = pygame.image.load('up.png')
left = pygame.image.load('left.png')
my_font=pygame.font.Font('neuropol.ttf',18)
zx='right'
cx=right
x,y=240,120
flb=[(180,90),(180,120),(210,120),(x,y)]
score=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -46,13 +48,15 @@ while True:
y-=30
if x==food_x and y==food_y:
score+=10
food_x=random.randint(1,22)
food_y=random.randint(1,16)
food_x=food_x*30
food_y=food_y*30
else:
flb.pop(0)
info='Score'+str(score)
text=my_font.render(info,True,(0,0,0))
flb.append((x,y))
screen.blit(background, (0, 0))
screen.blit(cx, (x,y))
......@@ -60,7 +64,7 @@ while True:
screen.blit(body,flb[i])
screen.blit(food, (food_x,food_y))
screen.blit(text,(540,10))
pygame.display.update()
lock.tick(3)
\ 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