Example #1
0
  /** renders the scene. */
  public void animate() {
    // always check this
    if (active) {
      if (graphics) {

      } else {
        if (attackerTurn) {
          if (frameCount > noGraphicDamagePoint)
            attacker.moveVisually(
                attacker.getX() + xDir * (.05 * (double) (frameCount - noGraphicFrames)),
                attacker.getY() + yDir * (.05 * (frameCount - noGraphicFrames)));
          else
            attacker.moveVisually(
                attacker.getX() - xDir * .05 * frameCount,
                attacker.getY() - yDir * .05 * frameCount);
        }

        if (defenderTurn) {
          if (frameCount > noGraphicDamagePoint)
            defender.moveVisually(
                defender.getX() - xDir * (.05 * (frameCount - noGraphicFrames)),
                defender.getY() - yDir * (.05 * (frameCount - noGraphicFrames)));
          else
            defender.moveVisually(
                defender.getX() + xDir * .05 * frameCount,
                defender.getY() + yDir * .05 * frameCount);
        }
      }
    }
  }
Example #2
0
  public void loadRecorces() {
    controlState = 2;
    // If fight with graphics
    if (graphics) {
      // TODO
    }

    // Otw, no graphics.
    else {
      xDir = attacker.getX() - defender.getX();
      yDir = attacker.getY() - defender.getY();
      if (xDir > 1) xDir = 1;
      if (xDir < -1) xDir = -1;
      if (yDir > 1) yDir = 1;
      if (yDir < -1) yDir = -1;
    }
  }