Fix locations and add character names
This commit is contained in:
parent
ef96ad87cc
commit
1c281bae4f
|
@ -1,6 +1,7 @@
|
|||
package nl.minkema.leendert;
|
||||
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
|
@ -53,10 +54,15 @@ public class Game extends Pane {
|
|||
playerTurn.setX(1000);
|
||||
playerTurn.setY(50);
|
||||
playerTurn.setPreserveRatio(true);
|
||||
playerTurn.setFitWidth(100);
|
||||
playerTurn.setFitHeight(400);
|
||||
|
||||
Label l = new Label();
|
||||
l.setTranslateX(1035);
|
||||
l.setTranslateY(370);
|
||||
|
||||
|
||||
this.getChildren().add(playerTurn);
|
||||
|
||||
this.getChildren().addAll(l);
|
||||
|
||||
Dice dice = new Dice(1100, 700);
|
||||
this.getChildren().add(dice);
|
||||
|
@ -65,7 +71,9 @@ public class Game extends Pane {
|
|||
int roll = dice.roll();
|
||||
p.move(roll);
|
||||
if (roll == 4) Player.four();
|
||||
playerTurn.setImage(Menu.images[players.get(Player.getNextActive()).getCh()]);
|
||||
int next = players.get(Player.getNextActive()).getCh();
|
||||
playerTurn.setImage(Menu.images[next]);
|
||||
l.setText(Menu.names[next]);
|
||||
Player.four();
|
||||
}));
|
||||
//this.setBackground(new Background(new BackgroundFill(Color.RED, null, null)));
|
||||
|
@ -74,6 +82,7 @@ public class Game extends Pane {
|
|||
}
|
||||
|
||||
playerTurn.setImage(Menu.images[players.get(1).getCh()]);
|
||||
l.setText(Menu.names[players.get(1).getCh()]);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import javafx.scene.Node;
|
|||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.ButtonType;
|
||||
import javafx.scene.control.Tooltip;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
|
@ -30,6 +31,7 @@ public class Menu extends Group {
|
|||
|
||||
|
||||
public static Image[] images;
|
||||
public static String[] names;
|
||||
private static Random random = new Random(System.currentTimeMillis());
|
||||
private int hoeveel = -1;
|
||||
|
||||
|
@ -57,8 +59,6 @@ public class Menu extends Group {
|
|||
menuplayer.play();
|
||||
menuplayer.play();
|
||||
|
||||
menuplayer.stop();
|
||||
|
||||
nodes.add(view);
|
||||
|
||||
|
||||
|
@ -69,12 +69,15 @@ public class Menu extends Group {
|
|||
new Image("/svg/p3.svg", imagewidth, 0, true, false),
|
||||
new Image("/svg/p4.svg", imagewidth, 0, true, false),
|
||||
new Image("/svg/p5.svg", imagewidth, 0, true, false)};
|
||||
|
||||
names = new String[]{"Paulus", "Pinkeltje", "Petunia", "Kwebbel", "Stuart"};
|
||||
int x = 0, y = 0;
|
||||
for (int i1 = 0; i1 < images.length; i1++) {
|
||||
Image i = images[i1];
|
||||
ImageView iv = new ImageView(i);
|
||||
iv.setX(750 + x);
|
||||
iv.setY(400 + y);
|
||||
Tooltip.install(iv, new Tooltip(names[i1]));
|
||||
x += i.getRequestedWidth();
|
||||
if (x > 200) {
|
||||
y += 150;
|
||||
|
@ -100,10 +103,11 @@ public class Menu extends Group {
|
|||
String meer = String.format("Er moeten nog %d mensen kiezen!", hoeveel);
|
||||
Alert alert = new Alert(Alert.AlertType.NONE, hoeveel > 1 ? meer : een, ButtonType.OK);
|
||||
alert.show();
|
||||
chosen.add(ch);
|
||||
}
|
||||
|
||||
}
|
||||
chosen.add(ch);
|
||||
|
||||
});
|
||||
nodes.add(iv);
|
||||
}
|
||||
|
@ -123,11 +127,15 @@ public class Menu extends Group {
|
|||
Rectangle clickable = new Rectangle(x2 - 10, locy + 125, 95 + i * 95, 150);
|
||||
clickable.setFill(Color.TRANSPARENT);
|
||||
clickable.setStroke(Color.BLACK);
|
||||
clickable.setArcHeight(50);
|
||||
clickable.setArcWidth(50);
|
||||
final int s = i + 1;
|
||||
clickable.setOnMouseClicked(e -> {
|
||||
hoeveel = s;
|
||||
new Alert(Alert.AlertType.INFORMATION, "Alle " + hoeveel + " spelers kunnen nu een karakter kiezen. \nAls iemand de verkeerde kiest kan je opnieuw \nop de knop drukken om opnieuw te beginnen.").show();
|
||||
});
|
||||
Tooltip tip = new Tooltip("Hier kan je op klikken");
|
||||
Tooltip.install(clickable, tip);
|
||||
nodes.add(clickable);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,4 +112,5 @@ public class Player {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#format: nummer:x,y
|
||||
0:438,52
|
||||
1:496,53
|
||||
2:548,53
|
||||
|
@ -88,7 +89,7 @@
|
|||
87:605,630
|
||||
88:660,627
|
||||
89:733,628
|
||||
90:695,672
|
||||
90:695,681
|
||||
91:648,681
|
||||
92:582,682
|
||||
93:526,682
|
||||
|
|
Loading…
Reference in a new issue