@Override public void keyReleased(KeyEvent arg0) { input.set(arg0.getKeyCode(), false); }
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(); }
@Override public void keyPressed(KeyEvent e) { input.set(e.getKeyCode(), true); }
private boolean shiftDown() { return (input.keyDown(KeyEvent.VK_SHIFT)); }