Ajout constructeur de Plateau en s'appuyant de RessourceLoader
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
package ihm.controller;
|
||||
|
||||
import carte.CarteLieu;
|
||||
import javafx.animation.TranslateTransition;
|
||||
import javafx.scene.layout.FlowPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.util.Duration;
|
||||
import main.Joueur;
|
||||
|
||||
public class GestionnaireDePions {
|
||||
@ -33,9 +35,18 @@ public class GestionnaireDePions {
|
||||
FlowPane fpAncient = (FlowPane) nAncient.getChildren().get(0);
|
||||
fpAncient.getChildren().remove(pionVie);
|
||||
|
||||
System.out.println(damage);
|
||||
if(damage < 0) {
|
||||
damage = 0;
|
||||
}else if(damage > gp.getChildren().size()-1) {
|
||||
damage = gp.getChildren().size()-1;
|
||||
}
|
||||
StackPane nNew = (StackPane) gp.getChildren().get(damage);
|
||||
FlowPane fpNew = (FlowPane) nNew.getChildren().get(0);
|
||||
|
||||
fpNew.getChildren().add(pionVie);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void deplacerPionLieux(Joueur j) {
|
||||
@ -56,9 +67,21 @@ public class GestionnaireDePions {
|
||||
|
||||
StackPane sp = (StackPane) hbox.getChildren().get(indexCL%2);
|
||||
FlowPane fp = (FlowPane) sp.getChildren().get(0);
|
||||
fp.getChildren().add(this.pionLieu);
|
||||
|
||||
|
||||
fp.getChildren().add(this.pionLieu);
|
||||
}
|
||||
|
||||
|
||||
public void animationDeplacer(double x, double y, Pion p) {
|
||||
|
||||
|
||||
TranslateTransition translate = new TranslateTransition();
|
||||
|
||||
translate.setByX(x);
|
||||
translate.setByY(y);
|
||||
translate.setDuration(Duration.millis(2000));
|
||||
translate.setNode(p);
|
||||
translate.play();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -291,8 +291,8 @@ public class PlateauController implements Initializable {
|
||||
}
|
||||
|
||||
public void updateVieJoueur(Joueur joueur, int damage) {
|
||||
/*JoueurIHM jIHM = getJoueurIHM(joueur);
|
||||
jIHM.deplacerPionVie(damage);*/
|
||||
JoueurIHM jIHM = getJoueurIHM(joueur);
|
||||
jIHM.deplacerPionVie(damage);
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user