Search Tutorials
Theory Skip this if you want... The basic concept is that the mouse angle will fall into 1 of the 4 quadrants, they are: 0 - 90 (right and down) +x +y 90 - 180 (left and down) -x +y 180 - 270 (left and up) -x -y 270 - 360 (right and up) +x -y The "mouse coordinate" is the "coordinate of the mouse" minus the "coordinate of the origin" The angle is then APPROXIMATED using a simple algorithm. The algorithm will not be explained as approximations never really make "sense" - just look at the code. The movement for a bullet from the origin to the mouse is calculated EXACTLY. So for the purpose of games this is usually ok.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|