Fix images not loading

This commit is contained in:
Quentin Legot 2021-12-03 15:30:38 +01:00
parent 899f3ecebf
commit 0a4e706e07

View File

@ -3,6 +3,7 @@ package fr.lnl.game.client.view;
import fr.lnl.game.server.games.grid.Bomb; import fr.lnl.game.server.games.grid.Bomb;
import fr.lnl.game.server.games.grid.EnergyBall; import fr.lnl.game.server.games.grid.EnergyBall;
import fr.lnl.game.server.games.grid.Mine; 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.games.player.Player;
import fr.lnl.game.server.utils.Cardinal; import fr.lnl.game.server.utils.Cardinal;
import javafx.scene.image.Image; import javafx.scene.image.Image;
@ -35,35 +36,35 @@ public class Cell extends Rectangle {
StackPane sp = new StackPane(); StackPane sp = new StackPane();
if(object instanceof Player){ if(object instanceof Player){
image = new Image("file:resources/images/player.png"); image = new Image("/images/player.png");
} }
else if(object instanceof EnergyBall){ else if(object instanceof EnergyBall){
image = new Image("file:resources/images/energyBall.png"); image = new Image("/images/energyBall.png");
} }
else if(object instanceof Bomb){ else if(object instanceof Bomb){
image = new Image("file:resources/images/bomb.jpg"); image = new Image("/images/bomb.jpg");
} }
else if(object instanceof Mine){ else if(object instanceof Mine){
image = new Image("file:resources/images/mine.webp"); image = new Image("/images/mine.webp");
} }
else{ else{
//test //test
if(((Wall)object).getCardinal()== Cardinal.NORTH){ if(((Wall)object).getCardinal()== Cardinal.NORTH){
image = new Image("file:resources/topWall.png"); image = new Image("/images/topWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.SOUTH) { }else if(((Wall)object).getCardinal()== Cardinal.SOUTH) {
image = new Image("file:resources/bottomWall.png"); image = new Image("/images/bottomWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.EAST) { }else if(((Wall)object).getCardinal()== Cardinal.EAST) {
image = new Image("file:resources/rightWall.png"); image = new Image("/images/rightWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.WEST) { }else if(((Wall)object).getCardinal()== Cardinal.WEST) {
image = new Image("file:resources/leftWall.png"); image = new Image("/images/rightWall.png"); // TODO: 03/12/2021 a replace par leftWall
}else if(((Wall)object).getCardinal()== Cardinal.NORTH_EAST) { }else if(((Wall)object).getCardinal()== Cardinal.NORTH_EAST) {
image = new Image("file:resources/topRightWall.png"); image = new Image("/images/topRightWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.NORTH_WEST) { }else if(((Wall)object).getCardinal()== Cardinal.NORTH_WEST) {
image = new Image("file:resources/topLeftWall.png"); image = new Image("/images/topLeftWall.png");
}else if(((Wall)object).getCardinal()== Cardinal.SOUTH_EAST) { }else if(((Wall)object).getCardinal()== Cardinal.SOUTH_EAST) {
image = new Image("file:resources/bottomRightWall.png"); image = new Image("/images/bottomRightWall.png");
}else{ }else{
image = new Image("file:resources/bottomLeftWall.png"); image = new Image("/images/bottomLeftWall.png");
} }
} }