Hey all sorry for the wait. This week has been really busy with all my projects and school. But here is the tutorial:
In this tutorial I will teach you how to build a basic slope engine. Please take note that this slope engine will NOT work on slopes with an angle greater than 90 degrees.
For this tutorial I will assume you know how to make a character move on flat ground in flash.
So before we begin you will need a bit of knowledge in trigonometry (I will refer to this as trig from now on). Trig is all about the realtionships between the angles and sides in a triangle. Thus using trig you are able to find the angle between sides of a triangle, or the length of the sides based on the angle. In order to do this, you use the trig functions: Sin, Cos and Tan.
So now for how they work:
(I will be referring to this pic in the example of how to use these functions)
Sorry But currently I cant get the image tag to work...This pic is called tut.jpg in the zip file you download below
See the (put in ascii for theta) in that picture? That symbol is called theta and refers to a certain angle in the trangle seen in the picture. theta can be placed in any angle in that triangle but for this example it I will be using the above angle.
The text SOH CAH TOA is how sin cos and tan work, and SOH CAH TOA is a little trick for remembering how they work. Here's what the letters mean:
S = Sin, C = Cos, T = Tan, O = Opposite, A = Adjacent, H = Hypotenuse
Opposite being the site opposite of the angle (side A), Adjacent being the side adjacent to the angle (side B), and the hypotenuse (side C)
Now that you know what the symbols mean this is how it works:
SOH : The Sin of the angle (theta) is equal to the Opposite side over the Hypotenuse. (Shown in the text below SOH CAH TOA)
CAH : The Cos of the angle (theta) is equal to the Adjacent side over the Hypotenuse. (Shown in the text below SOH CAH TOA)
TOA : The Tan of the angle (theta) is equal to the Opposite side over the Adjacent side. (Shown in the text below SOH CAH TOA)
This is the minimum knowledge about trig you need to know for this tut. Thanks for hanging in there with me! Now for making our character move on slopes!!!
So here's our strategy in this. Now that we know how to find an angle between any side in a triangle, if we have one point above the character and one point as the middle of the character, we can find the angle of the slope. Check out the pic for a visual explanation
Sorry But currently I cant get the image tag to work...This pic is called tut-pic2.jpg in the zip file you download below
The rest of the tutorial is written inside the FLA file!
Hope you guys enjoy! Any comments, suggestions and corrections are much appreciated!
-Fox



