SlideShare a Scribd company logo
1 of 9
Download to read offline
Here is my javafx code to create a basic warehammer 40k game. I want you to write the charge
method in javafx which will charge the character when a bullet hit by the other unit team like
have to do who can charge , declare charge , resolve overwatch ,roll distance or roll charge
range, charge move and repeat if desired. my unit class and shoot method are available. please
please if you can do it accept the ticket. (Nothing is better than bad and unrunnable method)
Thanks.
Here is the method to be implement which is already is in unit class.
public void charge(turnManager tM, int distance) {
}
}
Here is the all class.
public abstract class unit {
String name;
int WS;//unit's weaponskill
int BS;//unit's ballistic skill
int S;//unit's strength
int T;//unit's toughness
int W;//unit's wounds
int I;//Unit's initiave
int A;//unit's number of close combat attacks
int Ld;//unit's leadership
int Sv;//unit's ARMOR save
Weapon gun;
Weapon melee;
boolean shot;
boolean moved;
boolean charged;
boolean team;
Circle rep;
boolean alive
public void shoot(turnManager tM, int Distance,D6 d6,Tables t,Pane root) {
if(tM.selected.shot){
System.out.println("Unit has allready shot");
return;
}
tM.selected.shot=true;
if((tM.selected.gun.Range*30)>=Distance){
int Tw=t.getToWound(gun.S, tM.targeted.T);
int Th=tM.selected.BS;
int shots=tM.selected.gun.Shots;
if(tM.selected.gun.isRapidFire && ((tM.selected.gun.Range*15)>=Distance)){
shots=2;
}
int hits=d6.roll(shots, Th);//roll to hit.
int wounds=d6.roll(hits, Tw);;//roll to wound.
while(wounds>0){
if(d6.roll(1,Sv)==1){//wound was saved
System.out.println("Wound saved");
}
else{//wound was not saved
tM.targeted.W--;
if (tM.targeted.W==0){
tM.targeted.die(root);
return;
}
}
wounds--;//
}
}
}
/**
*TO DO
* @param tM
* @param distance
*/
public void charge(turnManager tM, int distance, Pane root) {
// To do method
}
public void setPos(double x, double y) {
rep.setCenterX(x);
rep.setCenterY(y);
}
public double getPosX() {
return rep.getCenterX();
}
public double getPosY() {
return rep.getCenterY();
}
public void die(Pane root) {
alive = false;
root.getChildren().remove(rep);
}
public void handleMouseClick(MouseEvent e, turnManager tM, Circle movementAssist, Pane
root, Line targetingAssist) {
if (tM.getTurn() == team) {
if (tM.isMove()) {
//select the unit and have the circle move it
tM.selected = this;
if (!root.getChildren().contains(movementAssist)){
root.getChildren().add(movementAssist);
}
movementAssist.setCenterX(rep.getCenterX());
movementAssist.setCenterY(rep.getCenterY());
}
if (tM.isShoot()) {
//select the unit that is shooting
tM.selected = this;
targetingAssist.setStartX(rep.getCenterX());
targetingAssist.setStartY(rep.getCenterY());
}
if (tM.isAssualt()) {
//select the unit to charge
tM.selected = this;
targetingAssist.setStartX(rep.getCenterX());
targetingAssist.setStartY(rep.getCenterY());
}
} else {
if (tM.isMove()) {
return;
}
if (tM.isShoot()) {
tM.targeted = this;
targetingAssist.setEndX(rep.getCenterX());
targetingAssist.setEndY(rep.getCenterY());
Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY());
Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY());
int distance = (int) p1.distance(p2);
if (!tM.selected.shot) {//see if that unit had shot yet
D6 d6=new D6();
Tables table=new Tables();
shoot(tM, distance, d6, table, root);//resolve shooting attack
}
}
if (tM.isAssualt()) {
tM.targeted = this;
targetingAssist.setEndX(rep.getCenterX());
targetingAssist.setEndY(rep.getCenterY());
Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY());
Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY());
int distance = (int) p1.distance(p2);
if (!tM.selected.charged) {
charge(tM, distance);
}
}
}
}
public String toString() {
return ("WS, " + WS + " BS, " + BS + " S, " + S + " T," + T + " W, " + W + " I, " + I +
" A, " + A
+ " LD, " + Ld + " SV, " + Sv);
}
}
public class D6 {
public int roll(int num, int success) {
int sum = 0;
for (int i = 0; i < num; i++) {
if ((((int) (Math.random() * 6)) + 1) >= success) {
sum += 1;
}
}
return sum;
}
public int charge(){ return ((((int)Math.random()*6)+1)+(((int)Math.random()*6)+1));}
}
Solution
public void charge(turnManager tM, int distance) {
}
}
Here is the all class.
public abstract class unit {
String name;
int WS;//unit's weaponskill
int BS;//unit's ballistic skill
int S;//unit's strength
int T;//unit's toughness
int W;//unit's wounds
int I;//Unit's initiave
int A;//unit's number of close combat attacks
int Ld;//unit's leadership
int Sv;//unit's ARMOR save
Weapon gun;
Weapon melee;
boolean shot;
boolean moved;
boolean charged;
boolean team;
Circle rep;
boolean alive
public void shoot(turnManager tM, int Distance,D6 d6,Tables t,Pane root) {
if(tM.selected.shot){
System.out.println("Unit has allready shot");
return;
}
tM.selected.shot=true;
if((tM.selected.gun.Range*30)>=Distance){
int Tw=t.getToWound(gun.S, tM.targeted.T);
int Th=tM.selected.BS;
int shots=tM.selected.gun.Shots;
if(tM.selected.gun.isRapidFire && ((tM.selected.gun.Range*15)>=Distance)){
shots=2;
}
int hits=d6.roll(shots, Th);//roll to hit.
int wounds=d6.roll(hits, Tw);;//roll to wound.
while(wounds>0){
if(d6.roll(1,Sv)==1){//wound was saved
System.out.println("Wound saved");
}
else{//wound was not saved
tM.targeted.W--;
if (tM.targeted.W==0){
tM.targeted.die(root);
return;
}
}
wounds--;//
}
}
}
/**
*TO DO
* @param tM
* @param distance
*/
public void charge(turnManager tM, int distance, Pane root) {
// To do method
}
public void setPos(double x, double y) {
rep.setCenterX(x);
rep.setCenterY(y);
}
public double getPosX() {
return rep.getCenterX();
}
public double getPosY() {
return rep.getCenterY();
}
public void die(Pane root) {
alive = false;
root.getChildren().remove(rep);
}
public void handleMouseClick(MouseEvent e, turnManager tM, Circle movementAssist, Pane
root, Line targetingAssist) {
if (tM.getTurn() == team) {
if (tM.isMove()) {
//select the unit and have the circle move it
tM.selected = this;
if (!root.getChildren().contains(movementAssist)){
root.getChildren().add(movementAssist);
}
movementAssist.setCenterX(rep.getCenterX());
movementAssist.setCenterY(rep.getCenterY());
}
if (tM.isShoot()) {
//select the unit that is shooting
tM.selected = this;
targetingAssist.setStartX(rep.getCenterX());
targetingAssist.setStartY(rep.getCenterY());
}
if (tM.isAssualt()) {
//select the unit to charge
tM.selected = this;
targetingAssist.setStartX(rep.getCenterX());
targetingAssist.setStartY(rep.getCenterY());
}
} else {
if (tM.isMove()) {
return;
}
if (tM.isShoot()) {
tM.targeted = this;
targetingAssist.setEndX(rep.getCenterX());
targetingAssist.setEndY(rep.getCenterY());
Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY());
Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY());
int distance = (int) p1.distance(p2);
if (!tM.selected.shot) {//see if that unit had shot yet
D6 d6=new D6();
Tables table=new Tables();
shoot(tM, distance, d6, table, root);//resolve shooting attack
}
}
if (tM.isAssualt()) {
tM.targeted = this;
targetingAssist.setEndX(rep.getCenterX());
targetingAssist.setEndY(rep.getCenterY());
Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY());
Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY());
int distance = (int) p1.distance(p2);
if (!tM.selected.charged) {
charge(tM, distance);
}
}
}
}
public String toString() {
return ("WS, " + WS + " BS, " + BS + " S, " + S + " T," + T + " W, " + W + " I, " + I +
" A, " + A
+ " LD, " + Ld + " SV, " + Sv);
}
}
public class D6 {
public int roll(int num, int success) {
int sum = 0;
for (int i = 0; i < num; i++) {
if ((((int) (Math.random() * 6)) + 1) >= success) {
sum += 1;
}
}
return sum;
}
public int charge(){ return ((((int)Math.random()*6)+1)+(((int)Math.random()*6)+1));}
}

More Related Content

Similar to Here is my javafx code to create a basic warehammer 40k game. I want.pdf

CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmary772
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxmccormicknadine86
 
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxassignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxssuser562afc1
 
Import java
Import javaImport java
Import javaheni2121
 
Merge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdfMerge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdffeelinggifts
 
please send edited code of RCBug.javaRCBUG.javaimport java.util..pdf
please send edited code of RCBug.javaRCBUG.javaimport java.util..pdfplease send edited code of RCBug.javaRCBUG.javaimport java.util..pdf
please send edited code of RCBug.javaRCBUG.javaimport java.util..pdfFashionBoutiquedelhi
 
public class AVLTreeT extends ComparableT extends BSTT { p.pdf
public class AVLTreeT extends ComparableT extends BSTT {   p.pdfpublic class AVLTreeT extends ComparableT extends BSTT {   p.pdf
public class AVLTreeT extends ComparableT extends BSTT { p.pdfagmobiles
 
Create a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdfCreate a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdfdaniamantileonismc36
 
assign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docx
assign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docxassign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docx
assign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docxfestockton
 
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfrajkumarm401
 
In Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfIn Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfanjandavid
 
Tank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineTank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineFarzad Nozarian
 
need help with code I wrote. This code is a maze gui, and i need hel.pdf
need help with code I wrote. This code is a maze gui, and i need hel.pdfneed help with code I wrote. This code is a maze gui, and i need hel.pdf
need help with code I wrote. This code is a maze gui, and i need hel.pdfarcotstarsports
 
Modified Code Game.java­import java.util.;public class Game.pdf
Modified Code Game.java­import java.util.;public class Game.pdfModified Code Game.java­import java.util.;public class Game.pdf
Modified Code Game.java­import java.util.;public class Game.pdfgalagirishp
 

Similar to Here is my javafx code to create a basic warehammer 40k game. I want.pdf (15)

CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docxCodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
CodeZipButtonDemo.javaCodeZipButtonDemo.java Demonstrate a p.docx
 
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docxassignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
assignmentTwoCar.javaassignmentTwoCar.javapackage assignmentTw.docx
 
Import java
Import javaImport java
Import java
 
Merge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdfMerge Sort java with a few details, please include comments if possi.pdf
Merge Sort java with a few details, please include comments if possi.pdf
 
please send edited code of RCBug.javaRCBUG.javaimport java.util..pdf
please send edited code of RCBug.javaRCBUG.javaimport java.util..pdfplease send edited code of RCBug.javaRCBUG.javaimport java.util..pdf
please send edited code of RCBug.javaRCBUG.javaimport java.util..pdf
 
public class AVLTreeT extends ComparableT extends BSTT { p.pdf
public class AVLTreeT extends ComparableT extends BSTT {   p.pdfpublic class AVLTreeT extends ComparableT extends BSTT {   p.pdf
public class AVLTreeT extends ComparableT extends BSTT { p.pdf
 
Create a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdfCreate a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdf
 
assign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docx
assign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docxassign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docx
assign4-2.DS_Storeassign4-2assign4_part2mymem.h#include.docx
 
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdf
 
In Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdfIn Java using Eclipse, Im suppose to write a class that encapsulat.pdf
In Java using Eclipse, Im suppose to write a class that encapsulat.pdf
 
Tank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engineTank Battle - A simple game powered by JMonkey engine
Tank Battle - A simple game powered by JMonkey engine
 
Mamdani
MamdaniMamdani
Mamdani
 
need help with code I wrote. This code is a maze gui, and i need hel.pdf
need help with code I wrote. This code is a maze gui, and i need hel.pdfneed help with code I wrote. This code is a maze gui, and i need hel.pdf
need help with code I wrote. This code is a maze gui, and i need hel.pdf
 
Modified Code Game.java­import java.util.;public class Game.pdf
Modified Code Game.java­import java.util.;public class Game.pdfModified Code Game.java­import java.util.;public class Game.pdf
Modified Code Game.java­import java.util.;public class Game.pdf
 

More from arishmarketing21

A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfA series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfarishmarketing21
 
What is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfWhat is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfarishmarketing21
 
Write a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfWrite a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfarishmarketing21
 
Which a not a likely location of a bacterial to be found Atheroscle.pdf
Which a not a likely location of a bacterial to be found  Atheroscle.pdfWhich a not a likely location of a bacterial to be found  Atheroscle.pdf
Which a not a likely location of a bacterial to be found Atheroscle.pdfarishmarketing21
 
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfWhat’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfarishmarketing21
 
What is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfWhat is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfarishmarketing21
 
What is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfWhat is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfarishmarketing21
 
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfA species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfarishmarketing21
 
What are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfWhat are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfarishmarketing21
 
Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfarishmarketing21
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfarishmarketing21
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdfarishmarketing21
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfarishmarketing21
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdfarishmarketing21
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfarishmarketing21
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfarishmarketing21
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfarishmarketing21
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfarishmarketing21
 
public class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfpublic class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfarishmarketing21
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdfarishmarketing21
 

More from arishmarketing21 (20)

A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdfA series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
A series RL circuit includes a 9.05-V battery, a resistance of R = 0.pdf
 
What is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdfWhat is the dangling pointer Explain with a proper example.Solut.pdf
What is the dangling pointer Explain with a proper example.Solut.pdf
 
Write a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdfWrite a function in javascript that calculates the average element i.pdf
Write a function in javascript that calculates the average element i.pdf
 
Which a not a likely location of a bacterial to be found Atheroscle.pdf
Which a not a likely location of a bacterial to be found  Atheroscle.pdfWhich a not a likely location of a bacterial to be found  Atheroscle.pdf
Which a not a likely location of a bacterial to be found Atheroscle.pdf
 
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdfWhat’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
What’s Love Got To Do With ItThe Evolution of Human MatingB.pdf
 
What is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdfWhat is the Surface characterization techniques of Fourier-transform.pdf
What is the Surface characterization techniques of Fourier-transform.pdf
 
What is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdfWhat is the running time complexity and space complexity of the follo.pdf
What is the running time complexity and space complexity of the follo.pdf
 
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdfA species has a diploid number of chromosomes of 6. If a cell from a.pdf
A species has a diploid number of chromosomes of 6. If a cell from a.pdf
 
What are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdfWhat are the security requirements and challenges of Grid and Cloud .pdf
What are the security requirements and challenges of Grid and Cloud .pdf
 
Using the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdfUsing the man command, determine which ls command option (flag) will.pdf
Using the man command, determine which ls command option (flag) will.pdf
 
There a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdfThere a six seats in a bar. Your friend took the second seat from th.pdf
There a six seats in a bar. Your friend took the second seat from th.pdf
 
The basic economic problem is that we only have so many resources, b.pdf
The basic  economic problem is that we only have so many resources, b.pdfThe basic  economic problem is that we only have so many resources, b.pdf
The basic economic problem is that we only have so many resources, b.pdf
 
The organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdfThe organization of interrupted genes is often conserved between spe.pdf
The organization of interrupted genes is often conserved between spe.pdf
 
The daisy has which inflorescence morphology type campanulte tubul.pdf
The daisy has which inflorescence morphology type  campanulte  tubul.pdfThe daisy has which inflorescence morphology type  campanulte  tubul.pdf
The daisy has which inflorescence morphology type campanulte tubul.pdf
 
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdfSuppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
Suppose that CaO is present as an impurity to Li2O. The Ca2+ ion sub.pdf
 
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdfResistance A primitive adaptive immune Zone of inhibition The ability.pdf
Resistance A primitive adaptive immune Zone of inhibition The ability.pdf
 
Refer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdfRefer to my progress on this assignment belowIn this problem you w.pdf
Refer to my progress on this assignment belowIn this problem you w.pdf
 
Q1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdfQ1) Show what part of SSL that protects against the following attack.pdf
Q1) Show what part of SSL that protects against the following attack.pdf
 
public class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdfpublic class Patient extends Person {=========== Properties ====.pdf
public class Patient extends Person {=========== Properties ====.pdf
 
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
8. A human T lymphocyte is infected by a HIV. The viral genome prese.pdf
 

Recently uploaded

Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptxPoojaSen20
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxMohamed Rizk Khodair
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 

Recently uploaded (20)

Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 

Here is my javafx code to create a basic warehammer 40k game. I want.pdf

