Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+12 votes

I made the turtles follow the mouse but I wanted to make the turtles follow at a distance . How do I do that?

asked in CSC 150 January201920 by (8 points)

3 Answers

+6 votes

You can do setxy (mouse-xcor + 1) (mouse-ycor +1) to make it stay a bit further from the mouse.

answered by (8 points)
+4 votes

Try something like this:

to go
  ask turtles [
    if (distancexy mouse-xcor mouse-ycor) > 4 [ 
      facexy mouse-xcor  mouse-ycor
      right random 180  ; a bit of random variation helps
      left random 180   ; the turtles separate from each other
      forward 0.1
    ]
  ]
end    
answered by (15.5k points)
+2 votes

You can use facexy (mouse-xcor) (mouse-ycor + 1)

answered by (8 points)
...