I’ve uploaded the Boid source code. Sorry for the delay. I’ve also included some basic examples of how you can create nice behaviors using the Boid class. If you set Main.as as your document class then you’ll see that within that you can specify the demo to run when you compile.
The basic demos included are:
- Chase – Boids chase each other
- Flock – Boids flock together with some wander
- Graphics – How to use custom graphics with a Boid instance
- Seek – Boids seek the mouse position
- Wander – You guessed it, they wander
I’ve commented all of the methods and properties and there is also documentation (open index.html in the docs folder) to get you started. Before you mention it, yes, there is some redundant code ;) (such as the constrainToRect method which doesn’t really work) but I need to do some optimisations anyway so I just left it as is for now, rough and ready.
Download: AS3 Boid Class & Demos Read : Flipping you the Boid »


