Commit e2e8d469 by BellCodeEditor

save project

parent 58fdfeee
Showing with 4 additions and 3 deletions
...@@ -17,6 +17,7 @@ down = pygame.image.load('down.png') ...@@ -17,6 +17,7 @@ down = pygame.image.load('down.png')
body = pygame.image.load('body.png') body = pygame.image.load('body.png')
setheading ="right" setheading ="right"
snake_head =right snake_head =right
text=pygame.
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -43,14 +44,11 @@ while True: ...@@ -43,14 +44,11 @@ while True:
elif setheading =="down": elif setheading =="down":
y+=30 y+=30
p.append((x,y)) p.append((x,y))
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
num1=random.randint(1,22) num1=random.randint(1,22)
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
else: else:
p.pop(0) p.pop(0)
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
...@@ -58,5 +56,7 @@ while True: ...@@ -58,5 +56,7 @@ while True:
for i in range(len(p)-1): for i in range(len(p)-1):
screen.blit(body,p[i]) screen.blit(body,p[i])
screen.blit(food, (apple_x, apple_y)) screen.blit(food, (apple_x, apple_y))
info="Store"
pygame.display.update() pygame.display.update()
fps.tick(3) fps.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