public Vector2f getLevelBowPosition() { Rectangle shape = playerController.getPlayer().getShape(); float dx = -Sizes.BLOCK / 2; if (playerController.getPlayer().isLeftFaced()) { dx *= -1; } return new Vector2f(shape.getCenterX() + dx, shape.getCenterY() - Sizes.BLOCK / 2); }
public Vector2f getScreenBowPosition() { float dx = -Sizes.BLOCK / 2; if (playerController.getPlayer().isLeftFaced()) { dx *= -1; } return new Vector2f( pointOfView.getWindowWidth() / 2 + dx, pointOfView.getWindowHeight() / 2 - Sizes.BLOCK / 2); }
@Override protected void stopAction() { Vector2f pos = getLevelBowPosition(); Vector2f speed = controllerUtils.getCurrentDirection(SPEED, getScreenBowPosition()); projectileController.add( new Arrow( pos.getX(), pos.getY(), playerController.getPlayer(), speed.getX(), speed.getY())); soundController.play(bowSound, 0.7f); }