[Flashcoders] trig? calculus? put me out my misery

2007-03-12 Thread Kurt Dommermuth
Hi all, I have what I initially thought was simple problem, but I've been racking my brains, searching the web and I just don't get it. I have a movieclip that the user can rotate . When they click the movieclip shoots off in the direction it's pointing. It's goes off the stage and simply

RE: [Flashcoders] trig? calculus? put me out my misery

2007-03-12 Thread Steve Abaffy
to calculate the motion in question. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kurt Dommermuth Sent: Monday, March 12, 2007 1:30 PM To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] trig? calculus? put me out my misery Hi all, I have what I

Re: [Flashcoders] trig? calculus? put me out my misery

2007-03-12 Thread ben gomez farrell
Its trig, no calculus. Basically you want a point off stage that the clip would pass through because it's pointing in that direction right? Are you using the tween classes? If so you'll probably need a X,Y coordinate. If not, you could simply move your MC at the correct angle and use the

Re: [Flashcoders] trig? calculus? put me out my misery

2007-03-12 Thread Kurt Dommermuth
Thank you all. My assistant actually pointed out a very simple way to accomplish what I wanted to do. He suggested just adding another mc called targ off the stage. targ rotates with the projectile I'm firing. when the user clicks I just tell the projectile to go to the target mc. It

Re: [Flashcoders] trig? calculus? put me out my misery

2007-03-12 Thread Charles Parcell
Some simple Trig actually. As an example, name a movieClip myClip and rotate it. Then add this code to the frame. this.onEnterFrame = function(){ rads = myClip._rotation * (Math.PI/180); myClip._x += Math.sin(rads); myClip._y -= Math.cos(rads); } That should get you started. By the

Re: [Flashcoders] trig? calculus? put me out my misery

2007-03-12 Thread Joshua Sera
Here's the vector math solution: Get the vector from the mouse to the MC: var vToMouse:flash.geom.Point = new flash.geom.Point(); vToMouse.x = MC._parent._xmouse - MC._x; vToMouse.y = MC._parent._ymouse - MC._y; Normalize the vector. This means you set the length of the vector to 1. var