Commit 4714b764 authored by Benjamin LEROUX's avatar Benjamin LEROUX

last COMMIT

parent 035fb89e
......@@ -291,8 +291,8 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
boolean sontEnCollision(ImageView firstView, ImageView secondView) {
int [] firstPosition = new int[2];
int [] secondPosition = new int[2];
firstView .getLocationOnScreen(firstPosition);
secondView.getLocationOnScreen(secondPosition);
......@@ -301,10 +301,6 @@ public class MainActivity extends AppCompatActivity implements SensorEventListen
Rect rectSecondView = new Rect(secondPosition[0], secondPosition[1],
secondPosition[0] + secondView.getMeasuredWidth(), secondPosition[1] + secondView.getMeasuredHeight());
float x_inter = Math.max(0, Math.min(rectFirstView.right, rectSecondView.right) - Math.max(rectFirstView.left, rectSecondView.left));
float y_inter = Math.max(0, Math.min(rectFirstView.bottom, rectSecondView.bottom) - Math.max(rectFirstView.top, rectSecondView.top));
float aireInter = x_inter * y_inter;
return(rectFirstView. intersect (rectSecondView));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment