INTRO: First off, I got this from the topic "swingy thingy". Thanks to sk8more, this can be done.
WHAT: Well, this concept is like a rubber band. When you move your mouse the ball slings itself at the direction to move it to. The strind is connected to the ball, and the string is the thing that acts like a rubberband.
WHY: You can use this in multible ways. I'm using this to make a game. It'll come out soon.
Example: here
Tutorial:
First, make a ball. This ball can be anything you want it to be, because this is what is being "bungied". Press F8. Make it a movieclip and name it "ball". Now, go to the properties and give it an instance name of "ball". No quotes.
Press F9 and copy this code in:
onClipEvent (load) {
inertia =.9;
ki = 0.1;
x1 =33
y1 =33
}
onClipEvent (enterFrame) {
x = -_x+_root._xmouse;
y = -_y+_root._ymouse;
x1 = x1*inertia+x*ki;
y1 = y1*inertia+y*ki;
_x += x1;
_y += y1;
}
This code is simply giving it it's physical properties. The mouse moves, the ball moves at a faster pace. When it's at it's max length, it slows down. Then, comes back. This gives it a rubber band characteristic.
Now on the very frame where you have that ball, put this code in: (hint: highlight the frame)
onEnterFrame=function () {
with (createEmptyMovieClip("line", 1)) {
lineStyle(10)
moveTo(_root._xmouse,_root._ymouse)
lineTo(ball._x,ball._y)
}
}
This is the rubber band. This code says that where ever the bale ball is that side stays with the ball. And the other side follows the mouse.
I hoped this helped you. I tried to explain what the codes briefly. You get the idea.
-pivot (AKA: msmstudios)