Commit 32e8014f by BellCodeEditor

save project

parent 70dad483
Showing with 10 additions and 4 deletions
...@@ -11,6 +11,8 @@ body = pygame.image.load('body.png') ...@@ -11,6 +11,8 @@ body = pygame.image.load('body.png')
down = pygame.image.load('down.png') down = pygame.image.load('down.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')
my_font=pygame.font.Font("neuropol.ttf",18)
score=0
x,y=240,120 x,y=240,120
postion=[(180,90),(180,120),(210,120),(x,y)] postion=[(180,90),(180,120),(210,120),(x,y)]
sb="right" sb="right"
...@@ -43,14 +45,17 @@ while True: ...@@ -43,14 +45,17 @@ while True:
else: else:
y+=30 y+=30
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
apple_x=random.randint(0,660) num1=random.randint(0,22)
apple_y=random.randint(480,0) num2=random.randint(0,16)
apple_x=num1*30-30
apple_y=num2*30-30
else:
postion.pop(0)
postion.append((x,y)) postion.append((x,y))
postion.pop(0)
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
screen.blit(dsb, postion[-1]) screen.blit(dsb, postion[-1])
for i in range(len(postion)-1): for i in range(len(postion)-1):
screen.blit(body,(postion[i])) screen.blit(body,postion[i])
screen.blit(food,(apple_x,apple_y)) screen.blit(food,(apple_x,apple_y))
pygame.display.update() pygame.display.update()
weee.tick(3) weee.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