public class Lightning { public boolean alive; int thickness = 7; int numDivides = 20; int lightCount = 0; int x, y; public Lightning(boolean a){ alive = a; } public void lightSetup(){ alive=false; numDivides = (int)(Math.random()*10)+10; lightCount=0; } public void lightDraw(){ noStroke(); fill(255,255,0); if(alive && lightCount < 30){ if (x < 100) numDivides = (int)(Math.random()*4)+1; else { numDivides = (int)(Math.random()*10)+10; } drawBolt(); lightCount++; } else { this.alive = false; lightCount = 0; } } public void getLoc(){ noStroke(); int numP = checkPencilAlive(); if(numP < 1) { getNewPencil(); } else { int numS = checkSlammersAlive(); if(numS < 1) { getNewSlammer(); } else { if(numS < numP && numS < maxSlammers){ cloneSlammer(); } else { if(numP < maxNumBs) clonePencil(); else { strikeTheBlobs(); } } } } } void strikeTheBlobs(){ int blobNum = getABlob(); this.x = (int)(sys.b[blobNum].x); this.y = (int)(sys.b[blobNum].y); this.alive = true; multiplyTheBlobs(blobNum); } void getNewPencil(){ x=(int)(Math.random()*(width/3)+200); y=(int)(Math.random()*(height-100)+20); alive = true; for(int i=0;i 0) { slammer[i].bringtolife(i-1, slammer[i-1].x, slammer[i-1].y); this.x = (int)(slammer[i-1].x); this.y = (int)(slammer[i-1].y); } else { for(int j=0; j 0) { pencil[i].bringtolife(i-1, pencil[i-1].x, pencil[i-1].y); this.x = (int)(pencil[i-1].x); this.y = (int)(pencil[i-1].y); } else { for(int j=0; j