Make your own free website on Tripod.com

To achieve the 3D 2D effect, the rectangle upon which the mech is drawn must always face the player. This is simple to do. Simply state the rotation of the rectangle as the absolute rotation of the player.
Using the Atan() function, the degree between the player and the mech can be found from the measure, instead of the measure from the degree.

Depending on the quadrant the player is in, the following equations determine the angle of the mech to the player (mechtheta)
MechTheta = (Atn(Mech1Ydiff / Mech1Xdiff)) * (180 / PI)
MechTheta = 360 + (Atn(Mech1Ydiff / Mech1Xdiff)) * (180 / PI)
MechTheta = 180 + (Atn(Mech1Ydiff / Mech1Xdiff)) * (180 / PI)
MechTheta = 180 + (Atn(Mech1Ydiff / Mech1Xdiff)) * (180 / PI)

The resultant Theta number will be from 1 to 360. Since I have 36 frames of animation, the number is divided by ten and rounded to the nearest integer to find the animation frame it needs to draw.