Merge branch 'development' of https://github.com/PTE-SH/ShadowHunterGame into development

This commit is contained in:
Paul Gross 2020-05-13 10:59:40 +02:00
commit b182af79a4
7 changed files with 42 additions and 16 deletions

View File

@ -16,17 +16,41 @@ public class DieImages {
final Image die5 = new Image(getClass().getResourceAsStream("ressources/img/des5.png"));
final Image die6 = new Image(getClass().getResourceAsStream("ressources/img/des6.png"));
final Image[] images = new Image[6];
final Image dief1 = new Image(getClass().getResourceAsStream("ressources/img/desf1.png"));
final Image dief2 = new Image(getClass().getResourceAsStream("ressources/img/desf2.png"));
final Image dief3 = new Image(getClass().getResourceAsStream("ressources/img/desf3.png"));
final Image dief4 = new Image(getClass().getResourceAsStream("ressources/img/desf4.png"));
public DieImages() {
final Image[] images = new Image[6];
int taille;
public DieImages(int i) {
switch (i) {
case 6:
images[0] = die1;
images[1] = die2;
images[2] = die3;
images[3] = die4;
images[4] = die5;
images[5] = die6;
for (int i = 0; i < images.length; i++) {
taille = 6;
break;
case 4:
images[0] = dief1;
images[1] = dief2;
images[2] = dief3;
images[3] = dief4;
taille = 4;
break;
default:
images[0] = die1;
images[1] = die2;
images[2] = die3;
images[3] = die4;
images[4] = die5;
images[5] = die6;
taille = 6;
}
}

View File

@ -51,7 +51,7 @@ public class LancerDes {
private VBox initLancerD4() {
DieImages images = new DieImages();
DieImages images = new DieImages(4);
Die die = new Die(images.getImages());
ImageView stackpane = die.getdieFace();
stackpane.setFitHeight(100);
@ -95,7 +95,7 @@ public class LancerDes {
}
private VBox initLancerD6() {
DieImages images = new DieImages();
DieImages images = new DieImages(6);
Die die = new Die(images.getImages());
ImageView stackpane = die.getdieFace();
stackpane.setFitHeight(100);
@ -139,9 +139,10 @@ public class LancerDes {
}
private VBox initLancerBoth() {
DieImages images = new DieImages();
DieImages images = new DieImages(6);
DieImages images2 = new DieImages(4);
Die die = new Die(images.getImages());
Die die2 = new Die(images.getImages());
Die die2 = new Die(images2.getImages());
ImageView stackpane = die.getdieFace();
ImageView stackpane2 = die2.getdieFace();
stackpane.setFitHeight(100);
@ -158,8 +159,8 @@ public class LancerDes {
Random random = new Random();
Timeline timeline = new Timeline(new KeyFrame(Duration.seconds(.1), (actionEvent) -> {
int tempRandom = random.nextInt(4)+1;
int tempRandom2 = random.nextInt(6)+1;
int tempRandom = random.nextInt(6)+1;
int tempRandom2 = random.nextInt(4)+1;
die.setDieFace(tempRandom);
die2.setDieFace(tempRandom2);
}));
@ -168,8 +169,8 @@ public class LancerDes {
timeline.play();
timeline.setOnFinished(actionEvent -> {
die.setDieFace(rolls[0]);
die2.setDieFace(rolls[1]);
die.setDieFace(rolls[1]);
die2.setDieFace(rolls[0]);
int result = rolls[0]+rolls[1];

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -375,6 +375,7 @@ public class Plateau extends Thread{
private int rollRandom(int nb) {
int roll = (int) Math.floor(Math.random() * (nb-1))+1;
System.out.println("roll" + roll);
return roll;
}