correction classe Sortie

This commit is contained in:
Amaury 2023-05-01 18:04:15 +02:00
parent 27a8d8a25c
commit f6ef34ec49
7 changed files with 34 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
</attributes>

View File

@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@ -11,4 +11,4 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -69,7 +69,7 @@ public class ControleurJoueur {
indiceZombie = ControleurZombie.estProcheJoueur(indiceZombie, CJ.getZombies(), CJ.getJoueur()) + 1;
}
// on verifie si le joueur est sur la case de sortie
if (CJ.getSortie() != null && CJ.getJoueur().getjPositionX() == CJ.getSortie().sortieX() && CJ.getJoueur().getjPositionY() == CJ.getSortie().sortieY()) {
if (CJ.getSortie() != null && CJ.getJoueur().getjPositionX() == CJ.getSortie().getSortieX() && CJ.getJoueur().getjPositionY() == CJ.getSortie().getSortieY()) {
// on met à jour le score du joueur
CJ.getJoueur().setNbrPoints(CJ.getJoueur().getNbrPoints() + Joueur.POINTS_SORTIE);
// on met à jour le label du score

View File

@ -1,4 +1,31 @@
package model; // package declaration
public record Sortie(int sortieX, int sortieY) {
import java.util.Random;
public class Sortie {
private int sortieX;
private int sortieY;
public Sortie(int sortieX, int sortieY) {
this.sortieX = sortieX;
this.sortieY = sortieY;
}
// get/set sortieX
public int getSortieX() {
return sortieX;
}
public void setSortieX(int sortieX) {
this.sortieX = sortieX;
}
// get/set sortieY
public int getSortieY() {
return sortieY;
}
public void setSortieY(int sortieY) {
this.sortieY = sortieY;
}
}

View File

@ -3,13 +3,10 @@ package vue;
import model.Plateau;
import java.awt.*;
import java.io.Serial;
import javax.swing.*;
public class JPanelDessin extends JPanel {
@Serial
private static final long serialVersionUID = -4704888296894874299L;
public JPanelDessin() {

View File

@ -9,12 +9,10 @@ import javax.imageio.ImageIO;
import javax.swing.JPanel;
import java.awt.image.BufferedImage;
import java.io.Serial;
public class JPanelImage extends JPanel {
// Classe pour afficher une image dans un JPanel : fond de la fenetre de jeu
@Serial
private static final long serialVersionUID = 3641337531772753865L;
private String sNomImage;
private BufferedImage image=null;

View File

@ -11,15 +11,12 @@ import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionListener;
import java.io.Serial;
import java.util.Objects;
public class MaJFrame extends JFrame {
private ControleurJeu controleurJeu;
@Serial
private static final long serialVersionUID = 7252959164975426293L;
private final JLabel lblZombicide;
private final JLabel lblScore;