Colors 如何设置滑块制作的海龟的颜色?

Colors 如何设置滑块制作的海龟的颜色?,colors,netlogo,Colors,Netlogo,我正在尝试创建一个模拟,在那里有僵尸和人类海龟在世界各地移动。我使用2个滑块来创建不同数量的僵尸和人类。我想将僵尸的颜色设置为绿色,人类的颜色设置为红色。以下是我目前的代码: to setup cro Zombies cro Humans ask turtles [set shape "person"] end 我不确定如何设置僵尸和人类的颜色,因为它们只被解释为数字,我不能使用: ask Zombies [set color green] 任何想法都非常感谢 你有什么理由不想使

我正在尝试创建一个模拟,在那里有僵尸和人类海龟在世界各地移动。我使用2个滑块来创建不同数量的僵尸和人类。我想将僵尸的颜色设置为绿色,人类的颜色设置为红色。以下是我目前的代码:

 to setup
 cro Zombies
 cro Humans
 ask turtles [set shape "person"]
 end 
我不确定如何设置僵尸和人类的颜色,因为它们只被解释为数字,我不能使用:

ask Zombies [set color green]

任何想法都非常感谢

你有什么理由不想使用
breed
s吗?从长远来看,这可能会让你的生活轻松很多。例如,此基本设置有两个类似于您的滑块,但请注意,它们被称为“n-僵尸”和“n-人类”:

给你一些类似于:


您有什么理由不想使用
品种
s吗?从长远来看,这可能会让你的生活轻松很多。例如,此基本设置有两个类似于您的滑块,但请注意,它们被称为“n-僵尸”和“n-人类”:

给你一些类似于:

breed [ zombies zombie ]
breed [ humans human ]

to setup
  ca
  set-default-shape turtles "person"
  ; create a number of zombies set by the "n-Zombies" slider
  create-zombies n-Zombies [
    set color green
    setxy random-xcor random-ycor
  ]
  ; create a number of humans set by the "n-Humans" slider
  create-humans n-Humans [
    set color red
    setxy random-xcor random-ycor
  ]
  reset-ticks
end