Commit c77235d3 by BellCodeEditor

save project

parent 4c156670
Showing with 7 additions and 5 deletions
...@@ -20,7 +20,7 @@ down = pygame.image.load('down.png') # 头 朝下 ...@@ -20,7 +20,7 @@ down = pygame.image.load('down.png') # 头 朝下
mf=pygame.font.Font('neuropol.ttf',18) mf=pygame.font.Font('neuropol.ttf',18)
x, y = 240, 120 x, y = 240, 120
position = [(210, 120), (x, y)] position = [(210, 120), (x, y)]
s=0 s=40
t=3 t=3
long=0 long=0
setheading = "right" setheading = "right"
...@@ -69,7 +69,7 @@ while True: ...@@ -69,7 +69,7 @@ while True:
screen.blit(snake_head, position[-1]) screen.blit(snake_head, position[-1])
info='SOCRE:'+str(s)+'!' info='SOCRE:'+str(s)+'!'
text=mf.render(info,True,(0,0,0)) text=mf.render(info,True,(0,0,0))
screen.blit(text,(540,10)) screen.blit(text,(450,10))
# 将果实画上去 # 将果实画上去
screen.blit(food, (apple_x, apple_y)) screen.blit(food, (apple_x, apple_y))
if x==apple_x and y==apple_y: if x==apple_x and y==apple_y:
...@@ -79,12 +79,14 @@ while True: ...@@ -79,12 +79,14 @@ while True:
t+=0.5 t+=0.5
if s>=10 and s<20: if s>=10 and s<20:
t+=0.7 t+=0.7
if s>=20: if s>=20 and s<40:
t+=1 t+=1
if s>=40:
t+=2;
s+=1 s+=1
long=1 long=1
apple_x=random.randint(2,22)*30-30 apple_x=random.randint(2,21)*30-30
apple_y=random.randint(2,16)*30-30 apple_y=random.randint(2,15)*30-30
if long==0: if long==0:
position.pop(0) position.pop(0)
if x<0 or y<0 or x>630 or y>450: if x<0 or y<0 or x>630 or y>450:
......
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