Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Getting the direction between two positions
- cubegames13
- Scratcher
2 posts
Getting the direction between two positions
For a project I'm working on I need to find the direction between two points. Neither of these two points are the position of the sprite and one of them may be outside of the screen.
Does anyone know how to do this?
Does anyone know how to do this?
- footsocktoe
- Scratcher
1000+ posts
Getting the direction between two positions
In case that was not clear, it's this block
If one point is at the origin, then the tangent is the ratio of x to y for the other point's position.
From WIKI…
tan
“tan” is the abbreviation for “tangent.” The tangent of an angle is the ratio between the length of the side adjacent to it and the side opposite of it. In the picture above, the tangent of angle A is equal to side “opposite” divided by side “adjacent”.
asin, acos, and atan
asin, acos, and atan are “inverse trigonometric functions.” While sin, tan, and cos find the ratios from the angles, asin, acos, and atan find the angles, in degrees, from the ratios.
([atan v] of ())
If one point is at the origin, then the tangent is the ratio of x to y for the other point's position.
From WIKI…
tan
“tan” is the abbreviation for “tangent.” The tangent of an angle is the ratio between the length of the side adjacent to it and the side opposite of it. In the picture above, the tangent of angle A is equal to side “opposite” divided by side “adjacent”.
asin, acos, and atan
asin, acos, and atan are “inverse trigonometric functions.” While sin, tan, and cos find the ratios from the angles, asin, acos, and atan find the angles, in degrees, from the ratios.
SHOOT THE SPACE MONSTERS! ….. A game everyone can play! Bright colors, bonky sounds!
THE 12 BALLS OF CRAZY AL ……. New scrolling adventure game!
- Discussion Forums
- » Help with Scripts
- » Getting the direction between two positions