【发布时间】:2023-02-26 19:21:55
【问题描述】:
我正在制作一个带有地图边界的乌龟游戏,但我的乌龟只适用于 x 边界,只是跳过 y 边界。任何人都可以帮忙吗?
def gameplay():
t.forward(10)
t.heading()
time.sleep(0.1)
sc.onkey(turnleft, "Left")
sc.onkey(turnright, "Right")
sc.listen()
if t.distance(apple) < radius_sum:
apple.goto(random.randrange(-500, 500), (random.randrange(-500, 500)))
if t.position() >= (500,500):
t.penup()
t.back(1000)
t.pendown()
if t.position() <=(-500,-500):
t.penup()
t.back(1000)
t.pendown()
【问题讨论】:
标签: python turtle-graphics python-turtle