|
-
Feb 1st, 2012, 02:39 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] A little maths help... determine angle to face
Hey,
I'm working on my own project at the moment, it's a tower defence game. I want to rotate a tower to face an enemy and I'm having a little trouble figuring it out.
What I need to know is how to get the real x and real y of the enemy. Let's say the tower is at x 200, y 200, and the monster at x 300, y 50, which would put the monster above and to the right of the tower, how exactly do I determine the real value of the monster from those coordinates?
Code:
float realX = ...
float realY = ...
float radians = atanf(realY / realX);
Would appreciate any help, thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|