Tutorial on Creating Following Objects.
This article has been added to your 'Favorites' list.

Lesson 3 : Following other objects .
Change the instance name of first movie to ball_mc and instance of second movie to ball2_mc .
Click on the first movie clip and press F9 and insert the following code;
Code on first movie clip
onClipEvent(enterFrame){
diffx = _root._xmouse - this._x ;
diffy = _root._ymouse - this._y ;
_x += diffx/5 ;
_y += diffy/5 ;
}
Code on second movie clip
onClipEvent(enterFrame){
diffx = _root.ball_mc._x - this._x ;
diffy = _root.ball_mc._y - this._y ;
_x += diffx/5 ;
_y += diffy/5 ;
}
Explanation of second movie clip actionscript code :
diffx = _root.ball_mc._x - this._x ;
diffy = _root.ball_mc._y - this._y ;
Assigns diffx & diffy , the diffrence of ball_mc's and ball2_mc's x & y coordinates respectively .
Final :
You can freely experiment and create ur own effects .....
Spread The Word
7 Responses to "Tutorial on Creating Following Objects." 
|
said this on 19 Sep 2007 1:04:54 PM CST
Trailing portion does not
|
|
said this on 04 May 2009 12:27:12 PM CST
marvellous, just what i w
|
|
said this on 31 Jul 2009 12:03:16 PM CST
great! I need this :D tha
|
|
said this on 03 Feb 2010 7:08:26 PM CST
i have tried this in flas
|
|
said this on 04 Feb 2010 12:47:28 AM CST
The above tutorial is wri
// Change t var easin // MOUSE FO var ball = ball.g ball. ball.graphics.dr ba // D var dra drawCanvas.graphics.l drawCanvas.grap addChild( drawCan ball.addEvent function { var difX = this.m var dif ball.x += difX / ea ball.y += difY drawCa } |
|
said this on 06 Jun 2010 1:11:50 AM CST
This is a GREAT tutorial
I have one question I was |


Author/Admin)