Esempio n. 1
0
  public Creature(Position pos, Map world) {

    setMoving(5);
    attacked = false;
    setTarget(null);
    setTile(world.tileAt(pos));
    getTile().setC(this);
    this.setPos(pos);
    this.world = world;

    setHp(DEF_HP);
    setMp(DEF_MP);
    setMaxhp(DEF_HP);
    setMaxmp(DEF_MP);
    setSpeed(DEF_SPEED);

    setActive(false);
    setDead(false);

    damageTaken = new Label("");
    damageTaken.setForeground(Color.red);

    healTaken = new Label("");
    healTaken.setForeground(Color.green);
  }
Esempio n. 2
0
 public void moveTo(Position target, Map world) {
   int diff = getPos().find_diff(target);
   setMoving(diff);
   if (world.isMovable(target.getX(), target.getY())) {
     setPos(target);
     tile.setC(null);
     tile = world.tileAt(target);
     tile.setC(this);
   } else {
     setMoving(Creature.no_move);
     setPath(null);
     setMoving(Creature.no_move);
   }
 }