turtle lesson

Asked by leynab over 1 year ago

I am working on the turtle draw lesson. I can make boxes and stars. How can I make it start in a new location?

1 response

  • enrique says

    Howdy leynab, hope you are enjoying ruby and the Turtle.

    I don't think the lesson mentions it, but you can also use a couple of commands called penup and pendown to allow moving without drawing.

    For example, this will take the pen off the 'paper', move 150, then put the pen back down and continue.

    Turtle.start do
      penup
      forward 150
      pendown
      pencolor maroon
      4.times do
        forward 50
        turnright 90
      end
    end
    

    Note: if you penup then you must use pendown again to continue drawing (to see what happens, remove the pendown and run it)

    Cheers