-fill campagne autoroute
This commit is contained in:
42
src/linea/FondAutoroute.java
Normal file
42
src/linea/FondAutoroute.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package linea;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
public class FondAutoroute extends ObjetGraphique {
|
||||
|
||||
private double decalage = 0;
|
||||
|
||||
public FondAutoroute() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
void Afficher(Graphics g) {
|
||||
// Ciel de nuit urbaine
|
||||
g.setColor(new Color(20, 20, 45));
|
||||
g.fillRect(0, 0, 800, 50);
|
||||
|
||||
// Asphalte de l'autoroute en bas
|
||||
g.setColor(new Color(30, 30, 30));
|
||||
g.fillRect(0, 50, 800, 500);
|
||||
|
||||
// Lignes de séparation de voie qui défilent
|
||||
g.setColor(Color.YELLOW);
|
||||
for(int i = 0; i < 900; i += 120) {
|
||||
for(int j = 0; j < 500; j+=167) {
|
||||
g.fillRect(i - (int)decalage, 117+j, 60, 10);
|
||||
}
|
||||
}
|
||||
g.setColor(new Color(20, 20, 45));
|
||||
g.fillRect(0, 550, 800, 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
void Animer() {
|
||||
decalage += 5.0;
|
||||
if (decalage >= 120) {
|
||||
decalage = 0; // Boucle infinie
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user