package start10_1_BlocksMania; import prep.yoderbest.GameBoard; import javax.swing.*; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * Class that manages the GUI for Barnyard Simon. *
Barnyard Simon is a game similar to the electronic Simon memory game * marketed by the Milton Bradley Company. *
The game has four colored buttons (red, green, blue, and yellow). The * buttons are activated in a randomly chosen sequence. The player must then * mimic the sequence in order to continue playing the game. The sequence begins * with just one button and increases in length by one each time the player * successfully mimics the sequence. *
Traditionally, the activation of each button results in the button being * lit and a tone (unique for each button) being played for a short amount of time. * Barnyard Simon differs in that the sounds associated with each button are * barnyard animal sounds. * @author FIX * @version 2010-01-10 * @created 15-Jan-2014 6:47:12 PM */ public class BlocksMania extends JFrame { private prep.yoderbest.GameBoard board; private final JPanel boardSpot; public static void main(String[] args){ new BlocksMania(); } /** * This class listens solely for game play buttons to be pressed. Once pressed, * this class determines which button was pressed and then advances game play * appropriately. * @author FIX * @version 2010-01-10 * @created 15-Jan-2014 6:47:12 PM */ public class HandleGameButton implements ActionListener { /** * Handles an action event caused by one of the four colored buttons in Barnyard * Simon. *
The method first determines if the correct button was pressed. *
If not, the game has ended and the method must ensure that the high score * is updated (if necessary) and resets the label on the start button and enables * it. *
If the correct button is pressed, then the button is activated and the * current count of how many buttons in the sequence the player has pressed * correctly must be incremented. If the player has pressed all of the buttons in * the sequence correctly, the method must ensure that the sequence with one * additional entry be played. * * @param event */ @Override public void actionPerformed(ActionEvent event){ } } /** * This class listens solely to the start button component of the GUI. * @author FIX * @version 2010-01-10 * @created 15-Jan-2014 6:47:12 PM */ public class StartGame implements ActionListener { /** * Initializes and starts a game of Barnyard Simon. *
This method disables the start button and sets the text to "Playing." It
* also creates a new sequence and calls playSequence to initiate game play.
*
* @param event
*/
@Override
public void actionPerformed(ActionEvent event){
}
}
/**
* GUI Component used to initiate a new game.
*/
private JButton btnStart;
/**
* The buttons used for game play.
*/
private prep.yoderbest.Tile buttons[];
/**
* The player's current location in the sequence.
*/
private int countCorrect;
/**
* Height of the window
*/
private static final int HEIGHT = 600;
/**
* Width of the window
*/
private static final int WIDTH = 600;
/**
* Highest score obtained during this running of the program.
*/
private int highScore = 0;
/**
* A random number generator used to select the sequence in which the buttons are
* activated.
*/
private Random rGen;
/**
* Text area used to report the score and high score.
*/
private JTextArea scoreReport;
/**
* The sequence in which the buttons are activated.
*/
private List