i didnt learn sin cos tan yet in school so i need the help of some of you who did. id like to find the angle between 2 objects, the results being the angle relative to one object going to the other, so lets say an explosion goes off at point a, and whatever is being affected is at point b, id like to know at what angle would point A be facing to be looking right at point b. so i can calculate which way to throw point.b

basically i want the function for that (example: A^2+B^2=C^2 for the distance formula)

i know thats what sin,cos, and wtv is for but i havnt got there yet im only 13. so plz help

i mean in actual construct bearings, not protracter style measurements, and isnt what he wants different entirely, i think he meant 3 point to describe he dint want bearings. altho i dont knwo why cheez needed those anyways,

its quite complicated, that angle function is a lifesaver.

If you haven't learnt trig yet its probably no use proving a formula to you.

the actual formula is arctan((y2-y1)/(x2-x1)) but it's made more complicated by getting a sign error in different quadrants, so this formula makes it really nice.

well, i get it, just u know i dont know the across under ect ect, all i really wanted to know is the formula "arctan((y2-y1)/(x2-x1))" as even tho i dont get what it does completely i can still use it for other things where i might need it, wikipedia makes all math look like freaken nuclear science

and god, i really hate different quadrants, while i was programming a swinging pendulum for mmf2 using pythos to draw a cricle path based on radius i had to calculate for weird changes which happen when quadrants are changed its hard to explain tho

Yeah, atan will only give results over a range of angles (I forget, either just 0-90 or 0-180) which is kind of inconvenient if you want to measure an angle which is actually 270 degrees. Still, the C++ runtime library has a function called 'atan2' which works out the quadrants for you, which is what Construct uses. If you ever need atan2 for something else, I think angle(x, y, 0, 0) is equivalent to atan2(y, x). But the x,y and 0,0 might be the other way round. Can't remember.

Yeah, atan will only give results over a range of angles (I forget, either just 0-90 or 0-180) which is kind of inconvenient if you want to measure an angle which is actually 270 degrees. Still, the C++ runtime library has a function called 'atan2' which works out the quadrants for you, which is what Construct uses. If you ever need atan2 for something else, I think angle(x, y, 0, 0) is equivalent to atan2(y, x). But the x,y and 0,0 might be the other way round. Can't remember.

Other way around: angle(0, 0, x, y)

Old post I know, but was searching for atan2 and found this. Thanks!

> Old post I know, but was searching for atan2 and found this. Thanks!

>

.... and also for the - now retired - Construct Classic. Bit of a pointless 8 year old thread bump, I'd say.

Didn't realize it was on a Construct Classic forum—found directly from Google search.

Is there a better way to get an angle from x y coordinates? Used sin & cos to store values in variables in previous functions.

It helped me solve my problem and the search didn't turn up any other relevant results. If it can still help answer people's questions what does it matter how old it is?

Haha kinda funny to see such an old thread. Yeah, so I got the angle expression wrong in 2008. I do apologise. Hopefully I got it right for the last eight years instead XD

Haha kinda funny to see such an old thread. Yeah, so I got the angle expression wrong in 2008. I do apologise. Hopefully I got it right for the last eight years instead XD

It is still kind of wonked... fortunately the angle to position method on the TiledBackground seems to work much better.