Ajouts d'images et quelques modification de cell et Gui

This commit is contained in:
Valentin Lucas 2021-12-02 19:56:37 +01:00
parent 623e6b5fb3
commit 0876b4c773
9 changed files with 34 additions and 8 deletions

View File

@ -5,6 +5,7 @@ import fr.lnl.game.server.games.grid.EnergyBall;
import fr.lnl.game.server.games.grid.Mine;
import fr.lnl.game.server.games.grid.Wall;
import fr.lnl.game.server.games.player.Player;
import fr.lnl.game.server.utils.Cardinal;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
@ -37,17 +38,34 @@ public class Cell extends Rectangle {
if(object instanceof Player){
image = new Image("file:resources/images/player.png");
}
if(object instanceof EnergyBall){
else if(object instanceof EnergyBall){
image = new Image("file:resources/images/energyBall.png");
}
if(object instanceof Bomb){
else if(object instanceof Bomb){
image = new Image("file:resources/images/bomb.jpg");
}
if(object instanceof Mine){
else if(object instanceof Mine){
image = new Image("file:resources/images/mine.webp");
}
else{
image = new Image("file:resources/images/wall.jpg");
//test
if(((Wall)object).getCardinal()== Cardinal.NORTH){
image = new Image("file:resources/topWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.SOUTH) {
image = new Image("file:resources/bottomWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.EAST) {
image = new Image("file:resources/rightWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.WEST) {
image = new Image("file:resources/leftWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.NORTH_EAST) {
image = new Image("file:resources/topRightWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.NORTH_WEST) {
image = new Image("file:resources/topLeftWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.SOUTH_EAST) {
image = new Image("file:resources/bottomRightWall.png");
}else{
image = new Image("file:resources/bottomLeftWall.png");
}
}
ImageView iv = new ImageView(image);

View File

@ -52,9 +52,8 @@ public class GUI {
private Parent createContent() {
Pane principalPane = new Pane();
principalPane.setPrefSize(width * cellSize, height * cellSize);
//PARTIE1
//à définir avec n pour moduler la taille du plateau
//à définir avec n pour moduler la taille du plateau
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
Cell cell = new Cell(i, j);
@ -62,7 +61,6 @@ public class GUI {
}
}
//PARTIE2
board = grid.getBoard();
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 16; j++) {
@ -71,11 +69,20 @@ public class GUI {
addToPrincipalPanel(value.getA(), principalPane, i, j);
}
if (value.getB() instanceof Wall || value.getB() instanceof EnergyBall || value.getB() instanceof Mine || value.getB() instanceof Bomb) {
System.out.println(value.getB());
addToPrincipalPanel(value.getB(), principalPane, i, j);
}
}
}
//PARTIE3
Rectangle shape = new Rectangle();
shape.setX(700);
shape.setY(20);
shape.setWidth(200);
shape.setHeight(600);
shape.setFill(javafx.scene.paint.Color.WHITE);
Button followingButton = new Button("SUIVANT");
followingButton.setLayoutX(775);
followingButton.setLayoutY(600);
@ -84,6 +91,7 @@ public class GUI {
//add un eventListener au button
principalPane.getChildren().add(followingButton);
//pas compris le principe
return principalPane;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB