PDA

View Full Version : moving a ball (complex!)



javadi82
July 17th, 2003, 01:39 AM
There are two stationary balls-ball A and ball B. There is another ball- ball C, which has to move from ballA to ballB.

The problem is that when the I "run" the movie, ball C is automatically placed at the position of ballB. That is, I do not see ball C moving from the position of ball A to the position of ball B.

I have used a line-drawing algorithm to move ball C. Also, the entire stuff is written in Actionscript.

PS:this._x++ and this._y++ will not work because ballC has to travel the exact path between the two balls

blah-de-blah
July 17th, 2003, 01:59 AM
I only see 2 balls...whhere or wat color is the third one?

javadi82
July 17th, 2003, 03:21 AM
ballA and ballB are of green color and the ballC is of red color.

you could look into the library.

Important:i want to see the ballC move from ballA to ballB.So I initially place ballC at ballA position and I wrote the actionscript to move ballC to ballB but when I run the script, I see ballC at ballB.

many thanks for opening the .fla

radicaljugnu
July 17th, 2003, 06:43 AM
onClipEvent(enterFrame){
diffx=_root.ball2._x-_x
diffy=_root.ball2._y-_y
_x+=diffx/5
_y+=diffy/5
}

This will give it some easing also.

javadi82
July 17th, 2003, 07:21 AM
kartik, i am not looking for easing. btw are you an indian?