Extending particle systems, we can make flocking systems where we add behavior to the particles themselves, and not just make the particles follow the mouse, keyboard or other external inputs. The particles have a life of their own and here they flock towards a center of gravity or repel away. I made a modification of this with color, images and adding a creative meaning to how we look at this.

  • Defining the particle system header and action code files.
  • Adding the flocking behavior to the particles
  • Creating a class of particles and instantiating them into objects, and adding vectors of motion to each object, within the class, with the flocking behavior.
  • Adding the center of flocking and repulsive behaviors.
  • Adding image and mouse manipulations.
  • The mouse click changes particle behavior and the behavior┬ácontroller.

Code on GitHub