diff --git a/src/ihm/Main.java b/src/ihm/Main.java
index e2ad2e7..ea9fd09 100644
--- a/src/ihm/Main.java
+++ b/src/ihm/Main.java
@@ -12,7 +12,7 @@ public class Main extends Application {
public void start(Stage primaryStage) throws Exception {
System.out.println("Lancement de l'application");
- Pane root = FXMLLoader.load(getClass().getResource("ressources/Menu.fxml")); // "ressources/Jouer_tour(1)lancer_des.fxml"
+ Pane root = FXMLLoader.load(getClass().getResource("ressources/des.fxml")); // "ressources/Jouer_tour(1)lancer_des.fxml"
primaryStage.setTitle("Shadow Hunters");
primaryStage.setScene(new Scene(root));
diff --git a/src/ihm/SpriteAnimation.java b/src/ihm/SpriteAnimation.java
new file mode 100644
index 0000000..b9d58af
--- /dev/null
+++ b/src/ihm/SpriteAnimation.java
@@ -0,0 +1,47 @@
+package ihm;
+
+import javafx.animation.Interpolator;
+import javafx.animation.Transition;
+import javafx.geometry.Rectangle2D;
+import javafx.scene.image.ImageView;
+import javafx.util.Duration;
+
+public class SpriteAnimation extends Transition {
+
+ private final ImageView imageView;
+ private final int count;
+ private final int columns;
+ private final int offsetX;
+ private final int offsetY;
+ private final int width;
+ private final int height;
+
+ private int lastIndex;
+
+ public SpriteAnimation(
+ ImageView imageView,
+ Duration duration,
+ int count, int columns,
+ int offsetX, int offsetY,
+ int width, int height) {
+ this.imageView = imageView;
+ this.count = count;
+ this.columns = columns;
+ this.offsetX = offsetX;
+ this.offsetY = offsetY;
+ this.width = width;
+ this.height = height;
+ setCycleDuration(duration);
+ setInterpolator(Interpolator.LINEAR);
+ }
+
+ protected void interpolate(double k) {
+ final int index = Math.min((int) Math.floor(k * count), count - 1);
+ if (index != lastIndex) {
+ final int x = (index % columns) * width + offsetX;
+ final int y = (index / columns) * height + offsetY;
+ imageView.setViewport(new Rectangle2D(x, y, width, height));
+ lastIndex = index;
+ }
+ }
+}
diff --git a/src/ihm/controller/JouerSonTour1Controller.java b/src/ihm/controller/JouerSonTour1Controller.java
index bf8d497..f641fbd 100644
--- a/src/ihm/controller/JouerSonTour1Controller.java
+++ b/src/ihm/controller/JouerSonTour1Controller.java
@@ -19,8 +19,6 @@ public class JouerSonTour1Controller implements Initializable{
private Joueur joueur;
@FXML private Pane rootPane;
- @FXML private Label d6;
- @FXML private Label d4;
@FXML private Label nomJoueur;
@Override
@@ -30,13 +28,7 @@ public class JouerSonTour1Controller implements Initializable{
@FXML
public void lancerDes(MouseEvent mouseEvent) throws IOException, InterruptedException{
- //lancer d6
- int d6 = new Random().nextInt(6) + 1;
- this.d6.setText(Integer.toString(d6));
- //lancer d4
- int d4 = new Random().nextInt(4) + 1;
- this.d6.setText(Integer.toString(d4));
Thread.sleep(1000);
diff --git a/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml b/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml
index 6415e41..dc83f10 100644
--- a/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml
+++ b/src/ihm/ressources/Jouer_tour(1)lancer_des.fxml
@@ -20,14 +20,6 @@
-
-