0

试图把它作为一个范围,但说不能完成两个操作。

检查与障碍物的碰撞

if (head.ycor()<200 and head.ycor()>-200 and head.xcor()<10 and head.xcor()>-10):
    time.sleep(1)
    head.goto(-70, 0)
    head.direction = "stop"
    head.clear()

# Barrier
barrier = turtle.Turtle()
barrier.shape("square")
barrier.color("yellow")
barrier.speed(0)
barrier.goto(0, 0)
barrier.shapesize(stretch_len=1, stretch_wid=20)
barrier.penup()
4

0 回答 0