Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. Drew Isaacson
  2. 11/15/18
  3.  
  4. For the Checkers GUI program, we are going to add on to our text-based game by replacing all of the text inputs with mouse listeners that read the pixel locations of where a user clicks. We will also have an array of pixel dimensions that represent each of the 64 pieces on the board. When the user clicks somewhere on the board, we will match the pixel locations from this listener with this array to get the correct input for the already existing move methods. The array will be stored in the CheckersGUI class, which will also be responsible for displaying the frame. The class will include two more 2-dimensional arrays, which hold 64 JLabels which represent the pieces of the board. One of the arrays will hold a black pawn piece at every location a black piece can go, and a red pawn piece at every other index. The other will do the same thing, but for king pieces. This way, we can use the setVisible() method of the JLabel to determine which pieces show up where in the GUI. To make sure the image of the board does not show up in front of the checkers pieces, we are using one JLayeredPane to order the labels correctly. To replace the user entering whether they would like a piece to move left or right, we will be adding images of a left arrow and right arrow below the board, using the pixel locations of the mouse click to see what the user chose. When we prompt the user to jump again and show the winner of the game, we will display a JOptionPane with the information, which will show up in front of the game. The rest of the information will show up in text labels on the sides of the checkers board, such as the turn number and how many red and black pieces are left.
  5. The components we need to split up are working on the GUI itself, and rewriting the driver to work with the new GUI. I will be working on building up the GUI components and making sure the methods are easy for the driver to invoke. Mason will be working on rewriting the driver to use the new GUI, reading the mouse clicks, and changing the pieces of the board to make it look like the checkers board as it stands.
  6. Having an already working checkers game helps us out because we can keep the move methods as well as the Board, Tile, and Piece classes in our new game without having to change them. Since the game already works correctly, all we need to do is convert the inputs and outputs from text to GUI.
  7. Problems we will face are making the GUI easy to use and getting exact pixel locations for the assets on the board.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement