user7115782
user7115782

Reputation:

How can I make a turtle look at another turtle?

I am supposed to write a program that makes a turtle follow another one. All I need is a function that turns the following turtle towards the one running away.

Upvotes: 0

Views: 436

Answers (1)

cdlane
cdlane

Reputation: 41872

It's not a function but a pair of functions:

chase_turtle.setheading(chase_turtle.towards(flee_turtle))

.towards() gets the angle to the other turtle and .setheading() aligns your turtle to it.

Make sure to keep the documentation at the ready when you program with turtles.

Upvotes: 1

Related Questions