package lilWorld; import java.util.ArrayList; import java.util.List; import processing.core.PApplet; import processing.core.PVector; public class CreeperSystem { Creeper temp; Creeper c; ListallCreepers; PApplet parent; int creatureNo; int G = 10; int size1; int size2; float crPlus = 0; float forceVal = 10; CreeperSystem(PApplet p, int n, int s1, int s2) { allCreepers = new ArrayList(); parent= p; creatureNo = n; size1 = s1; size2 = s2; for(int i = 0;i < creatureNo; i++) { PVector a = new PVector(0.0f,0.0f); PVector v = new PVector(parent.random(-3,3),parent.random(-3,3)); //PVector l = new PVector(parent.random(parent.width),parent.random((parent.height)-(parent.height/8)), parent.height); PVector l = new PVector(parent.random(parent.width),parent.random(600, parent.height/3)); System.out.println(l.y); System.out.println((parent.height)-(parent.height/8)); Creeper creep = new Creeper(l, a, v, (int)parent.random(size1,size2), parent); System.out.println("new creature here " + i); creep.graphicsNum = (int) parent.random(3); //System.out.println(creep.graphicsNum + "THIS IS THE NUMBER"); allCreepers.add(creep); } } public void pushCreepers() { for (int i = 0; i < allCreepers.size(); i++) { c = allCreepers.get(i); // pick a creeper //System.out.println(c.getClass().toString()); for(int j = 0; j magnitude * direction temp.applyForce(dir); temp.changeColor(); c.changeColor(); c.startTime(500); temp.startTime(500); } } } } } } public void moveCreepers() { for(int i = 0;i < allCreepers.size(); i++) { temp = allCreepers.get(i); temp.move(); } } public void showCreepers() { for(int i = 0;i < allCreepers.size(); i++) { //System.out.println("HERE"); temp = allCreepers.get(i); temp.show(); } } public void meetReaper() { for (int i = 0; i < allCreepers.size(); i++) { c = allCreepers.get(i); // pick a drifter if(c.lifespan.isFinished()) { //System.out.println("DIE"); allCreepers.remove(i); } //System.out.println("still alive!"); } } public Boolean checkProx(Creature a, Creature c) { float aR; aR = a.getSize()/2; // get radius temp float cR = c.getSize()/2; //get radius c //cr+= crPlus; float tempR = cR + aR; //System.out.println("against " + tempR); if (PApplet.dist(c.loc.x, c.loc.y,a.loc.x, a.loc.y)<= tempR) { //System.out.println("NEAR!!!!!!"); return true; //they are near each other } else { //System.out.println("not near!"); return false; //they are not near each other } } void makeBabies(PVector location) { int numberOfBabies = (int) parent.random(1, Vars.creeperBabies); System.out.println(numberOfBabies+"creeper babies!"); for(int i = 0; i