예제 #1
0
 /**
  * adds a fat.
  *
  * @param value fat's value.
  * @param big fat's size.
  */
 public void addFat(int value, boolean big) {
   Entity inFront = getBodyParts().get(getBodyParts().size() - 1);
   Fat temp = new Fat(value, big);
   temp.setFrontX(inFront.getRearX());
   temp.setY(inFront.getYFromCenterToRear(FAT_DISTANCE + NECK_RADIUS));
   addBodyPart(temp);
 }
예제 #2
0
  @Override
  public int addValue(int value) {
    for (Entity e : getBodyParts()) value = e.addValue(value);

    if (value > 0) {
      value -= 50;
      Vector<Entity> fats = getBodyParts();
      Entity last = fats.get(fats.size() - 1);
      if (fats.size() < MAX_FATS) {
        Fat fat = new Fat();
        fat.setAngle(last.getAngle());
        fat.setFrontX(last.getRearX());
        fat.setY(last.getYFromCenterToRear(FAT_DISTANCE + NECK_RADIUS));
        fat.setMaxVelocity(0);
        addBodyPart(fat);
      } else
        for (int i = 0; i < fats.size(); ++i)
          if (!((Fat) fats.get(i)).getBig()) {
            ((Fat) fats.get(i)).setBig(true);
            break;
          }

      for (int i = 0; i < fats.size(); ++i)
        fats.get(i).setValue(((Fat) fats.get(i)).getBig() ? 50 : 0);
    }
    if (value > 0) spawnExcrement(value);

    return 0;
  }
예제 #3
0
  public EelEntity(int x, int y) {
    this();

    setX(x);
    setY(y);

    Entity inFront = this;
    Entity temp;
    for (int i = 0; i < getBodyParts().size(); i++) {
      temp = getBodyParts().get(i);
      temp.setAngle(inFront.getAngle());
      temp.setFrontX(inFront.getRearX());
      temp.setY(inFront.getYFromCenterToRear(FAT_DISTANCE + NECK_RADIUS));
      temp.setMaxVelocity(0);
      inFront = temp;
    }

    setTurningSpeed(getTurningSpeed() * 1.5);
    setValue(getValue());
  }