Commit 2cf9dd76 by BellCodeEditor

save project

parent 95690227
Showing with 27 additions and 0 deletions
...@@ -43,16 +43,40 @@ while True: ...@@ -43,16 +43,40 @@ while True:
y-=30 y-=30
if y<0: if y<0:
y=480 y=480
if y>480:
y=0
if x>660:
x=0
if x<0:
x=660
if heading=='down': if heading=='down':
y+=30 y+=30
if y<0:
y=480
if y>480: if y>480:
y=0 y=0
if x>660:
x=0
if x<0:
x=660
if heading=='right': if heading=='right':
x+=30 x+=30
if y<0:
y=480
if y>480:
y=0
if x>660: if x>660:
x=0 x=0
if x<0:
x=660
if heading=='left': if heading=='left':
x-=30 x-=30
if y<0:
y=480
if y>480:
y=0
if x>660:
x=0
if x<0: if x<0:
x=660 x=660
#增加坐标 #增加坐标
...@@ -83,6 +107,9 @@ while True: ...@@ -83,6 +107,9 @@ while True:
if apple_x==x and apple_y==y: if apple_x==x and apple_y==y:
apple_x=random.randint(0,21)*30 apple_x=random.randint(0,21)*30
apple_y=random.randint(0,15)*30 apple_y=random.randint(0,15)*30
if (apple_x,apple_y) in list:
apple_x=random.randint(0,21)*30
apple_y=random.randint(0,15)*30
# print(list) 用于检测错误 # print(list) 用于检测错误
# 将果实画上去 # 将果实画上去
......
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