/** * Function to show the elimination if user confirm the gesture. * * @param gameBoard The game board. * @param index The index of the ball. */ public void userMovingEliminationHintAt(GameBoardInterface gameBoard, int index) { MyPoint center = gameBoard.ballLogicalPositionOfIndex(index); int interval = gameBoard.intervalBetweenTwoLayers() / 2 + 1; MyPolygon border = new MyPolygon(); MyColor color = new MyColor(255, 255, 255, 150); double dy = 0.577 * interval; border.addPoint(center.x - interval, (int) (center.y + dy)); border.addPoint(center.x, (int) (center.y + dy * 2)); border.addPoint(center.x + interval, (int) (center.y + dy)); border.addPoint(center.x + interval, (int) (center.y - dy)); border.addPoint(center.x, (int) (center.y - dy * 2)); border.addPoint(center.x - interval, (int) (center.y - dy)); FillEffect effect = new FillEffect(border, color); effectPainter.addEffect(effect); }
/** * Function to show that the user selected a ball. * * @param gameBoard The game board. * @param index The index of the ball. */ public void selectAt(GameBoardInterface gameBoard, int index) { MyPoint center = gameBoard.ballLogicalPositionOfIndex(index); int interval = gameBoard.intervalBetweenTwoLayers() / 2; MyPolygon border = new MyPolygon(); MyColor color = new MyColor(255, 0, 0, 150); double dy = 0.577 * interval; border.addPoint(center.x - interval, (int) (center.y + dy)); border.addPoint(center.x, (int) (center.y + dy * 2)); border.addPoint(center.x + interval, (int) (center.y + dy)); border.addPoint(center.x + interval, (int) (center.y - dy)); border.addPoint(center.x, (int) (center.y - dy * 2)); border.addPoint(center.x - interval, (int) (center.y - dy)); BorderEffect effect = new BorderEffect(border, color, 5); effectPainter.addEffect(effect); }