Basic trig
, i understand that your probably wanting to use slope detection. But the amount of maths is unreal. So i think this will be more beneficial…
Firstly, you may be thinking – why should i use it? Well you want your bullets to fire right? Or your fish to look where it’s going? Or even just make something rotate towards the mouse… All trig based…
Trigonometry is all about angles, triangles and circles:
Take a circle, it can be split in four quadrants.


An angle is a specific value between 1 and 360 expressed in degrees. On the diagram the green line represents 0 and 360 degrees. Trigonometry works in that with minor details about a triangle, you can work the rest out. But the triangle has to be 90 degrees.
In the below triangle you can see that there are 4 variables, the width, height the length and angle size. If we know any two pieces of information then we can figure out the other two by using…

r^2 = x^2 + y^2
sin(o) = y / r
cos(o) = x / r
tan(o) = y / x
In flash we use them as
Math.sin() Math.cos() and Math.tan()
Hopefully this short basic tutorial has enlightened you. Next we will find out how to use these functions.

