Forum

> > CS2D > Scripts > Angle counting
Forums overviewCS2D overview Scripts overviewLog in to reply

English Angle counting

2 replies
To the start Previous 1 Next To the start

old Angle counting

Danikah
User Off Offline

Quote
CAUTION! BAD ENGLISH AHEAD!

I just wanna know that how can I count what angle do I need to turn my image if I want it to face to a specific position.

So: Example:

x . . . . . . . .
. . . . . . . . y

And I want a little code that counts what angle do the x image need to turn to face to the y coordinate.

old Re: Angle counting

archmage
User Off Offline

Quote
Use this:
1
math.atan2(y2-y, x2-x) * 180.0/math.pi

Just replace x and y with you images position and replace x2 and y2 with the position you want the image to face.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview