Libraries‎ > ‎Library‎ > ‎Movement‎ > ‎

Move towards another

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:
Begin description:Move horizontally or vertically towards another agent.End description

Move towards another

Begin NetLogo code:
substitute-text-area-for expression-for-other the-other substitute-text-area-for speed 1           move-horizontally-or-vertically-towards-another    expression-for-other ; other agent or patch   speed ; maximum distance moved
End NetLogo code

Variants

You can replace the first text area with any expression that reports a patch or an agent such as any-of-kind "Prototype1".  You can change the speed of the movement by editing the second text area. By clicking on the 'Enhance' menu you can make this occur repeatedly.

How this works

This uses move-horizontally-or-vertically-towards-another to move speed units towards the patch of  the agent referenced in the first box. The odds of whether it moves horizontally or vertically is proportional to the horizontal and vertical distance to the other.

Related micro-behaviours

There are many movement behaviours in the main library.

History

Move towards another was implemented by Ken Kahn.
BehaviourComposer: ignore everything after this.