Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,531 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,808 people online right now. Registration is fast and FREE... Join Now!




Mc follow mc?

 
Reply to this topicStart new topic

Mc follow mc?

cadeownz
8 Aug, 2008 - 02:45 PM
Post #1

New D.I.C Head
*

Joined: 11 Jul, 2008
Posts: 31

Hey,
i have a code that makes an mc point towards my mouse but i was wondering if it was possible to make it point or move towards another mc?
Code...
CODE
onClipEvent (mouseMove) {
    x=this._xmouse;
    y=this._ymouse*-1;
    angle = Math.atan(y/x)/(Math.PI/180);
    if(x<0){angle+=180}
    if(x>=0&&y<0){angle+=360}
    _root.angletext=angle;
    _root.arrow._rotation=angle*-1;
    updateAfterEvent();}

Plz help
thanks in advance..
tongue.gif smile.gif biggrin.gif smile.gif blink.gif icon_up.gif icon_up.gif icon_up.gif smile.gif smile.gif biggrin.gif biggrin.gif smile.gif smile.gif cool.gif cool.gif pirate.gif pirate.gif ph34r.gif ph34r.gif biggrin.gif biggrin.gif biggrin.gif smile.gif smile.gif
User is offlineProfile CardPM
+Quote Post

BetaWar
RE: Mc Follow Mc?
8 Aug, 2008 - 08:28 PM
Post #2

#include <soul.h>
Group Icon

Joined: 7 Sep, 2006
Posts: 2,026



Thanked: 82 times
Dream Kudos: 1175
My Contributions
Ya, just change out this._(x/y)mouse for _root.MOVIECLIPNAME and it should work the same way (as if the mouse were the movieclip, without makuing the mouse the movieclip)

Hope that helps.
User is offlineProfile CardPM
+Quote Post

cadeownz
RE: Mc Follow Mc?
13 Aug, 2008 - 04:29 PM
Post #3

New D.I.C Head
*

Joined: 11 Jul, 2008
Posts: 31

Hey,
(sorry for late reply biggrin.gif )
i tryed that so now i have the movieclip with the code and the bow with an instance name of "arrow" and i have my character called "character". in the movieclip with the actions i have this..
CODE
onClipEvent (mouseMove) {
    x=_root.character;
    y=_root.character*-1;
    angle = Math.atan(y/x)/(Math.PI/180);
    if(x<0){angle+=180}
    if(x>=0&&y<0){angle+=360}
    _root.angletext=angle;
    _root.arrow._rotation=angle*-1;
    updateAfterEvent();}

still no luck nothing happens..?
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 10:03PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month