Commit a0c8c9ed by BellCodeEditor

save project

parent 04e53214
Showing with 5 additions and 12 deletions
...@@ -49,13 +49,13 @@ while True: ...@@ -49,13 +49,13 @@ while True:
# 设置贪吃蛇的头部坐标 # 设置贪吃蛇的头部坐标
if setheading == "right": if setheading == "right":
x +=10 x +=30
elif setheading == "left": elif setheading == "left":
x -=10 x -=30
elif setheading == "up": elif setheading == "up":
y -=10 y -=30
else: else:
y +=10 y +=30
position.append((x, y)) position.append((x, y))
# 将背景图画上去 # 将背景图画上去
...@@ -71,20 +71,13 @@ while True: ...@@ -71,20 +71,13 @@ while True:
# 将果实画上去 # 将果实画上去
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:
if s<5: t+=0.2
t+=0.2
if s>=5 and s<10:
t+=0.5
if s>=10:
t+=1;
s+=1 s+=1
long=1 long=1
apple_x=random.randint(1,22)*30-30 apple_x=random.randint(1,22)*30-30
apple_y=random.randint(1,16)*30-30 apple_y=random.randint(1,16)*30-30
if long==0: if long==0:
position.pop(0) position.pop(0)
if x<0 or y>450 or y<0 or x>630:
quit()
# 刷新画面 # 刷新画面
......
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