Tutorial on Creating Following Objects.

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
1 Response to "Tutorial on Creating Following Objects." 
|
said this on 19 Sep 2007 1:04:54 PM CDT
Trailing portion does not work in Flash 8
|



Author/Admin)