Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please use \"JAVAFX \" (not java templete) Building on your Battle monsters game

ID: 3837959 • Letter: P

Question

please use "JAVAFX " (not java templete)

Building on your Battle monsters game.

You are going to turn it into a graphic design.

Hydrons are all triangles; they all start with base and height of 25. They will all be displayed.

Zexors are all squares; they all start with a length / width of 25. They will all be displayed.

Your application must give the user a way to set the color of each Hydron and Zexor using a Node.

You may not use a text-based node – the choosing must be done in some graphic way.

Display – Hydrons on one side of the screen, Zexors on the other (or top & bottom). Each one is labeled with its name. As a monster’s health decreases, so does their size. So a Zexor with health of 90% would have a size of 22.5 and be displayed as such.

Battling Hydrons & Zexors will battle in the center of the screen. Unlike the previous version, each battle lasts 3 rounds. At the end of each round, the size of the monsters is adjusted appropriately.

A textArea should show the “narrative” of the battle (Hydron Fred attackswith a throw of 7, Zexor Sally defends with a throw of 9. Zexor Sally wins this round. Hydron fred attacks with a throw of 9 Zexor Sally defends with a throw of 3. Hydron fred wins this round. Hydron Fred attacks with a throw of 6. Zexor Sally defends with a throw of 2. Hydron Fred wins this round. Final Result: Hydron Fred 7 / 9 / 6, Zexor Sally 9 / 3 / 2. Overall winner: Hydron fred.

_____________________________________________

Changes in game play:

The computer randomly picks the number of sides for the dice for each ROUND (4, 6, 8, 10, 12, or 20) and the number of dice rolled for each ROUND (1, 2, 3, or 4). The score is determined by adding the points on each die. (For example, 3 rolls of 10 sided dice might yield 8, 5, 2 or a total of 15.

Scoring: The two rolls are subtracted from each other and the result is subtracted from the loser’s health. In the example above, Round 1, Fred loses 2 points, Round 2 Sally loses 2 points, Round 3, Sally loses 4 points.

In each battle:

The first monster chosen is the attacker
The second monster chosen is the defender

Your program must have:

A JavaFX class that extends Application

Abstract base class Monster and two subclasses: both Zexor and Hydron extend Monster.

A Dice class

GUI Interface to build Hydrons & Zexors with the ability to alter and change the setup. Color of the

Hydron and the Zexor must use color objects (not TEXT!) and a second one for the game play

The following Interfaces: Serializable, Comparable

A class that throws an exception, and another that has a try/catch/finally block that uses that

exception

a Menu that at minimum allows the user to save a *BINARY* file and open an existing file that stores

the status of the Hydrons and Zexors (all info incl. current health and game score)

File Mark Nista Roll: 7, 2,4 Roll: 3, 2, 7 Fred Sally Miguel Samo Hydron Fred battles Zexor Sally...Hydron Fred wins this round with 13 points to Zexor Sally's 12. Zexor Sally loses 1 point.

Explanation / Answer

I have developed the Battle monsters game. program using JAVAFX by extending the application to the JavaFX class. I have included the comments for each part of the code and the final output of the method description.

Let me explain you in more simpler step-by-step procedure:-

Step-1:

The Initial step is to initialize the JavaFX programs with the help of the Application class, Which is directly referenced and call the JavaFX all applications. We need to import the Application in the header part.

Example:- import javafx.application.Application;

Step-2:

The next step is to call the launch operation in the main() method as the starting point of the battle monster game for running the application features.

Example:- launch(args);

Step-3:

The final step is to call the start() method for staring up an application and wait for the operations to get finished and it will call the stop() method when there is no response from the user end.

Example:- public void start(Stage battleStage)

Program Layout:-

import javafx.application.Application;

import javafx.stage.Stage;

public class JavaFX extends Application

{

    public static void main(String[] args)

    {

       Application.launch(args);

    }

public void start(Stage battleStage)

    {

        battleStage.setTitle("The Battle Monsters game");

        battleStage.show()

    }

}

The next step is to build a GUI Interface for both Hydrons & Zexors.

Program for JavaFX Battle Monster Creation:-

// This class "javafx" is used to extends the Application file class

public class JavaFX {
  
   // The main() method starting point of the java program
  
public static void main(String[] args) {
new Thread() {
          
           // It overrides the run method with the existing arguments
          
@Override
public void run() {
javafx.application.Application.launch(battleMonsterTest.class);
}
}.start();
      
       // Created a battleJavaFxTest object for binding the value to the output
      
battleMonsterTest battleJavaFxTest = battleMonsterTest.waitForStartUpTest();
battleJavaFxTest.printSomething();
}
}

Program for JavaFX Extends Application Class:-


// This is the header files in Java for embedding the methods and properties of each class

import javafx.application.Application;
import javafx.battleScenes.Scene;
import javafx.battleScenes.layout.BorderPane;
import javafx.battleStage.Stage;
import java.util.concurrent.CountDownLatch;
import javafx.battleScenes.control.Label;

// This class "battleMonsterTest" is used to extends the Application file class

public class battleMonsterTest extends Application {
public static final CountDownLatch battleWatchTime = new CountDownLatch(1);
public static battleMonsterTest battleJavaFxTest = null;

public static battleMonsterTest waitForStartUpTest() {
try {
battleWatchTime.await();
} catch (InterruptedException ex) {
ex.printStackTrace();
}
return battleJavaFxTest;
}

public static void setBattleMonsterGame(battleMonsterTest setBattleMonsterOne) {
battleJavaFxTest = setBattleMonsterOne;
battleWatchTime.countDown();
}

public battleMonsterTest() {
setBattleMonsterGame(this);
}

public void printSomething() {
System.out.println("Overall winner is:"& setBattleMonsterGame);
}
  
// It overrides the run method with the existing arguments

@Override
public void start(Stage battleStage) throws Exception {
BorderPane battleGamePane = new BorderPane();
Scene battleScenes = new Scene(battleGamePane, 700, 400);
battleStage.setScene(battleScenes);

Label battleLabelGame = new Label("Welcome to battle monster game");
battleGamePane.setCenter(battleLabelGame);

battleStage.show();
}

   // The main() method starting point of the java program
  
public static void main(String[] args) {
Application.launch(args);
}
}