Getting back to this approach:
You don’t need to mess with screen size to compare which quadrant a point is in.
Given point (x,y)
and the center of your center frame being (0,0)
:
if x > 0 and y > 0 then
--Q1
elseif x < 0 and y > 0 then
--Q2
elseif x < 0 and y < 0 then
--Q3
elseif x > 0 and y < 0 then
--Q4
end
Replace <
and >
with <=
and >=
depending on which case you want to happen on which edge. To have the inner frame as the origin, do (x,y):=(x2-x1,y2-x1)
where (x2,y2)
is the inner frame and (x1,y2)
is the outer frame.
My code for angles solution:
local f1 = gui.Frame1
local f2 = gui.Frame2
while wait() do
print(-math.deg(math.atan2(f2.AbsolutePosition.X - f1.AbsolutePosition.X, f2.AbsolutePosition.Y - f1.AbsolutePosition.Y) - math.pi))
end