class Bully{ // Bully's are not too smart // Bully's behavior is dictated by moving towards the player who is closest to them int bullySize = 20; float bullySpeed = 3; int bullyNumber = 0; // trail PGraphics trail; // who they'll be chasing int nearest = int(random(0,numberOfPlayers-1)); // location and velocity float xPos, yPos; float[] v = new float[2]; // distances and angles to players float[] d = new float[numberOfPlayers]; float[] a = new float[numberOfPlayers]; // bully color int bullyR = 0; int bullyG = 0; int bullyB = 0; color bullyFeatures = color(180,180,180); // Constructor Bully(float x, float y, int s, float sp, int n) { xPos = x; yPos = y; bullySize = s; bullySpeed = sp; bullyNumber = n; //trail = createGraphics(myWidth, myHeight, P3D); } // SET methods void setVelocity(float velocX, float velocY){ v[0] = velocX*bullySpeed; v[1] = velocY*bullySpeed; //println("setting velocity: v[0]:" + v[0]+" v[1]:" + v[1]); } void setLocation(int x, int y){ xPos = x; yPos = y; } //-------------------------------------------- // check distances between all the players and store them void check_distances(){ float[] kidsx = new float[numberOfPlayers]; float[] kidsy = new float[numberOfPlayers]; // store the positions of each of the players for (int i = 0; i=numberOfPlayers-1){moreThanOnePlayer=false;} } if (moreThanOnePlayer){ // reset the nearest player at random boolean samePlayer=true; while (samePlayer){ // generate a new random player int newNearest = int(random(0,numberOfPlayers)); // if the new player is different from the last nearest and they're not beaten up if ((newNearest!=nearest)&&(!kids[newNearest].getBeatenUp())){ // break out of the look and set the new nearest player nearest = newNearest; samePlayer=false; } } } // if there's only one player still moving set them as the nearest if (numberOfPlayersBeatenUp==(numberOfPlayers-1)){ for (int i=0;i