Following and Running Away

How do I get an agent to chase another agent?


There are two ways to make one agent follow or run away from another.
The first way uses either a global or an agent variable to keep track of someone to follow.

The second way is to pick an agent out of those nearby and move towards them in the same turn. The next turn, they may pick a different agent to follow.

To make an agent run away instead of follow, they only need to turn 180˚ after finding who they want to run away from.

Submitted by talaya on 20. February 2008 - 10:57