This commit is contained in:
2026-02-23 08:55:29 +01:00
parent cb3b3d0e35
commit dcd4cd3d07
3 changed files with 6 additions and 6 deletions

View File

@@ -12,7 +12,7 @@ public class CampagneAutoroute {
} }
public void lancerNiveau1() { public void lancerNiveau1() {
System.out.println("Lancement du niveau No Hesi..."); System.out.println("Lancement du niveau autoroute ...");
if(jeu.horloge != null) { if(jeu.horloge != null) {

View File

@@ -22,7 +22,7 @@ public class MenuCampagne extends JPanel {
JButton btnRetour = creerBouton("RETOUR"); JButton btnRetour = creerBouton("RETOUR");
btnC1.addActionListener(e -> System.out.println("Lancement Campagne 1...")); btnC1.addActionListener(e -> System.out.println("Lancement Campagne 1..."));
// Remplace le System.out.println par l'appel à ta nouvelle classe :
btnC2.addActionListener(e -> { btnC2.addActionListener(e -> {
CampagneAutoroute campagne = new CampagneAutoroute(jeu); CampagneAutoroute campagne = new CampagneAutoroute(jeu);
campagne.lancerNiveau1(); campagne.lancerNiveau1();

View File

@@ -6,7 +6,7 @@ import java.awt.Graphics;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.geom.Arc2D; import java.awt.geom.Arc2D;
public class Voiture extends Cercle { // Hérite de Cercle public class Voiture extends Cercle {
// On définit les couleurs directement ici pour simplifier // On définit les couleurs directement ici pour simplifier
private Color couleurArriere = Color.GRAY; private Color couleurArriere = Color.GRAY;
@@ -22,12 +22,12 @@ public class Voiture extends Cercle { // Hérite de Cercle
Graphics2D g2D = (Graphics2D) g; Graphics2D g2D = (Graphics2D) g;
g2D.setStroke(new BasicStroke(5.0f)); g2D.setStroke(new BasicStroke(5.0f));
// 1. DESSINER LE DEMI-CERCLE ARRIERE (Au fond) // DESSINER LE DEMI-CERCLE ARRIERE (Au fond)
g2D.setColor(couleurArriere); g2D.setColor(couleurArriere);
// Utilisation de rayon*2 pour la largeur et hauteur (cercle parfait) // Utilisation de rayon*2 pour la largeur et hauteur (cercle parfait)
g2D.draw(new Arc2D.Double(x - rayon, y - rayon, rayon * 2, rayon * 2, 90, 180, Arc2D.OPEN)); g2D.draw(new Arc2D.Double(x - rayon, y - rayon, rayon * 2, rayon * 2, 90, 180, Arc2D.OPEN));
// 2. DESSINER LA VOITURE (Au milieu) // DESSINER LA VOITURE (Au milieu)
g.setColor(new Color(150, 50, 200)); g.setColor(new Color(150, 50, 200));
g.fillRect((int)x - 20, (int)y - 5, 40, 12); g.fillRect((int)x - 20, (int)y - 5, 40, 12);
@@ -41,7 +41,7 @@ public class Voiture extends Cercle { // Hérite de Cercle
g.setColor(Color.YELLOW); g.setColor(Color.YELLOW);
g.fillOval((int)x + 15, (int)y - 2, 6, 6); g.fillOval((int)x + 15, (int)y - 2, 6, 6);
// 3. DESSINER LE DEMI-CERCLE AVANT (Par-dessus) // DESSINER LE DEMI-CERCLE AVANT (Par-dessus)
g2D.setColor(couleurAvant); g2D.setColor(couleurAvant);
g2D.draw(new Arc2D.Double(x - rayon, y - rayon, rayon * 2, rayon * 2, 90, -180, Arc2D.OPEN)); g2D.draw(new Arc2D.Double(x - rayon, y - rayon, rayon * 2, rayon * 2, 90, -180, Arc2D.OPEN));
} }