Atan2() function for ActionScript 2.0
Uploader Comments (knvb1123)
All Comments (24)
-
Thanks !!!
-
Oh and by the way, I suck at programming so please be gentle! Lol!
-
Hi there, how can I convert actionscript 2.0 to actionsript 3.0? I´ve tried changing it using flash decompiler eltima but I can't see the option to do so. Can you please give me some headlights?
-
atan2 is a function which takes parameters x and y and returns an angle in radians.
Basically if you know the x distance and y distance between 2 things, you put them into atan2 and it gives you the angle that 1 thing would need to turn to face the other. Useful for making things look/point at other things or shoot at them.
Radians are a unit of angle (like degrees). To convert radians to degrees, multiply your radians by 180/pi.
-
I wish you'd have gone more in-depth. Perhaps you could have explained what exactly atan2 is, what a radian is for those who don't know, etc.
-
really helpful......
thanks...
-
I got a little confused when you yourself were getting confused, but overall this was really helpful. Thank you! :]
-
Do you know hot to make a movieclip when is being in hitTest to play a sound???
I tryed this: if(_root.mpla.hitTest(this)){l
oad(Sound)} but didn't worked.. Do you know the code for playing sounds?
-
To avoid it automatically pointing at the cursor you need to offset the rotation with the starting angle so that the object doesn't jump to the angle of the mouse location.
So, if the object is at a rotation of 15 degrees already, you need to subtract the difference between the mouse angle and the original rotation angle e.g. mouse is at 90 degrees, offset by (90 - 15) 75.
90 - 75 = 15
If you then move the mouse to 95 degrees, the object is rotated to an angle of 20 degrees.
No problem
knvb1123 4 years ago
no comprendo.
yo no hablo español
Gracias
knvb1123 4 years ago
it seemed at parts like you hadnt thought the whole thing through but it was very useful and informative and good topic. i was jes wonderin' howd yall learnt this?
Taersier 4 years ago
Yes. Indeed, it was my first tutorial and I really didn't know how to make these. But thanks so much for these complements! I hope to get bettere at creating tutorials over this summer. Thanks!
And how did i know this? Well if a 14 year old "nerd" gets stuck with a computer, he's got to do something... :D
knvb1123 4 years ago
Hello.
This is the person who made the tutorial...
Thanks for your reply!
This is my first tutorial... You can tell!
And sorry for not showing the cursor, I was not aware of it until I was done...
Just make sure you have all the AS down right and have centered BOTH vertically and horizontally of the arrow.
Thanks
Keehun Nam
knvb1123 5 years ago