ligne qui bouge

This commit is contained in:
B00M360
2026-02-10 16:24:44 +01:00
parent c8dc7a4038
commit 28b64db07a
3 changed files with 14 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ public class Ligne extends ObjetGraphique {
protected ArrayList<Segment> listeSegments = new ArrayList<Segment>();
public Ligne(){
double x = 800;
double x = 0;
double y = 200;
double dx,dy;
@@ -40,6 +40,18 @@ public class Ligne extends ObjetGraphique {
for(Segment s : listeSegments) {
s.Afficher(g);
if(SegCourant==null){
if(xCercle<s.x + s.xLong && xCercle>s.x){
SegCourant=s;
}
}
else{
if((SegCourant.x + SegCourant.xLong)<xCercle){
if(s.x<=xCercle && (s.xLong)>=xCercle){
SegCourant=s;
}
}
}
}
}
@@ -47,6 +59,7 @@ public class Ligne extends ObjetGraphique {
public void Animer() {
for(Segment s : listeSegments) {
s.Animer();
s.x -= 10;
}
}
}