首页 > 解决方案 > 如何控制特定的海龟运动

问题描述

我正在做一个 Logo 的新项目。

我正在尝试制作具有不同形状的特定海龟,以在整个跑步过程中保持在同一位置;我尝试使用[set xcor and ycor],但没有用。

我该怎么做?

breed [cars car]
breed [gas_stations gas_station]


turtles-own [
   speed
   movement
   time-of-waiting
   extra-load
]

to setup
  clear-all
  ask patches [ setup-road ]
  setup-cars
  create-gas_stations 1 [
    set shape "gas"
    set size 5
    set color blue
    set xcor 25 set ycor 5
  ]
  reset-ticks
end

to setup-road ;; patch procedure
  ifelse pycor < 4 and pycor > -4 [set pcolor black ]
  [set pcolor green ]
   if pycor < 3 and pycor > -3 [ set pcolor gray ]
  if pycor > -3 and pycor < 3 and pxcor > 23 and pxcor < 27
   [set pcolor yellow ]

end

标签: netlogo

解决方案


推荐阅读