Beispiel #1
0
  public void run(ArrayList<Creature> creatures) {
    loc = bodyCopy.loc;
    vel = bodyCopy.vel;
    acc = bodyCopy.acc;

    decision.setMove(true);
    decision.setMoveTogheterNeigh(true);

    bodyCopy.addNearCreatures(creatures);
    bodyCopy.removeNearCreatures();
    bodyCopy.addNeighbord(creatures);
    bodyCopy.removeNeighbord();

    setNearCreatures(bodyCopy);
    setNeighbords(bodyCopy);
    setArrayNearDecisions();
    setArrayNeighbordsDecisions();

    action();

    /*
     * bodyCopy.run(creatures);
     *
     * beHunted(creatures); if (isPredator && hungry < 3) { isHunting =
     * true; } else { isHunting = false; } //
     * println(relativeness(creatures,4));
     */
  }
Beispiel #2
0
  // se outro é predator
  public void beHunted(ArrayList<Creature> creatures) {
    for (Creature other : creatures) {
      float d = PVector.dist(loc, other.loc);

      if (((d > 0) && (d < 40)) && (other.isPredator == true && isPredator == false)) {
        if (other.isHunting) {
          fight(other);
          bodyCopy.fleeFromEnemy(other);
        }
      }
    }
  }
Beispiel #3
0
 public void stop() {
   if (decision.isMoving() == false) {
     bodyCopy.stop();
   }
 }
Beispiel #4
0
 public void walkTogheterNeigh(ArrayList<Creature> creatures) {
   if (decision.isMovingTogheterNeigh()) {
     bodyCopy.flock(creatures);
   }
 }
Beispiel #5
0
 // THE ACTIONS
 public void walkAlone() {
   if (decision.isMoving()) {
     bodyCopy.move();
   }
 }
Beispiel #6
0
 public void setNearCreatures(Body b) {
   nearCreatures = b.getNearCreatures();
 }
Beispiel #7
0
 // ///////////////////////////
 // neigh
 public void setNeighbords(Body b) {
   neighbords = b.getNeighbords();
 }