hi, can anyone show me where in this script i need to be looking to place the mc named "headmc" to a fixed point on the stage.
at present all of the clips fall to the bottom of the stage together...
i want them to all stay connected - but i would like the "headmc" to start and stay at a fixed point on the stage... the other clips then hang around it - as if hung on the wall...
here is the script that i am working with - if anyone can help me out i'd be really grateful...
Code:
function dist(a, b, c, d)
{
xd = a - c;
yd = b - d;
return (Math.sqrt(xd * xd + yd * yd));
} // End of the function
function dragobj()
{
a = drag;
xd = _xmouse - a.x;
yd = _ymouse - a.y;
dis = dist(_xmouse, _ymouse, a.x, a.y);
dx = xd / dis;
dy = yd / dis;
force = Math.abs((1 - dis) / 2);
a.xv = a.xv + dx * force;
a.yv = a.yv + dy * force;
} // End of the function
function createNode(x, y, xv, yv, r, b, f)
{
nodes.push(new Node(x, y, xv, yv, attachMovie("node", "Node:" + nodeid, getNextHighestDepth(), {_width: r * 2, _height: r * 2}), b, f));
++nodeid;
return (nodes[nodes.length - 1]);
} // End of the function
function constrainNodes(a, b, len, tolerance, vis, mc)
{
constraints.push(new Constraint(a, b, len, tolerance, vis, mc));
return (constraints[constraints.length - 1]);
} // End of the function
function updatesparkdoll()
{
cline.clear();
if (drag != undefined)
{
dragobj();
} // end if
for (i = 0; i < nodes.length; i++)
{
nodes[i].update(worldspeed);
n = nodes[i];
if (n.y > 550)
{
n.y = 550;
n.yv = -Math.abs(n.yv * n.bounce);
n.xv = n.xv * n.friction;
} // end if
if (n.x > 1000)
{
n.x = 1000;
n.xv = -Math.abs(n.xv * n.bounce);
n.yv = n.yv * n.friction;
continue;
} // end if
if (n.x < 0)
{
n.x = 0;
n.xv = Math.abs(n.xv * n.bounce);
n.yv = n.yv * n.friction;
} // end if
} // end of for
for (i = 0; i < constraints.length; i++)
{
constraints[i].update();
} // end of for
} // End of the function
var constraints = new Array();
var nodes = new Array();
var nodeid = 0;
var worldspeed = 0.5;
var dragthrow = 25;
var gravity = 9.000000E-01;
var cline = createEmptyMovieClip("constraintline", getNextHighestDepth());
onMouseDown = function ()
{
for (i = 0; i < nodes.length; i++)
{
if (dist(nodes[i].x, nodes[i].y, _xmouse, _ymouse) < dragthrow)
{
drag = nodes[i];
break;
} // end if
} // end of for
};
onMouseUp = function ()
{
drag = undefined;
};
head = createNode(random(0) + 275, random(10), 110, 110, 110, 6.000000E-01, 4.000000E-01);
shoulder = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
lelbow = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
lhand = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
relbow = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
rhand = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
pelvis = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
lknee = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
lfoot = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
rknee = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
rfoot = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
ltoe = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
rtoe = createNode(random(10) + 275, random(10), 0, 0, 0, 6.000000E-01, 4.000000E-01);
constrainNodes(head, shoulder, 15, 100, true, headmc);
constrainNodes(shoulder, lelbow, 50, 100, true, larmup);
constrainNodes(lelbow, lhand, 40, 100, true, larmdown);
constrainNodes(shoulder, relbow, 50, 100, true, rarmup);
constrainNodes(relbow, rhand, 40, 100, true, rarmdown);
constrainNodes(shoulder, pelvis, 80, 100, true, body);
constrainNodes(pelvis, lknee, 60, 100, true, llegup);
constrainNodes(lknee, lfoot, 55, 100, true, llegdown);
constrainNodes(pelvis, rknee, 60, 100, true, rlegup);
constrainNodes(rknee, rfoot, 55, 100, true, rlegdown);
constrainNodes(rfoot, rtoe, 20, 100, true, rfootmc);
constrainNodes(lfoot, ltoe, 20, 100, true, lfootmc);
onEnterFrame = function ()
{
updatesparkdoll();
};