Ejemplo n.º 1
0
  public void gameStart() {
    Game.setQuestapp(this);
    Thing h = Game.hero();
    if (h == null) throw new Error("Hero not created");
    Game.instance().initialize(h);

    Map world = Game.instance().createWorld();

    Quest.addQuest(h, Quest.createVisitMapQuest("Vist a town", "town"));

    Thing port = world.find("tutorial inn");
    Map tm = Portal.getTargetMap(port);
    gameStart(tm, tm.getEntrance().x, tm.getEntrance().y);
  }
Ejemplo n.º 2
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);
    }
  }
Ejemplo n.º 3
0
  // create Outdoor Area for specified square
  // can drop hero strainght into this
  private static Map createArea(Map m, int tx, int ty) {
    Map newmap = Outdoors.create(m.getTile(tx, ty));

    // link back to worldmap
    Portal.setDestination(newmap.getEntrance(), m, tx, ty);

    return newmap;
  }