Ejemplo n.º 1
0
  // enter a world map square
  //  - if there is a portal to a special location then use it
  //  - else create the appropraite outdoor area map
  //
  public static void exitWorldMap(Map m, int tx, int ty) {
    Thing h = Game.hero();

    // record movement time
    Time.logTime(Movement.moveCost(m, h, tx, ty));

    Thing p = m.getFlaggedObject(tx, ty, "IsPortal");
    if (p != null) {
      Portal.travel(p, h);
    } else {
      // put hero into a local area map
      Map nm = WorldMap.createArea(m, tx, ty);

      // phantom Portal
      p = Portal.create();
      Thing t = nm.getEntrance();
      Portal.setDestination(p, nm, t.x, t.y);

      // could build a portal here so we can return to exact location map
      // Don't think we really want this though
      //   addThing(p,tx,ty);

      Portal.travel(p, h);
    }
  }