/* War Paint 2 blprnt@blprnt.com April, 2005 Armies of pigment soldiers travel across the battlefield. When they meet, battle erupts, in a flash of colour. */ //Number of soldiers int count = 10000; //Initialize some variables float leaderx, leadery; int templeader; color col; //Width and height of the battlefield int w = 600; int h = 600; //Array of soldiers (wanderers) Wanderer[] wanderers = new Wanderer[count]; //Pixel array int[] grid = new int[w * h]; void setup() { //Set all pixels as empty (no soldiers) for (int i=0; i< grid.length; i++) { grid[i] = -1; }; //Get the colour pallette from an image. This script is from Jared Tarbell (complexification.net). takecolor("explosion.gif"); //Set the environment smooth(); background(250); size(w , h); templeader = 0; col = somecolor(); //The first wanderer is automatically a leader wanderers[0] = new Wanderer(int(random(width)),int(random(height)),true,0,col,0); for (int i = 1; i 99.5) { col = somecolor(); templeader = i; //leaders are placed randomly on stage. wanderers[i] = new Wanderer(int(random(width)),int(random(height)),true,templeader,col,i); } else { //followers are placed within 20 pixels of the leader. wanderers[i] = new Wanderer(int(wanderers[templeader].x + random(-20,20)),int(wanderers[templeader].y + random(-20,20)),false,templeader,col,i); }; }; leaderx = wanderers[0].x; leadery = wanderers[0].y; }; void draw() { //Draw all non-dead wanderers to the screen. for (int i = 0; i