As3SteeringBehavior is a library that provides several steering behaviors algorithms to be used in games. Following the reference of Craig Reynolds, creator of the algorithms, the library has nine behaviors available as interfaces: arrive, avoid, evade, flee, follow path, flock, pursue, seek and wander. Additionally there are some useful classes to help during development, such as Vehicle and Vector2D.

The behaviors can be used out of the box if the SteeringVehicle is instantiated. It describes an entity able to perform steering behaviors, such as a car of an enemy. In order to make the instantiated object perform a behavior, a developer must invoke the corresponding method, such as seek(), every game update. It’s also necessary to invoke the update() method to tell the library to process the behaviors.


public class FleeTest extends Sprite {
  private var _vehicle:SteeredVehicle;

  public function FleeTest() {
    _vehicle = new SteeredVehicle();
    _vehicle.position = new Vector2D(200, 200);
    _vehicle.edgeBehavior = Vehicle.BOUNCE;

    addEventListener(Event.ENTER_FRAME, onEnterFrame);

  private function onEnterFrame(event:Event):void { Vector2D(mouseX, mouseY));