  • 1. Here is my javafx code to create a basic warehammer 40k game. I want you to write the charge method in javafx which will charge the character when a bullet hit by the other unit team like have to do who can charge , declare charge , resolve overwatch ,roll distance or roll charge range, charge move and repeat if desired. my unit class and shoot method are available. please please if you can do it accept the ticket. (Nothing is better than bad and unrunnable method) Thanks. Here is the method to be implement which is already is in unit class. public void charge(turnManager tM, int distance) { } } Here is the all class. public abstract class unit { String name; int WS;//unit's weaponskill int BS;//unit's ballistic skill int S;//unit's strength int T;//unit's toughness int W;//unit's wounds int I;//Unit's initiave int A;//unit's number of close combat attacks int Ld;//unit's leadership int Sv;//unit's ARMOR save Weapon gun; Weapon melee; boolean shot; boolean moved; boolean charged; boolean team; Circle rep; boolean alive public void shoot(turnManager tM, int Distance,D6 d6,Tables t,Pane root) { if(tM.selected.shot){ System.out.println("Unit has allready shot"); return;
  • 2. } tM.selected.shot=true; if((tM.selected.gun.Range*30)>=Distance){ int Tw=t.getToWound(gun.S, tM.targeted.T); int Th=tM.selected.BS; int shots=tM.selected.gun.Shots; if(tM.selected.gun.isRapidFire && ((tM.selected.gun.Range*15)>=Distance)){ shots=2; } int hits=d6.roll(shots, Th);//roll to hit. int wounds=d6.roll(hits, Tw);;//roll to wound. while(wounds>0){ if(d6.roll(1,Sv)==1){//wound was saved System.out.println("Wound saved"); } else{//wound was not saved tM.targeted.W--; if (tM.targeted.W==0){ tM.targeted.die(root); return; } } wounds--;// } } } /** *TO DO * @param tM * @param distance */ public void charge(turnManager tM, int distance, Pane root) { // To do method } public void setPos(double x, double y) {
  • 3. rep.setCenterX(x); rep.setCenterY(y); } public double getPosX() { return rep.getCenterX(); } public double getPosY() { return rep.getCenterY(); } public void die(Pane root) { alive = false; root.getChildren().remove(rep); } public void handleMouseClick(MouseEvent e, turnManager tM, Circle movementAssist, Pane root, Line targetingAssist) { if (tM.getTurn() == team) { if (tM.isMove()) { //select the unit and have the circle move it tM.selected = this; if (!root.getChildren().contains(movementAssist)){ root.getChildren().add(movementAssist); } movementAssist.setCenterX(rep.getCenterX()); movementAssist.setCenterY(rep.getCenterY()); } if (tM.isShoot()) { //select the unit that is shooting tM.selected = this; targetingAssist.setStartX(rep.getCenterX()); targetingAssist.setStartY(rep.getCenterY()); } if (tM.isAssualt()) { //select the unit to charge tM.selected = this;
  • 4. targetingAssist.setStartX(rep.getCenterX()); targetingAssist.setStartY(rep.getCenterY()); } } else { if (tM.isMove()) { return; } if (tM.isShoot()) { tM.targeted = this; targetingAssist.setEndX(rep.getCenterX()); targetingAssist.setEndY(rep.getCenterY()); Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY()); Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY()); int distance = (int) p1.distance(p2); if (!tM.selected.shot) {//see if that unit had shot yet D6 d6=new D6(); Tables table=new Tables(); shoot(tM, distance, d6, table, root);//resolve shooting attack } } if (tM.isAssualt()) { tM.targeted = this; targetingAssist.setEndX(rep.getCenterX()); targetingAssist.setEndY(rep.getCenterY()); Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY()); Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY()); int distance = (int) p1.distance(p2); if (!tM.selected.charged) { charge(tM, distance); } } } } public String toString() { return ("WS, " + WS + " BS, " + BS + " S, " + S + " T," + T + " W, " + W + " I, " + I + " A, " + A
  • 5. + " LD, " + Ld + " SV, " + Sv); } } public class D6 { public int roll(int num, int success) { int sum = 0; for (int i = 0; i < num; i++) { if ((((int) (Math.random() * 6)) + 1) >= success) { sum += 1; } } return sum; } public int charge(){ return ((((int)Math.random()*6)+1)+(((int)Math.random()*6)+1));} } Solution public void charge(turnManager tM, int distance) { } } Here is the all class. public abstract class unit { String name; int WS;//unit's weaponskill int BS;//unit's ballistic skill int S;//unit's strength int T;//unit's toughness int W;//unit's wounds int I;//Unit's initiave int A;//unit's number of close combat attacks int Ld;//unit's leadership int Sv;//unit's ARMOR save Weapon gun; Weapon melee;
  • 6. boolean shot; boolean moved; boolean charged; boolean team; Circle rep; boolean alive public void shoot(turnManager tM, int Distance,D6 d6,Tables t,Pane root) { if(tM.selected.shot){ System.out.println("Unit has allready shot"); return; } tM.selected.shot=true; if((tM.selected.gun.Range*30)>=Distance){ int Tw=t.getToWound(gun.S, tM.targeted.T); int Th=tM.selected.BS; int shots=tM.selected.gun.Shots; if(tM.selected.gun.isRapidFire && ((tM.selected.gun.Range*15)>=Distance)){ shots=2; } int hits=d6.roll(shots, Th);//roll to hit. int wounds=d6.roll(hits, Tw);;//roll to wound. while(wounds>0){ if(d6.roll(1,Sv)==1){//wound was saved System.out.println("Wound saved"); } else{//wound was not saved tM.targeted.W--; if (tM.targeted.W==0){ tM.targeted.die(root); return; } } wounds--;// } } }
  • 7. /** *TO DO * @param tM * @param distance */ public void charge(turnManager tM, int distance, Pane root) { // To do method } public void setPos(double x, double y) { rep.setCenterX(x); rep.setCenterY(y); } public double getPosX() { return rep.getCenterX(); } public double getPosY() { return rep.getCenterY(); } public void die(Pane root) { alive = false; root.getChildren().remove(rep); } public void handleMouseClick(MouseEvent e, turnManager tM, Circle movementAssist, Pane root, Line targetingAssist) { if (tM.getTurn() == team) { if (tM.isMove()) { //select the unit and have the circle move it tM.selected = this; if (!root.getChildren().contains(movementAssist)){ root.getChildren().add(movementAssist); } movementAssist.setCenterX(rep.getCenterX()); movementAssist.setCenterY(rep.getCenterY());
  • 8. } if (tM.isShoot()) { //select the unit that is shooting tM.selected = this; targetingAssist.setStartX(rep.getCenterX()); targetingAssist.setStartY(rep.getCenterY()); } if (tM.isAssualt()) { //select the unit to charge tM.selected = this; targetingAssist.setStartX(rep.getCenterX()); targetingAssist.setStartY(rep.getCenterY()); } } else { if (tM.isMove()) { return; } if (tM.isShoot()) { tM.targeted = this; targetingAssist.setEndX(rep.getCenterX()); targetingAssist.setEndY(rep.getCenterY()); Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY()); Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY()); int distance = (int) p1.distance(p2); if (!tM.selected.shot) {//see if that unit had shot yet D6 d6=new D6(); Tables table=new Tables(); shoot(tM, distance, d6, table, root);//resolve shooting attack } } if (tM.isAssualt()) { tM.targeted = this; targetingAssist.setEndX(rep.getCenterX()); targetingAssist.setEndY(rep.getCenterY()); Point2D p1 = new Point2D(targetingAssist.getStartX(), targetingAssist.getStartY()); Point2D p2 = new Point2D(targetingAssist.getEndX(), targetingAssist.getEndY());
  • 9. int distance = (int) p1.distance(p2); if (!tM.selected.charged) { charge(tM, distance); } } } } public String toString() { return ("WS, " + WS + " BS, " + BS + " S, " + S + " T," + T + " W, " + W + " I, " + I + " A, " + A + " LD, " + Ld + " SV, " + Sv); } } public class D6 { public int roll(int num, int success) { int sum = 0; for (int i = 0; i < num; i++) { if ((((int) (Math.random() * 6)) + 1) >= success) { sum += 1; } } return sum; } public int charge(){ return ((((int)Math.random()*6)+1)+(((int)Math.random()*6)+1));} }