Reputation: 881
This one is pretty simple but I keep running into problems around how colours are stored. Both of the following produce an error saying colour should be three numbers for RGB.
let temp [color] of topTurtle ask turtles [set color temp]
or
ask turtles [set color [color of topturtle]]
What's the correct way to do this please?
Upvotes: 0
Views: 41
Reputation: 2305
Your second option should be ask turtles [set color [color] of topturtle]
, you put the brackets wrong.
Other than that error, both options work just fine for me. If I enter the following lines in the command center, they work just fine.
crt 5 [setxy random-xcor random-ycor]
let temp [color] of turtle 0 ask turtles [set color temp]
The same goes for
crt 5 [setxy random-xcor random-ycor]
ask turtles [set color [color] of turtle 0]
Upvotes: 1