Hello, can anyone help me with the little problem? In my game i have a function which shall count if where the 2 lines will cross. One line is defined by 2 points, another is defined by angle and one point. To make everything easier, i move everything in the way that second line point is (0, 0):
function linescollide(x0, y0, a, x11, y11, x22, y22, obj)
{
var x1 = x11 - x0;
var y1 = (y11 - y0);
var x2 = x22 - x0;
var y2 = (y22 - y0);
(First line was defined by 2 points: (x11, y11) and (x22, y22), second line was defined by a – angle and (x0, y0))
That way x0 and y0 will be zero. The function works, but y1 and y2 are counted wrong. I believe that i have to include stage height somehow. So:
1)What is the proper way to count y1 and y2?
2)Is there easier way to count if where 2 lines will cross rather than using math?
3)Is there a way to flip Y direction(so Y will not go from stage top to bottom, but from bottom to top)?