Пример #1
0
  public void setTeam(Team team) {
    this.team = team;
    if (hasItem()) item.reset();
    resetLocation();

    // if (team!=null)
    // color=team.getColor();

  }
Пример #2
0
  public void move(double multiplier) {
    shootTime++;
    if (!alive) {
      if (deathWait) {
        deathWaitCount++;
        if (deathWaitCount > 50) {
          deathWait = false;
          if (hasItem()) item.reset();
          resetLocation();
        }

      } else {
        ghostCount++;
        if (ghostCount >= 100) alive = true;
      }
    }

    if (!deathWait) {
      double x = Math.cos(angle.getValue()) * speed * speedToggle * multiplier;
      double y = Math.sin(angle.getValue()) * speed * speedToggle * multiplier;
      for (Solid s : world.getSolids()) {
        boolean[] bools = s.collides(this);
        if (bools[0]) {
          if ((y > 0 && bools[1]) || (y < 0 && bools[2])) y = 0;
          if ((x > 0 && bools[3]) || (x < 0 && bools[4])) x = 0;
        }
      }

      // super.move(speed*multiplier*speedToggle);
      location.addX(x);
      location.addY(y);

      if (rotateToggle != 0) {
        if (Math.abs(rotateToggle) < maxRotateSpeed)
          rotate(rotateToggle); // go exact remainder of angle
        else rotate(rotateToggle * multiplier * maxRotateSpeed);
      }
    }
  }