Commit 0346e141 by BellCodeEditor

save project

parent d53076b3
Showing with 10 additions and 7 deletions
...@@ -55,7 +55,6 @@ while True: ...@@ -55,7 +55,6 @@ while True:
else: else:
y += 30 y += 30
position.append((x, y)) position.append((x, y))
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
apple1_x=random.randint(0,21) apple1_x=random.randint(0,21)
apple1_y=random.randint(0,15) apple1_y=random.randint(0,15)
...@@ -63,17 +62,20 @@ while True: ...@@ -63,17 +62,20 @@ while True:
apple_y=apple1_y*30 apple_y=apple1_y*30
else: else:
position.pop(0) position.pop(0)
if x<0 or x>630 or y<0 or y>450:
exit()
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
into="score:"+str(score) into="score:"+str(score)
text=my_font.render(into,True,(197,200,201)) text=my_font.rander(into,True,(197,200,201))
screen.blit(text,(570,10)) screen
screen.blit(snake_head, position[-1]) screen.blit(snake_head, position[-1])
for i in range(len(position)-1): for i in range(len(position)-1):
screen.blit(body, position[i]) screen.blit(body, position[i])
screen.blit(food,(apple_x,apple_y)) screen.blit(background, (0, 0))
into="score:"+str(score)
text=my_font.rander(into,True,(197,200,201))
screen.blit(text,(570,10))
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.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