Пример #1
0
  private void Talk(Entity e) {

    TalkPrompt t = null;
    try {
      t = new TalkPrompt(Formulas.MIDPROMPT, e.getTalkstate(), hg, e);
    } catch (SlickException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
    gs.setPrompt(t);
  }
Пример #2
0
  public void keyPressed(int key, char c) {

    if (gs.activePrompt != null) {
      gs.activePrompt.keyPressed(key, c);
      return;
    }

    if (key == ENTER_KEY) {

      Player tmp = hg.ge.pl;
      Map m = tmp.getMap();
      int x = tmp.getX();
      int y = tmp.getY();

      m.Enter(x, y, tmp);
    }

    if (key == SHOOT_KEY) {
      hg.targetctrl.initTargetting(new LineTargetter(hg));
    }
    if (key == SKILL_KEY && !hg.in.isKeyDown(Input.KEY_LSHIFT)) {
      gs.statechange = HellbentGame.SKILLSTATE;
      gs.moving = 0;
    }

    if (key == TALK_KEY) {
      initTalk();
    }

    if (key == PICKUP_KEY) {

      Player tmp = hg.ge.pl;
      Map m = tmp.getMap();
      Vector<Item> items = Utilities.getItemsAtCoord(m, tmp.getX(), tmp.getY());
      if (items.size() > 0) {
        tmp.setAction(new Pickup(tmp, items.get(0)));
        ((GameplayState) (gs)).inputACTION = 1;

      } else {
        tmp.addMessage("There is nothing here to pick up!");
      }
    }

    if (key == INVENTORY_KEY) {
      gs.statechange = HellbentGame.INVENTORYSTATE;
      gs.moving = 0;
    }

    if (key == SAVE_KEY) {
      if (hg.in.isKeyDown(Input.KEY_LSHIFT)) {
        try {
          gs.moving = 0;

          hg.svg.saveGame("saves/" + hg.ge.pl.getName() + ".svg");
          hg.ge.pl.addMessage("Game saved.");
        } catch (IOException e) {
          // TODO Auto-generated catch block
          System.out.println("DUPA");
        }
      }
    }

    if (key == N_1) {
      gs.moveflag = 1;
      gs.moving++;
    }
    if (key == N_2) {
      gs.moveflag = 2;
      gs.moving++;
    }
    if (key == N_3) {
      gs.moveflag = 3;
      gs.moving++;
    }
    if (key == N_4) {
      gs.moveflag = 4;
      gs.moving++;
    }
    if (key == N_5) {
      gs.moveflag = 5;
      gs.moving++;
    }
    if (key == N_6) {
      gs.moveflag = 6;
      gs.moving++;
    }
    if (key == N_7) {
      gs.moveflag = 7;
      gs.moving++;
    }
    if (key == N_8) {
      gs.moveflag = 8;
      gs.moving++;
    }
    if (key == N_9) {
      gs.moveflag = 9;
      gs.moving++;
    }

    {
    }
  }