ligne qui bouge
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user