Hello,
i’ve spend the last night reading examples from the lwjgl wiki, and getting started wasn’t so hard like i thought ;D
soooo i decided to make a simple pong and actually it was very easy to do, and now am trying to make a “Brick Breaker” game, and to make it happens, i need a collision detection method, for now i just want to recreate the Java2D intersects method,
and here is the way am doing it, it still doesn’t work
calculate the distance between the 2 rectangle
float dx = x - x2;
float dy = y - y2;
double dxy = Math.sqrt((dx * dx) + (dy * dy));
the white line represent the distance
http://s14.postimg.org/xqhltp9z5/Capture.png
after that, i thought that if the length of that line is less than the rectangle width, then there is a collision,
i tried it, it works, but only when the collision is from the sides and the rectangle have the same width .
so i thought maybe i’ll need the sum of the 2 rectangles diagonals
double diago1 = Math.sqrt(w*w+h*h);
double diago2 = Math.sqrt(w2*w2+h2*h2);
double diagSum = diago1/2 + diago2/2 ;
and the result was better than the previous one but still didn’t work,
sooooo guys :persecutioncomplex:
any help : ??