AnnoyingDog
AnnoyingDog

Reputation: 3

Variable for location of turtle

I'm trying to make a game using turtle in python. I'm trying to code some sort of collision. My original idea is to have a variable be the location of a turtle so, for example, if turtle 1's location/coordinates are equal to that of turtle 2's the game ends. So in layman's terms I want to know if there is a way to turn the location of a turtle into a variable.

Upvotes: 0

Views: 1339

Answers (1)

letmutx
letmutx

Reputation: 1416

Use the pos method or other methods defined here to get the location of the turtle.

pos returns the position as a Vec2D vector. xcor and ycor return the current x and y coordinates of turtle as float.

Upvotes: 1

Related Questions