This commit is contained in:
Simoes Lukas
2025-03-27 13:35:54 +01:00
parent 376861b608
commit fe693705bf
90 changed files with 1188 additions and 24 deletions

View File

@@ -0,0 +1,35 @@
import java.awt.*;
public class GestionGrille {
private int[][] grille;
private Point[] coordsTrainee;
private Point coordJoueur;
public GestionGrille(Point[] coordsTrainee, Point coordJoueur) {
for (int i = 0; i != 10; i++) {
for (int j = 0; j != 10; j++) {
this.grille[i][j] = 0;
}
}
this.coordsTrainee = coordsTrainee;
this.coordJoueur = coordJoueur;
}
public boolean deplacementPossible(Point destination) {
if (this.coordJoueur.getX() == destination.getX()
&& this.coordJoueur.getY() == destination.getY()-1) {
return true;
}
else if (this.coordJoueur.getX() == destination.getX()
&& this.coordJoueur.getY() == destination.getY()+1) {
return true;
}
else if (this.coordJoueur.getX() == destination.getX()+1
&& this.coordJoueur.getY() == destination.getY()) {
return true;
}
return false;
}
}