dũng bùi
dũng bùi

Reputation: 55

Change the color of the turtle on the move

enter image description hereI'm writing a program about traffic in roundabouts. I have 3 colors for 3 different directions car was red car turn right, go straight green car, sky turn left. because there is one lane for turning right should not I want to change the car red car blue sky or other AU to the cars that did not go right anymore? What function should I use to change the color of the car?

Upvotes: 2

Views: 61

Answers (1)

JenB
JenB

Reputation: 17678

This will not be correct because I can't work out exactly what you need from the question, but you need to use the with statement to identify the correct cars. Here is something that is close to what I think you want:

to ...
  ...
  let to-be-red cars with [ (heading = 0 or heading = 180)
                            and distancexy 0 0 < 30
                            and ycor < -11 ]
  ask to-be-red [ set color red ]
end

Upvotes: 1

Related Questions