Ask coding questions

← Back to all posts
AmiteshJinka (1)

Hi, can someone tell me how to reset a turtle (in python) to its original state? I don't mean turtle.reset(), I mean making it go back to the position I set it to, and have its settings (like penup and shape etc.) what I set it to. For example, if two turtles hit each other, I want them both to go their starting positions and do the same function again.
This will really help me a lot.

Answered by Aivoybia (25) [earned 5 cycles]
View Answer
Aivoybia (25)
import turtle

t = turtle.Turtle()
y = turtle.Turtle()

t.goto(1, 100) (for example)
y.goto(100, 100) (for example)

if [collision stuff]:
  t.goto(1, 100) #(the same x y as earlier)
  y.goto(100, 100) #(same as earlier as well)
AmiteshJinka (1)

@Aivoybia Thanks! (Can't believe I didn't think of that lmao)

Aivoybia (25)

@AmiteshJinka np.

would you mind marking my answer as correct?
just click the grey checkmark under the upvote sign, to the left of my comment

AmiteshJinka (1)

@Aivoybia Yea, okay. Your welcome.

Aivoybia (25)

@Aivoybia oh... that works too i guess