Commit e1ffe331 by BellCodeEditor

save project

parent 139ca2e6
Showing with 10 additions and 8 deletions
...@@ -58,14 +58,15 @@ while True: ...@@ -58,14 +58,15 @@ while True:
if (x,y)==(apple_x,apple_y): if (x,y)==(apple_x,apple_y):
shuax() shuax()
score+=1 score+=1
# os.system('cls') os.system('cls')
# print('score:'+str(score)) print('score:'+str(score))
if (apple_x,apple_y) in pos: while (apple_x,apple_y) in pos:
shuax() shuax()
else: else:
pos.pop(0) pos.pop(0)
if (x,y) in pos[0:-2]: if (x,y) in pos[0:-2]:
exit() exit()
...@@ -80,14 +81,15 @@ while True: ...@@ -80,14 +81,15 @@ while True:
text = my_font.render(info,True,(0,0,0)) text = my_font.render(info,True,(0,0,0))
screen.blit(text,(540,10)) screen.blit(text,(540,10))
pygame.display.update() pygame.display.update()
if x>660: if x>630:
(x,y)=(0,y) x=-30
elif x<0: elif x<0:
(x,y) = (680,y) x=660
elif y>480: elif y>480:
(x,y) = (x,0) y=-30
elif y<0: elif y<0:
(x,y) = (x,480) y=480
FPSCLOCK.tick(3) FPSCLOCK.tick(3)
......
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