 » Home » Movies » Tutorials » Submissions » Sound FX » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops First time here? Newsletter   Tutorials Home What's New Top Rated Submit
Search tutorials
Author: Joran420
OK so you have two distinct points and you want some basic info about them lets call them

#### StartPoint

(x = 0 , y = 0), and

#### EndPoint

(x = 20 , y = -15) (I know what original names!) To start with is your first leason(from me in trig

### any two points can be connected to form 2 points on a right triangle.

so lets look at our right triangle(I just used some right triangle i found origianly with google images all credit goes to regentsprep.org) http://regentsprep.org/Regents/math/rtritrig/tri3.jpg

#### StartPoint(0,0)

is represented by Point B in the Picture

#### EndPoint(20,-15)

is represented by point A in the picture x would be the angle from A to B next lesson about a key concept in trig

### any right triangle can be solved as long as you have 2 sides.

the Slanted line is the Hypotinus (sp? )(edge BA)is the distance of B to A the BC edge is the OPPOSITE EDGE of the angle were trying to find the AC edge is the ADJACENT Edge of our angle Any Angle in a right Triangle can be found usining Angle =tangent(Opposite/Adjacent) now were gonna need to figure out how long opposite and adjacent sides are Distance = SquareRoot((x1 -x2)^2 + (y1-y2)^2) the two points we know Start(0,0) End(20,-15) are points A and C so DistanceOpposite = Math.sqrt((Start.x -Start.x)^2 +(Start.y - End.y)^2) DistanceOpposite = Math.sqrt((0 -0)^2 +(0 - -15)^2) DistanceOpposite = Math.sqrt((0)^2 +(15)^2) DistanceOpposite = Math.sqrt((0*0)+(15*15)) DistanceOpposite = Math.sqrt(225) DistanceOpposite = 15 DistanceAdjacent = Math.sqrt((Start.x -End.x)^2 +(End.y - End.y)^2) DistanceAdjacent = Math.sqrt((0-20)^2 +((-15)-(-15))^2) DistanceAdjacent = Math.sqrt((-20)^2 +(0)^2) DistanceAdjacent = Math.sqrt((-20*-20) +(0*0)) DistanceAdjacent = Math.sqrt(400 +0) DistanceAdjacent = Math.sqrt(400) DistanceAdjacent = 20 so now we go back to our angle formula Angle =tangent(Opposite/Adjacent) Angle = Math.atan2(Opposite/Adjacent) Angle = Math.atan2(15/20) Angle = Math.atan2(0.75) Angle = (about ) 37 degrees  actually i think on the atan2 Math function it devides it for you so it would be Math.atan2(Opposite,Adjacent) not Math.atan2(Opposite/Adjacent) Hopefully this helped i think all my math is right but if im wrong on anything im sure someone will correct it just remember flash when setting points tends to use radians rather than degrees radians = (Math.PI*degrees)/180 degrees = 180 /(Math.PI*radians) Ok if this didnt help...Q_Hybrid posted the following function for Actionscript here on Flashkit a while ago
 » Level Intermediate Added: 2006-04-27 Rating: 1.5 Votes: 2 1 2 3 4 5 6 7 8 9 10 (10 being the highest) » Author Just learned it for a program i was writing...figured id share...Someone on kirupa asked how to figure out an angle i answered with this..thought some ppl might find it useful » Download Download the files used in this tutorial. Download (0 kb) » Forums More help? Search our boards for quick answers!

## Comments

• There are no comments yet. Be the first to comment!

• You must have javascript enabled in order to post comments.

Leave a Comment
• Your email address will not be published. All fields are required.   Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.