Here's the code I put together to create concentric circles using Python:
def concentric(myTurtle,number,spacing): for radius in range(number): x = myTurtle.xcor() y = myTurtle.ycor() myTurtle.up() myTurtle.goto(x,spacing) myTurtle.down() drawCircle(myTurtle,radius*y+spacing) myTurtle.up() myTurtle.goto(x,spacing) myTurtle.down()
It, however, has a critical flaw. I need the code to be able to goto any given set of (x,y) coordinates and function correctly, example:
t.up() t.goto(-150, -150) t.down() concentric(t, 6, 10)
The turtle moves to (-150,-150), then, because the code specifies the y-value to be spacing, moves back to the y-value of spacing. How do I get my cTurtle function to accept different y-values, while still using spacing (critical for the concentric circles).
What the heck am I missing?
P.S. Just to keep it honest, this is for a a class project, and I would appreciate it if I could be guided without the answer being "explicity" given (learning, et cetera).
If I have the first goto set to (x,y), the turtle goes to the correct location, draws one circle, then quickly jumps back to "spacing". "y+spacing" does nothing.
Edited 6 Years Ago by xSDMx: n/a