collisions, cercle reste dans ligne
This commit is contained in:
@@ -52,12 +52,12 @@ public class Ligne extends ObjetGraphique {
|
||||
for (Segment s : listeSegments) {
|
||||
s.Afficher(g);
|
||||
if (SegCourant == null) {
|
||||
if (xCercle < s.x + s.xLong && xCercle > s.x) {
|
||||
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) {
|
||||
if (s.x <= xCercle && (s.x + s.xLong) >= xCercle) {
|
||||
SegCourant = s;
|
||||
}
|
||||
}
|
||||
@@ -72,4 +72,10 @@ public class Ligne extends ObjetGraphique {
|
||||
s.x -= 10;
|
||||
}
|
||||
}
|
||||
|
||||
public double GetHauteurPointCercle(){
|
||||
double t = (400 - SegCourant.x) / SegCourant.xLong;
|
||||
|
||||
return SegCourant.y + SegCourant.yLong * t;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user