Example #1
0
  @Override
  public void onMoved(MovedEvent event) {
    Point2D point = parent.getBoardSvg().calculatePosition(robber.getLocation());

    Point2D headLocation = getHeadLocation(point);
    Point2D bodyLocation = getBodyLocation(point);

    head.setX(headLocation.getX());
    head.setY(headLocation.getY());
    body.setX(bodyLocation.getX());
    body.setY(bodyLocation.getY());
  }
Example #2
0
  public RobberSvg(GameBoardSvg parent, Robber robber) {
    super(robber);
    this.parent = parent;

    int headRadius = (int) (parent.getBoardSvg().getHexagonWidth() / 8);
    int bodyRadius = (int) (parent.getBoardSvg().getHexagonWidth() / 6);

    Point2D point = parent.getBoardSvg().calculatePosition(robber.getLocation());

    Point2D headLocation = getHeadLocation(point);
    Point2D bodyLocation = getBodyLocation(point);

    head = new Circle(headLocation.getX(), headLocation.getY(), headRadius);
    head.setFillColor("Black");
    head.setStrokeColor("White");
    body = new Circle(bodyLocation.getX(), bodyLocation.getY(), bodyRadius);
    body.setFillColor("Black");
    body.setStrokeColor("White");
    group = new Group();
    group.add(body);
    group.add(head);
    robber.addMoveEventHandler(this);
  }