|
-
[Help] Rotation Problem
Hey everyone.
Its not so much a problem as it is not knowing how or where to begin. I was just messing around with Flash and thought of a cool game idea, rather simple, but a cool one either way.
Anyways, attached with this post is my Fla. In it contains a triangle and a box in the bottom right corner. Click on the mini-box contained inside the bigger one and move it around.
As you move it around, the triangle moves around the screen.
The next step is to rotate the triangle in the proper direction as you move the box around.
If someone could please throw me in the right direction, I would be very appreciative.
Thanks
Last edited by Osteel; 05-01-2009 at 02:38 AM.
-
ok, to point an object at something i think you have to use atan2:
code:
//c1 would be the position last frame and
//c2 would be the new position for the triangle
dx = (c1.x-c2.x);
dy = -1*(c1.y-c2.y);
Radians = Math.atan2(dx, dy);
Degrees = (360*Radians)/(2*Math.PI);
rotation = degrees;
i couldnt use your flash but from what your post says i think this should help...
Last edited by ck_drknes; 04-06-2006 at 06:57 PM.
-
Great, Ill give it a try once Im at my work computer!
Thanks
-
Great it does exactly what I wanted. Many thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|