Adjust the sliders. The top three correspond to the forces: separation, alignment, and cohesion. Target speed controls what speed each boid moves at. Boid view distance controls how far away each boid can detect other boids, leading to different flock sizes. Finally, scene controls what obstacles they face. @SpinningCube
Another quick project I made. This one is a demonstration of a technique by Craig Reynolds to simulate the grouping of animals, such as a flock of birds, or a school of fish for example. A "boid" is one of the creatures inside the flock. It can see all boids within a radius of itself. I didn't actually read about the exact details about how it was implemented, so my code may do things a bit differently. In this technique, he proposed three behaviors of a boid, which have been named Separation, Alignment, and Cohesion: Separation: avoid colliding with nearby boids. Alignment: attempt to match the velocity of nearby boids. Cohesion: steer towards the average position of nearby boids. These behaviors, or "forces" aren't applied one at at a time, they are applied together, with adjustable magnitudes, meaning the boid will move in a direction determined by a mix of the directions outputted from each force. On top of those behaviors, I regulate the speed of each boid, so the simulation doesn't slow down or speed up over time. I have also added obstacle avoidance, which allows the boids to explore different stages without flying through everything. For it to work, each boid has 3 sensors, defined by costumes. Each sensor corresponds to a certain direction (forward, left, right). The costumes are very slightly asymmetrical, but it shouldn't make any noticeable difference. This doesn't work perfectly all the time, though, so sometimes you'll see a boid force itself through a wall. All of this is done with vector math. You can read more about boids here: http://www.red3d.com/cwr/boids/ It was brought to my attention that this project can often divide 0 by 0, and relies on how Scratch works to not completely break, so that's fun.