Пример #1
0
 @Override
 public void keyReleased(KeyEvent arg0) {
   input.set(arg0.getKeyCode(), false);
 }
Пример #2
0
  private void handleInput() {
    if (input.clicked(0)) leftMouseClick(input.getX(), input.getY());
    else if (input.clicked(2)) rightMouseClick(input.getX(), input.getY());

    if (input.createdBox()) {
      ArrayList<GameSprite> boxedSprites = level.getSpritesAt(input.getDragBox());
      ArrayList<GameSprite> boxedFriendly = new ArrayList<GameSprite>();
      for (GameSprite sprite : boxedSprites) {
        if (sprite.onTeam(playerTeam)) boxedFriendly.add(sprite);
      }
      if (!boxedFriendly.isEmpty()) {
        selected = boxedFriendly;
      }
    }

    if (input.keyDown(KeyEvent.VK_A)) attackMoveClicked = true;
    if (input.keyDown(KeyEvent.VK_S)) stopSelected();

    if (input.keyDown(KeyEvent.VK_LEFT)) scrollLeft();
    if (input.keyDown(KeyEvent.VK_RIGHT)) scrollRight();
    if (input.keyDown(KeyEvent.VK_UP)) scrollUp();
    if (input.keyDown(KeyEvent.VK_DOWN)) scrollDown();
  }
Пример #3
0
 @Override
 public void keyPressed(KeyEvent e) {
   input.set(e.getKeyCode(), true);
 }
Пример #4
0
 private boolean shiftDown() {
   return (input.keyDown(KeyEvent.VK_SHIFT));
 }