So, over to some new... I found a way to do it, my uncle(he's been doing some coding too
) told me..
Explaining it simple with pictures...(Don't worry, it will contain Cos and Sin...)
It will be hard to make, but thats the theory... And annikk, the tutorials sucks :/ Why don't you explain(I 've learnt almost everything from you
EDIT: Or maybe a simplier version:
You have a line for the unit that search, the line will be as long as the distance between the two units(Pythagoras Theorem) and then when that lines end is close to the coords of the unit it search for, it will say that THIS is the angle... That makes it all much more simplier, I can even see the code in my head(literally D:)...
EDIT 2: It works, not totally propperly, because it isn't recognizing it in some areas... but it works!
local XDIFF = (x1-x2)^2
local YDIFF = (y1-y2)^2
local Distance = math.abs(math.sqrt(XDIFF+YDIFF))
for i = 1,360 do
local CurAngle = (i/360)*(math.pi*2)
if x1 + math.cos(CurAngle)*Distance >= x2-Distance/(math.pi*2) and x1 + math.cos(CurAngle)*Distance <= x2+Distance/(math.pi*2) and y1 + math.sin(CurAngle)*Distance >= y2-Distance/(math.pi*2) and y1 + math.sin(CurAngle)*Distance <= y2+Distance/(math.pi*2) then
if i == 360 then
Yeah, I know it is very resource consumpting, but you can remove that by making some if's and stuff to check if the angle has been changed(or simply if the unit is a target and the x/y coords are changed