clear
This commit is contained in:
@@ -6,7 +6,7 @@ import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
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
|
||||
private Color couleurArriere = Color.GRAY;
|
||||
@@ -22,12 +22,12 @@ public class Voiture extends Cercle { // Hérite de Cercle
|
||||
Graphics2D g2D = (Graphics2D) g;
|
||||
g2D.setStroke(new BasicStroke(5.0f));
|
||||
|
||||
// 1. DESSINER LE DEMI-CERCLE ARRIERE (Au fond)
|
||||
// DESSINER LE DEMI-CERCLE ARRIERE (Au fond)
|
||||
g2D.setColor(couleurArriere);
|
||||
// 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));
|
||||
|
||||
// 2. DESSINER LA VOITURE (Au milieu)
|
||||
// DESSINER LA VOITURE (Au milieu)
|
||||
g.setColor(new Color(150, 50, 200));
|
||||
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.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.draw(new Arc2D.Double(x - rayon, y - rayon, rayon * 2, rayon * 2, 90, -180, Arc2D.OPEN));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user