@Override public void actionPerformed(ActionEvent e) { SoundPlayer.getSoundPlayer().play(SoundPlayer.Track.BUTTON); // WHEN the back button recieves an actionEvent if (e.getActionCommand().equals("back")) { // IF Player one's character is set if (player2 != null) { // REMOVE Player one's selected character System.out.println("REMOVE Player 2"); player2 = null; fightButton.setEnabled(false); choosingPlayer.setSelected(true); // SET Player one to the player whose currently picking } // ELSE IF Player two's character is set else if (player1 != null) { // REMOVE Player two's selected character System.out.println("REMOVE Player 1"); choosingPlayer.setSelected(false); player1 = null; } // ELSE else { // Show ModeScreen System.out.println("GO BACK TO MODE"); backActionPerformed(); } } // ELSE fight button pressed else { // CALL startGame startGame(ai, tournamentMode, player1, player2); // System.out.println("FIGHT"); } }
private void backActionPerformed() { SoundPlayer.getSoundPlayer().play(SoundPlayer.Track.BUTTON); // IF 1 player game if (ai) { ((MainScreen) SwingUtilities.getRoot(this)).changeScreen("ModeScreen1"); } // ELSE 2 player game else { ((MainScreen) SwingUtilities.getRoot(this)).changeScreen("ModeScreen2"); } }