Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVAFx (not Javascript) Thank you for helping:) Building on your Battle monsters game.You are going to turn it into a graphic. Hydrons are all triangles;

JAVAFx (not Javascript) Thank you for helping:)

Building on your Battle monsters game.You are going to turn it into a graphic.

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 monsters 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 losers 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)

* JavaDocs & UMLs for each class. Base your Hydron & Zexor classes on the UMLs from the previous assignment.

image text in transcribed_______________________________________________________________________________

This are the previous s assignment of Hydron, Zexor and dice

Hydron :

class Hydron {

String color;

double height;

double weight;

double health = 25;

double damagePotential;

String attackType;

int noOfBattlesWon=0;

int noOfBattlesLost=0;

String name;

String homePlanet;

public Hydron(String color, double height, double weight, double damagePotential, String attackType, String name, String homePlanet)

{

this.color = color;

this.height = height;

this.weight = weight;

this.damagePotential = damagePotential;

this.attackType = attackType;

this.name = name;

this.homePlanet = homePlanet;

}

//Getters and Setters

public String getColor() {

return color;

}

public void setColor(String color) {

this.color = color;

}

public double getHeight() {

return height;

}

public void setHeight(double height) {

this.height = height;

}

public double getWeight() {

return weight;

}

public void setWeight(double weight) {

this.weight = weight;

}

public double getHealth() {

return health;

}

public void setHealth(double health) {

this.health = health;

}

public double getDamagePotential() {

return damagePotential;

}

public void setDamagePotential(double damagePotential) {

this.damagePotential = damagePotential;

}

public String getAttackType() {

return attackType;

}

public void setAttackType(String attackType) {

this.attackType = attackType;

}

public int getNoOfBattlesWon() {

return noOfBattlesWon;

}

public void setNoOfBattlesWon(int noOfBattlesWon) {

this.noOfBattlesWon = noOfBattlesWon;

}

public int getNoOfBattlesLost() {

return noOfBattlesLost;

}

public void setNoOfBattlesLost(int noOfBattlesLost) {

this.noOfBattlesLost = noOfBattlesLost;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getHomePlanet() {

return homePlanet;

}

public void setHomePlanet(String homePlanet) {

this.homePlanet = homePlanet;

}

}

Zexor:

class Zexor {

String color;

double height;

double weight;

double health = 25;

double damagePotential;

String attackType;

int noOfBattlesWon = 0;

int noOfBattlesLost = 0;

String name;

String species;

public Zexor(String color, double height, double weight, double damagePotential, String attackType, String name, String species)

{

this.color = color;

this.height = height;

this.weight = weight;

this.damagePotential = damagePotential;

this.attackType = attackType;

this.name = name;

this.species = species;

}

public String getColor() {

return color;

}

public void setColor(String color) {

this.color = color;

}

public double getHeight() {

return height;

}

public void setHeight(double height) {

this.height = height;

}

public double getWeight() {

return weight;

}

public void setWeight(double weight) {

this.weight = weight;

}

public double getHealth() {

return health;

}

public void setHealth(double health) {

this.health = health;

}

public double getDamagePotential() {

return damagePotential;

}

public void setDamagePotential(double damagePotential) {

this.damagePotential = damagePotential;

}

public String getAttackType() {

return attackType;

}

public void setAttackType(String attackType) {

this.attackType = attackType;

}

public int getNoOfBattlesWon() {

return noOfBattlesWon;

}

public void setNoOfBattlesWon(int noOfBattlesWon) {

this.noOfBattlesWon = noOfBattlesWon;

}

public int getNoOfBattlesLost() {

return noOfBattlesLost;

}

public void setNoOfBattlesLost(int noOfBattlesLost) {

this.noOfBattlesLost = noOfBattlesLost;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String getSpecies() {

return species;

}

public void setSpecies(String species) {

this.species = species;

}

}

Dice:

import java.util.Random;

class DiceRoll {

int noOfSides;

public DiceRoll(int noOfSides)

{

this.noOfSides = noOfSides;

}

public int rollDice()

{

Random rand = new Random();

int low = 1;

int high = noOfSides + 1;

int result = rand.nextInt(high - low) + low;

return result;

}

}

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. 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

3. What strategies might you use?

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago