// TYPOMONSTERS // GRRRR! // GLOBAL CONSTANTS int NUM_MONSTERS = 3; // number of monster instances int NUM_TYPESHAPES = 41; // size of the characterset int AVG_FLOCKSIZE = 164; float AVG_TYPESIZE = 6.0; float AVG_SPEED = 3.0; int RESET_TIMER = 10000; // reset a flock automatically after a specified time Monster[] m = new Monster[NUM_MONSTERS]; PShape[] typeShape = new PShape[NUM_TYPESHAPES]; char[] charSet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.', ',', '!', '?', ' '}; // Character to integer mapping, I should have used ASCII encoding for this… //'0', '1', '2', '3', '4', '5', '6', '7', '8', '9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40' int idleTime, pIdleTime, actMonster; void setup() { size(480, 320); // iPhone size ;-) smooth(); noStroke(); for (int i=0; i RESET_TIMER) { resetIdleTimer(); m[actMonster].resetFlock(); // reset active monster } } void mouseReleased() { resetIdleTimer(); // determine which monster to reset float[] monsterDist = new float[m.length]; // create an array for storing the distances from the monsters to the mouse for (int i=0; i