simple square-dancing turtles
def choreography1():
world = makeWorld()
dexter = makeTurtle(world)
elliott = makeTurtle(world)
square2(dexter, 90)
square2(elliott, -90)
def square2(turtle, angle):
for i in range(4):
turtle.forward(100)
turtle.turn(angle)
time.sleep(1.0)
def choreography2():
picture = makePicture(getMediaPath("beach-smaller.jpg"))
world = makeWorld(getWidth(picture), getHeight(picture))
anon = makeTurtle(world)
anon.penUp()
anon.hide()
anon.moveTo(0,0)
anon.drop(picture)
dexter = makeTurtle(world)
elliott = makeTurtle(world)
for side in range(4):
myForward(dexter, 100)
myForward(elliott, 100)
dexter.turn(90)
elliott.turn(-90)
time.sleep(0.25)
def myForward(turtle, dist):
for i in range(dist):
turtle.forward(1)
time.sleep(0.01)
Link to this Page