Examples of BlockadeBoard


Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

     * @param direction to move one space (one of EAST, WEST, NORTH, SOUTH).
     * @return the accumulated list of walls.
     */
    BlockadeWallList checkAddWallsForDirection(BlockadeBoardPosition pos, PathList paths,
                                                         Direction direction) {
        BlockadeBoard b = board;
        BlockadeWallList wallsToCheck = new BlockadeWallList();
        BlockadeBoardPosition westPos = pos.getNeighbor(Direction.WEST, b);
        BlockadeBoardPosition eastPos = pos.getNeighbor(Direction.EAST, b);
        BlockadeBoardPosition northPos = pos.getNeighbor(Direction.NORTH, b);
        BlockadeBoardPosition southPos = pos.getNeighbor(Direction.SOUTH, b);
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

        WallAccumulator accumulator = new WallAccumulator(board_);

        // 12 cases
        int fromRow = move.getFromRow();
        int fromCol = move.getFromCol();
        BlockadeBoard b = board_;
        BlockadeBoardPosition origPos = board_.getPosition(fromRow, fromCol);
        BlockadeBoardPosition westPos = origPos.getNeighbor(Direction.WEST, b);
        BlockadeBoardPosition eastPos = origPos.getNeighbor(Direction.EAST, b);
        BlockadeBoardPosition northPos = origPos.getNeighbor(Direction.NORTH, b);
        BlockadeBoardPosition southPos = origPos.getNeighbor(Direction.SOUTH, b);
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

    {
        BlockadeBoardViewer viewer = (BlockadeBoardViewer) viewer_;
        if (wallPlacingMode)  {

            // show the hovering wall
            BlockadeBoard board = (BlockadeBoard)viewer.getBoard();
            // now show it in the new location
            Location loc = getRenderer().createLocation(e);
            if (board.getPosition(loc)==null) {
                return// out of bounds
            }

            BlockadeBoardPosition[] positions =
                    wallPlacer.getCellLocations(e.getX(),  e.getY(), loc, getRenderer().getCellSize());
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

        if ( getRenderer().getDraggedPiece() == null )   {
            return false; // nothing being dragged
        }

        BlockadeController controller = (BlockadeController)viewer_.getController();
        BlockadeBoard board = (BlockadeBoard) controller.getBoard();
        // get the original position.
        BlockadeBoardPosition position =
                board.getPosition(getRenderer().getDraggedPiece().getLocation());

        // valid or not, don't show the dragged piece after releasing the mouse.
        getRenderer().setDraggedPiece(null);

        BlockadeMove m = checkAndGetValidMove(position, loc);
        if (m == null) {
            return false;
        }

        // make sure that the piece shows while we decide where to place the wall.
        currentMove = m;
        GameContext.log(1, "legal human move :" + m.toString());
        position.getPiece().setTransparency((short) 0);
        boolean isPlayer1 = position.getPiece().isOwnedByPlayer1();
        BlockadeBoardPosition newPosition =
                board.getPosition(currentMove.getToRow(), currentMove.getToCol());
        newPosition.setPiece(position.getPiece());
        position.setPiece(null);
        viewer_.refresh();

        if (newPosition.isHomeBase( !isPlayer1 )) {
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

     * @param placedLocation location dragged to.
     * @return the valid move else and error is shown and null is returned.
     */
    private BlockadeMove checkAndGetValidMove(BlockadeBoardPosition origPosition, Location placedLocation) {
        BlockadeController controller = (BlockadeController)viewer_.getController();
        BlockadeBoard board = (BlockadeBoard) controller.getBoard();
        List<BlockadeMove> possibleMoveList = controller.getPossibleMoveList(origPosition);

        BlockadeBoardPosition destpos = board.getPosition( placedLocation );
        if (customCheckFails(destpos)) {
            JOptionPane.showMessageDialog( viewer_, GameContext.getLabel("ILLEGAL_MOVE"));
            return null;
        }
        // verify that the move is valid before allowing it to be made.
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

        BlockadeWall draggedWall = bbRenderer.getDraggedWall();
        if (draggedWall == null)
            return false;

        // first check to see if its a legal placement
        BlockadeBoard board = (BlockadeBoard)viewer_.getBoard();

        // check wall intersection and overlaps.
        //assert(draggedWall_ != null);
        String sError = board.checkLegalWallPlacement(draggedWall, loc);

        if (sError != null) {
            JOptionPane.showMessageDialog( viewer_, sError);
            bbRenderer.setDraggedWall(null);
            return false;
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

        initializeData();
    }

    @Override
    protected BlockadeBoard createBoard() {
        return new BlockadeBoard(NUM_ROWS, NUM_COLS);
    }
View Full Code Here

Examples of com.barrybecker4.game.twoplayer.blockade.board.BlockadeBoard

    @Override
    protected void drawBackground( Graphics g, Board b, int startPos, int rightEdgePos, int bottomEdgePos,
                                   int panelWidth, int panelHeight) {
        super.drawBackground(g, b, startPos, rightEdgePos, bottomEdgePos, panelWidth, panelHeight);

        BlockadeBoard bb = (BlockadeBoard)b;
        drawHomeBases(g, bb, true);
        drawHomeBases(g, bb, false);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.