ligne qui bouge
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -15,7 +15,7 @@ public class Ligne extends ObjetGraphique {
|
|||||||
protected ArrayList<Segment> listeSegments = new ArrayList<Segment>();
|
protected ArrayList<Segment> listeSegments = new ArrayList<Segment>();
|
||||||
|
|
||||||
public Ligne(){
|
public Ligne(){
|
||||||
double x = 800;
|
double x = 0;
|
||||||
double y = 200;
|
double y = 200;
|
||||||
double dx,dy;
|
double dx,dy;
|
||||||
|
|
||||||
@@ -40,6 +40,18 @@ public class Ligne extends ObjetGraphique {
|
|||||||
|
|
||||||
for(Segment s : listeSegments) {
|
for(Segment s : listeSegments) {
|
||||||
s.Afficher(g);
|
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() {
|
public void Animer() {
|
||||||
for(Segment s : listeSegments) {
|
for(Segment s : listeSegments) {
|
||||||
s.Animer();
|
s.Animer();
|
||||||
|
s.x -= 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user