Frame 1
function TangentFinder(x, y, r) {
if (abs(x) < 0.01) {
x = 0.01;
}
var j = ((x * x) + (y * y));
var r2 = (r * r);
if (r2 > j) {
var adjustFrac = (r2 / j);
x = x * adjustFrac;
y = y * adjustFrac;
j = (x * x) + (y * y);
trace("hit");
}
var k = sqrt(j - (r * r));
var testAngle = atan2(y, x);
var ra1 = acos(((r * x) + (y * k)) / j);
var ra2 = acos(((r * x) - (y * k)) / j);
tx1 = r * cos(ra1);
ty1 = r * sin(ra1);
td1 = Pyt(ty1 - y, tx1 - x);
tx2 = r * cos(-ra1);
ty2 = r * sin(-ra1);
td2 = Pyt(ty2 - y, tx2 - x);
tx3 = r * cos(ra2);
ty3 = r * sin(ra2);
td3 = Pyt(ty3 - y, tx3 - x);
tx4 = r * cos(-ra2);
ty4 = r * sin(-ra2);
td4 = Pyt(ty4 - y, tx4 - x);
if (abs(td2 - td4) < 0.0001) {
a1 = 2;
a2 = 4;
} else if (abs(td2 - td3) < 0.0001) {
a1 = 2;
a2 = 3;
} else if (abs(td1 - td4) < 0.0001) {
a1 = 1;
a2 = 4;
} else if (abs(td1 - td3) < 0.0001) {
a1 = 1;
a2 = 3;
}
xt1 = eval ("tx" + a1);
yt1 = eval ("ty" + a1);
xt2 = eval ("tx" + a2);
yt2 = eval ("ty" + a2);
}
function mouseTrack() {
var _local2 = film.pz;
var _local3 = ((scale * perspex) * (-_local2)) / _root.film._ymouse;
var _local1 = _local3;
_global.input.y = (-_local1) - film.py;
_global.input.x = (((_local1 / perspex) * film._xmouse) / scale) - film.px;
}
function Identify(path) {
idCount = idCount + 1;
path.id = idCount;
}
function getID() {
idCount = idCount + 1;
return(idCount);
}
function linkUp(src, dest, cat) {
var cL = cat.length;
n = 0;
while (n < cL) {
Set((src + ".") + cat[n], eval ((dest + ".") + cat[n]));
n++;
}
}
function CircleData(n, rc) {
var _local1 = n;
var _local3 = rc;
var _local2 = (2 * PI) / _local1;
q = 1;
while (q <= _local1) {
draw_anglec = draw_angle + (_local2 / 2);
draw_angle = _local2 * q;
Set((_local1 + "cuc") + q, _local3 * sin(draw_anglec));
Set((_local1 + "cvc") + q, _local3 * cos(draw_anglec));
Set((_local1 + "cu") + q, sin(draw_angle));
Set((_local1 + "cv") + q, cos(draw_angle));
q++;
}
}
function drawCircle(path, r, colr, alph) {
var _local1 = path;
var _local2 = alph;
if (_local2 == undefined) {
_local2 = 100;
}
_local1.beginfill(colr, _local2);
renderCircle(_local1, 6, r);
_local1.r = r;
_local1.endFill();
}
function renderCircle(path, pts, r) {
path.moveTo(0, r);
q = 1;
while (q <= pts) {
var huc = (r * eval ((pts + "cuc") + q));
var hvc = (r * eval ((pts + "cvc") + q));
var hu = (r * eval ((pts + "cu") + q));
var hv = (r * eval ((pts + "cv") + q));
path.curveTo(huc, hvc, hu, hv);
q++;
}
}
_global.compress = function (value) {
var _local1 = value;
if (_local1 > PI) {
_local1 = _local1 - (PI * 2);
} else if (_local1 < (-PI)) {
_local1 = _local1 + (PI * 2);
}
return(_local1);
};
_global.Pyt = function (x, y) {
return(sqrt((x * x) + (y * y)));
};
_global.Sin = Math.sin;
_global.Cos = Math.cos;
_global.aTan2 = Math.atan2;
_global.acos = Math.acos;
_global.abs = Math.abs;
_global.sqrt = Math.sqrt;
_global.PI = Math.PI;
MovieClip.prototype.create = function (name, p) {
createEmptyMovieClip.call(this, name, getID());
path = eval ("this." + name);
if (p == undefined) {
path.parent = path._parent;
} else {
path.parent = p;
}
path.id = idCount;
};
MovieClip.prototype.createShadow = function () {
this._parent.shadow.create(this._name);
this.shadow = eval ("this._parent.shadow." + this._name);
trace(this.shadow);
};
MovieClip.prototype.createFull = function (name) {
this.create(name);
path.createShadow();
};
_global.Being = function () {
this.parent = _root.film;
};
Being.prototype.createForm = function () {
this.parent.create((this.name + "form") + this.id);
this.form = eval ((((this.parent + ".") + this.name) + "form") + this.id);
};
Being.prototype.createShadow = function () {
this.parent.shadow.create((this.name + "Shadow") + this.id);
this.shadow = eval ((((this.parent.shadow + ".") + this.name) + "Shadow") + this.id);
};
_global.Point = function (p, a, b, c, rote) {
var _local1 = this;
var _local2 = rote;
var _local3 = b;
_local1.parent = p;
if (((a != 0) and (a != undefined)) or ((_local3 != 0) and (_local3 != undefined))) {
_local1.xi = (a * cos(_local2)) + (_local3 * sin(_local2));
_local1.yi = (_local3 * cos(_local2)) - (a * sin(_local2));
_local1.x = _local1.xi;
_local1.y = _local1.yi;
}
if ((c != 0) and (c != undefined)) {
_local1.zi = c;
_local1.z = _local1.zi;
}
};
_global.StatePoints = function (src) {
var _local2 = src;
var _local1 = _local2.length;
np = 0;
while (np < _local1) {
pt = _local2[np];
pt.LocateFull();
np++;
}
};
_global.StatePointsRote = function (src) {
var _local2 = src;
var _local1 = _local2.length;
np = 0;
while (np < _local1) {
pt = _local2[np];
pt.LocateRote();
np++;
}
};
_global.StatePointsRoteFull = function (src) {
var _local2 = src;
var _local1 = _local2.length;
np = 0;
while (np < _local1) {
pt = _local2[np];
pt.LocateRoteFull();
np++;
}
};
_global.StatePointsFull = function (src) {
var _local2 = src;
var _local1 = _local2.length;
np = 0;
while (np < _local1) {
pt = _local2[np];
pt.LocateFull();
np++;
}
};
_global.Part = function (name, p, shadow, root) {
this.name = name;
this.parent = p;
if (root == undefined) {
var root = this.parent;
}
root.form.create(this.name + "Form");
this.form = eval (((root.form + ".") + name) + "Form");
if (shadow == 1) {
root.shadow.create(this.name + "Shadow");
this.shadow = eval (((root.shadow + ".") + name) + "shadow");
}
};
Being.prototype.Locate = (Part.prototype.Locate = (Point.prototype.Locate = function () {
var _local1 = this;
_local1.px = _local1.x + _local1.parent.px;
_local1.py = _local1.y + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
_local1.depth = (-perspex) / _local1.py;
_local1.xs = (_local1.ys = (100 * scale) * _local1.depth);
_local1.vx = (_local1.px * _local1.depth) * scale;
_local1.vy = ((-_local1.pz) * _local1.depth) * scale;
}));
Being.prototype.LocateFull = (Part.prototype.LocateFull = (Point.prototype.LocateFull = function () {
var _local1 = this;
_local1.Locate();
_local1.sq = film.pz / _local1.py;
_local1.vys = ((-film.pz) * _local1.depth) * scale;
}));
Point.prototype.LocateRoteFull = (Part.prototype.LocateRoteFull = function (face) {
var _local1 = this;
if (face != undefined) {
var _local2 = face;
} else if (_local1.face == undefined) {
var _local2 = _local1.parent.face;
}
_local1.px = ((_local1.x * cos(_local2)) + (_local1.y * sin(_local2))) + _local1.parent.px;
_local1.py = (((-_local1.y) * cos(_local2)) + (_local1.x * sin(_local2))) + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
_local1.depth = (-perspex) / _local1.py;
_local1.vx = (_local1.px * _local1.depth) * scale;
_local1.vy = ((-_local1.pz) * _local1.depth) * scale;
_local1.vys = ((-film.pz) * _local1.depth) * scale;
_local1.xs = (_local1.ys = (100 * scale) * _local1.depth);
_local1.sq = film.pz / _local1.py;
_local1.vys = ((-film.pz) * _local1.depth) * scale;
});
Part.prototype.PositionFull = function () {
var _local1 = this;
_local1.form._x = _local1.vx;
_local1.form._y = _local1.vy;
_local1.form._xscale = _local1.xs;
_local1.form._yscale = _local1.ys;
_local1.shadow._x = _local1.vx;
_local1.shadow._y = _local1.vys;
_local1.shadow._xscale = _local1.xs;
_local1.shadow._yscale = _local1.ys * _local1.sq;
};
Being.prototype.DepthFinder = (Part.prototype.DepthFinder = (Point.prototype.DepthFinder = function () {
var _local1 = this;
var _local2 = _local1.py;
_local1.depth = (-perspex) / _local2;
return(_local1.depth);
}));
Part.prototype.SetDepth = (Being.prototype.SetDepth = function () {
var _local1 = this;
_local1.form.swapDepths(((_local1.depth * 100000) * scale) + _local1.id);
});
Part.prototype.ForceDepth = (Being.prototype.ForceDepth = function (dpth) {
this.form.swapDepths((dpth * 100000) * scale);
});
_global.input = new Object();
idCount = 1;
part.prototype.CircleToPointCurved = function (path, pt, rote, rotefactor, colr, lnwt) {
var _local1 = this;
var _local2 = path.vx / scale;
var _local3 = path.vy / scale;
var xd = (pt.vx / scale);
var yd = (pt.vy / scale);
var cosfactor = cos(rote * rotefactor);
var sinfactor = sin(rote * rotefactor);
x2 = ((xd - _local2) * cosfactor) + ((yd - _local3) * sinfactor);
y2 = ((yd - _local3) * cosfactor) - ((xd - _local2) * sinfactor);
TangentFinder(x2, y2, (path.r - (lnwt / 2)) * path.depth);
_local1.form.clear();
_local1.form.beginFill(colr);
_local1.form.lineStyle((lnwt * path.depth) * scale, colr);
_local1.form.moveTo(xd * scale, yd * scale);
_local1.form.curveTo((((x2 + xt1) / 2) + _local2) * scale, (((y2 + yt1) / 2) + _local3) * scale, (xt1 + _local2) * scale, (yt1 + _local3) * scale);
_local1.form.lineTo((xt2 + _local2) * scale, (yt2 + _local3) * scale);
_local1.form.curveTo((((x2 + xt2) / 2) + _local2) * scale, (((y2 + yt2) / 2) + _local3) * scale, xd * scale, yd * scale);
_local1.stopDraw();
};
part.prototype.CircleToPointShadow = function (path, pt, colr, lnwt) {
var _local2 = this;
var _local1 = (pt.sq + path.sq) / 2;
var xi = (path.vx / scale);
var _local3 = path.vys / (scale * _local1);
var xd = (pt.vx / scale);
var yds = (pt.vys / (scale * _local1));
TangentFinder(xd - xi, yds - _local3, (path.r - (lnwt / 2)) * path.depth);
_local2.shadow.clear();
_local2.shadow.beginFill(colr);
_local2.shadow.lineStyle(((lnwt * _local2.depth) * _local1) * scale, colr);
_local2.shadow.moveTo(xd * scale, (yds * scale) * _local1);
_local2.shadow.lineTo((xt1 + xi) * scale, ((yt1 + _local3) * scale) * _local1);
_local2.shadow.lineTo((xt2 + xi) * scale, ((yt2 + _local3) * scale) * _local1);
_local2.shadow.lineTo(xd * scale, (yds * scale) * _local1);
_local2.shadow.endFill();
};
part.prototype.CircleToPointFull = function (path, pt, colr1, colr2, lnwt) {
this.CircleToPoint(path, pt, colr1, lnwt);
this.CircleToPointShadow(path, pt, colr2, lnwt);
};
Part.prototype.startDraw = function (lw, colr) {
this.form.lineStyle((lw * this.depth) * scale, colr);
};
Part.prototype.beginShape = function (lw, colr, colr2, clr) {
var _local1 = this;
if (clr == 1) {
_local1.form.clear();
}
_local1.form.lineStyle((lw * _local1.depth) * scale, colr2);
_local1.form.beginFill(colr);
};
Part.prototype.startDrawFull = function (lw, colr, colr2) {
var _local1 = this;
_local1.form.lineStyle((lw * _local1.depth) * scale, colr);
_local1.shadow.lineStyle(((lw * _local1.depth) * _local1.sq) * scale, colr2);
};
Part.prototype.beginShapeFull = function (lw, colr, colr2, colr3, clr) {
var _local1 = this;
if (clr == 1) {
_local1.form.clear();
_local1.shadow.clear();
}
_local1.form.lineStyle((lw * _local1.depth) * scale, colr);
_local1.form.beginFill(colr2);
_local1.shadow.lineStyle(((lw * _local1.depth) * _local1.sq) * scale, colr3);
_local1.shadow.beginFill(colr3);
};
Part.prototype.jumpTo = function (path) {
this.form.moveTo(path.vx, path.vy);
};
Part.prototype.jumpToFull = function (path) {
var _local1 = path;
this.form.moveTo(_local1.vx, _local1.vy);
this.shadow.moveTo(_local1.vx, _local1.vys);
};
Part.prototype.drawTo = function (path) {
this.form.lineTo(path.vx, path.vy);
};
Part.prototype.drawToFull = function (path) {
var _local1 = path;
this.form.lineTo(_local1.vx, _local1.vy);
this.shadow.lineTo(_local1.vx, _local1.vys);
};
Part.prototype.connect = function (path1, path2) {
this.form.moveTo(path1.vx, path1.vy);
this.form.lineTo(path2.vx, path2.vy);
};
Part.prototype.connectFull = function (path1, path2) {
var _local1 = this;
var _local2 = path2;
var _local3 = path1;
_local1.form.moveTo(_local3.vx, _local3.vy);
_local1.form.lineTo(_local2.vx, _local2.vy);
_local1.shadow.moveTo(_local3.vx, _local3.vys);
_local1.shadow.lineTo(_local2.vx, _local2.vys);
};
Part.prototype.drawCurve = function (path1, path2) {
this.form.curveTo(path1.vx, path1.vy, path2.vx, path2.vy);
};
Part.prototype.drawLoopFull = function (src) {
var _local1 = this;
var _local3 = src;
var _local2 = _local3.length;
ptO = _local3[_local2 - 1];
_local1.form.moveTo(ptO.vx, ptO.vy);
_local1.shadow.moveTo(ptO.vx, ptO.vys);
np = 0;
while (np < (_local2 - 1)) {
pt = _local3[np];
_local1.form.lineTo(pt.vx, pt.vy);
_local1.shadow.lineTo(pt.vx, pt.vys);
np++;
}
_local1.form.lineTo(ptO.vx, ptO.vy);
_local1.shadow.lineTo(ptO.vx, ptO.vys);
};
Part.prototype.drawLoop = function (src) {
var _local2 = src;
var _local3 = this;
var _local1 = _local2.length;
ptO = _local2[_local1 - 1];
_local3.form.moveTo(ptO.vx, ptO.vy);
np = 0;
while (np < (_local1 - 1)) {
pt = _local2[np];
_local3.form.lineTo(pt.vx, pt.vy);
np++;
}
_local3.form.lineTo(ptO.vx, ptO.vy);
};
Part.prototype.drawLoopShadow = function (src) {
var _local2 = src;
var _local3 = this;
var _local1 = _local2.length;
ptO = _local2[_local1 - 1];
_local3.shadow.moveTo(ptO.vx, ptO.vys);
np = 0;
while (np < (_local1 - 1)) {
pt = _local2[np];
_local3.shadow.lineTo(pt.vx, pt.vys);
np++;
}
_local3.shadow.lineTo(ptO.vx, ptO.vys);
};
CircleData(6, 1.14);
Part.prototype.drawRound = function (r, colr) {
drawCircle(this.form, r, colr);
this.r = r;
};
Part.prototype.drawFullRound = function (r, colr, ShadowColr) {
var _local1 = r;
var _local2 = this;
drawCircle(_local2.form, _local1, colr);
drawCircle(_local2.shadow, _local1, ShadowColr);
_local2.r = _local1;
};
_global.Roto = function (name, scale, ix, iy, face, colr1, colr2, ball) {
var _local1 = this;
_local1.initialize(name, scale, ix, iy, face, colr1);
_local1.variables(scale);
if (circuit != 1) {
_local1.build(_root.film);
_local1.headAngle = _local1.headAngleMin;
_local1.head.x = ((_local1.length * cos(_local1.headAngle)) * 1) / 6;
_local1.head.z = ((-_local1.length) * sin(_local1.headAngle)) + _local1.legsZB;
_local1.legs.x = (((-_local1.length) * cos(_local1.headAngle)) * 5) / 6;
_local1.torso_angle = ((PI / 6) * sin(_local1.headAngle)) + ((PI / 16) * cos(_local1.headAngle));
_local1.legs.z = _local1.legsZB;
}
};
Roto.prototype = new Being();
Roto.prototype.initialize = function (name, scale, ix, iy, face, colr1) {
var _local1 = this;
_local1.name = name;
_root.identify(_local1);
_local1.parent = _parent;
_local1.x = ix;
_local1.y = iy;
_local1.z = ww / 2;
Face = iface;
_local1.kolor = colr1;
};
Roto.prototype.Run = function (target) {
var _local1 = this;
_local1.RotoMove(target);
_local1.ComplexForm();
_local1.Draw();
};
Roto.prototype.RunCircuit = function (id, radius, angle, face, spin, turn, jump) {
var _local1 = this;
_local1.id = id;
_local1.build(_root.workframe, id);
_local1.headAngle = _local1.headAngleMin;
_local1.head.x = ((_local1.length * cos(_local1.headAngle)) * 1) / 6;
_local1.head.z = ((-_local1.length) * sin(_local1.headAngle)) + _local1.legsZB;
_local1.legs.x = (((-_local1.length) * cos(_local1.headAngle)) * 5) / 6;
_local1.torso_angle = ((PI / 6) * sin(_local1.headAngle)) + ((PI / 16) * cos(_local1.headAngle));
_local1.legs.z = _local1.legsZB;
_local1.face = face;
_local1.cosface = cos(_local1.face);
_local1.sinface = sin(_local1.face);
_local1.x = cos(angle) * radius;
_local1.y = sin(angle) * radius;
_local1.turn = turn;
_local1.v = jump;
_local1.spin = spin;
_local1.SimpleForm();
_local1.Draw();
};
Roto.prototype.build = function (p) {
var _local1 = this;
var _local2 = p;
var _local3 = _root;
_local1.parent = _local2;
_local1.createForm();
_local1.createShadow();
_local1.head = new Part("head", _local1, 1, _local2);
_local1.torso = new Part("torso", _local1, 1, _local2);
_local1.legs = new Part("legs", _local1, 1, _local2);
_local1.foot1 = new Part("foot1", _local1.legs, 1, _local2);
_local1.foot2 = new Part("foot2", _local1.legs, 1, _local2);
_local1.foot3 = new Part("foot3", _local1.legs, 1, _local2);
_local1.head.drawFullRound(_local1.headR, _local1.kolor, _local3.film.shadowColor);
_local1.foot1.drawFullRound(_local1.feetR, _local1.kolor, _local3.film.shadowColor);
_local1.foot2.drawFullRound(_local1.feetR, _local1.kolor, _local3.film.shadowColor);
_local1.foot3.drawFullRound(_local1.feetR, _local1.kolor, _local3.film.shadowColor);
};
Roto.prototype.RotoMove = function (target) {
var _local1 = this;
var target_y = (target.py - _local1.head.py);
var target_x = (target.px - _local1.head.px);
var aim = atan2(target_y, target_x);
var _local2 = compress(aim - _local1.face);
var _local3 = sqrt(abs(_local2)) * (_local1.v / _local1.vmax);
if (_local3 > 1) {
_local3 = 1;
}
if (abs(_local2) > 0.05) {
if (_local2 > 0) {
_local1.turn = _local1.turn + (_local1.turnRate * _local3);
} else if (_local2 < 0) {
_local1.turn = _local1.turn - (_local1.turnRate * _local3);
}
}
_local1.turn = _local1.turn * 0.9;
var d = sqrt((target_x * target_x) + (target_y * target_y));
if (d > _local1.threshold) {
_local1.v = _local1.v + _local1.a;
if (abs(_local1.v) > _local1.vmax) {
if (_local1.v > _local1.vmax) {
_local1.v = _local1.vmax;
} else if (_local1.v < (-_local1.vmax)) {
_local1.v = -_local1.vmax;
}
}
}
if (d < _local1.threshold) {
if (abs(_local1.v) < 0.05) {
_local1.v = 0.05;
}
}
_local1.face = _local1.face + _local1.turn;
_local1.cosface = cos(_local1.face);
_local1.sinface = sin(_local1.face);
_local1.movx = _local1.cosface * _local1.v;
_local1.movy = _local1.sinface * _local1.v;
_local1.x = _local1.x + _local1.movx;
_local1.y = _local1.y + _local1.movy;
};
Roto.prototype.ComplexForm = function () {
var dx = (_root.film.ball.px - this.head.px);
var dy = (_root.film.ball.py - this.head.py);
var ball_dh = Pyt(dx, dy);
var ball_dz = ((_root.film.ball.z - _root.film.ball.r) - this.legsZB);
var faceAngle = compress(this.face - atan2(dy, dx));
this.headAngle = (atan2(-ball_dz, ball_dh) + (this.headAngle * 4)) / 5;
if (this.headAngle > this.headAngleMin) {
this.headAngle = this.headAngleMin;
} else if (this.headAngle < ((-PI) / 2)) {
this.headAngle = (-PI) / 2;
}
this.head.x = ((this.length * cos(this.headAngle)) * 1) / 6;
this.head.z = ((-this.length) * sin(this.headAngle)) + this.legsZB;
newLegsX = (((-this.length) * cos(this.headAngle)) * 5) / 6;
this.legsAdjust = newLegsX - this.legs.x;
this.legs.x = newLegsX;
var spinRate = (Pyt(this.v + this.legsAdjust, abs(this.turn) * newLegsX) / ((this.arcLength * 6) / (PI * 2)));
this.feetSpin = compress(this.feetSpin - spinRate);
this.torso_angle = ((PI / 6) * sin(this.headAngle)) + ((PI / 16) * cos(this.headAngle));
this.legs.z = this.legsZB;
var adj = atan2(this.turn * this.legs.x, this.v * cos(this.turn));
this.feetFace = this.face + adj;
n = 1;
while (n <= 3) {
var foot = eval ("this.foot" + n);
foot.angle = compress(this.feetspin - (((n / 3) * PI) * 2));
foot.z = (-this.pedalR) * cos(foot.angle);
if (((foot.z + this.legs.z) - this.feetR) < 0) {
var d = (foot.angle / (PI / 3));
foot.x = d * this.arcLength;
foot.z = this.feetR - this.legs.z;
} else {
foot.x = this.pedalR * sin(foot.angle);
}
n++;
}
};
Roto.prototype.Draw = function () {
var _local1 = this;
_local1.locate();
_local1.head.locateRoteFull();
_local1.head.PositionFull();
_local1.torso.locateFull();
_local1.legs.locateRoteFull();
_local1.foot1.locateRoteFull(_local1.feetFace);
_local1.foot2.locateRoteFull(_local1.feetFace);
_local1.foot3.locateRoteFull(_local1.feetFace);
_local1.foot1.positionFull();
_local1.foot2.positionFull();
_local1.foot3.positionFull();
_local1.torso.CircleToPointCurved(_local1.head, _local1.legs, _local1.torso_angle, cos(_local1.face), _local1.kolor, 1);
_local1.torso.CircleToPointShadow(_local1.head, _local1.legs, film.shadowColor, 1);
_local1.legs.form.clear();
_local1.legs.shadow.clear();
_local1.legs.startDrawFull(_local1.lw, _local1.kolor, film.shadowColor);
_local1.legs.connectFull(_local1.legs, _local1.foot1);
_local1.legs.connectFull(_local1.legs, _local1.foot2);
_local1.legs.connectFull(_local1.legs, _local1.foot3);
_local1.head.setDepth();
_local1.torso.forceDepth(_local1.head.depth - 1);
_local1.legs.forceDepth(((_local1.foot1.depth + _local1.foot2.depth) + _local1.foot3.depth) / 3);
_local1.foot1.setDepth();
_local1.foot2.setDepth();
_local1.foot3.setDepth();
};
Roto.prototype.variables = function (scale) {
var _local1 = this;
var _local2 = scale;
_local1.lw = 2 * _local2;
_local1.length = 30 * _local2;
_local1.feetR = 2 * _local2;
_local1.headR = 4.5 * _local2;
_local1.pedalRMax = 10 * _local2;
_local1.pedalR = _local1.pedalRMax;
_local1.legsZB = (_local1.pedalR + _local1.feetR) - (sin(PI / 6) * _local1.pedalR);
_local1.arcLength = sin(PI / 3) * _local1.pedalR;
_local1.headAngleMin = Math.asin((-(_local1.headR - _local1.legsZB)) / _local1.length);
_local1.headTilt = -0.02;
_local1.a = 0.03 * _local2;
_local1.vmax = 2 * _local2;
_local1.turnRate = 0.01;
_local1.threshold = 15;
_local1.keyR = _local1.pedalR;
};
function FilmInitialize() {
var _local1 = _root;
scale = 10;
CircleData(6, 1.14);
create("film");
film.create("shadow");
film.backColor = "0x006060";
film.shadowColor = "0x005656";
_local1.xcenter = stage.width / 2;
_local1.ycenter = (stage.height / 2) - 130;
_local1.perspex = 1000;
film.px = 0;
film.py = -900;
film.pz = -220;
film.form = film;
film.Thomas = new Roto("Thomas", 1, -250, 0, 0, "0xCCFFFF");
film.Ball = new Ball("Ball", 1, 0, 0, 10, "0x00AAAA", "0x33CCCC");
}
function FilmRun() {
film.thomas.run(film.ball);
film.ball.run();
}
_global.Ball = function (name, scale, ix, iy, iz, colr1, colr2) {
var _local1 = this;
_local1.initialize(name, scale, ix, iy, iz, colr1, colr2);
_local1.variables(scale);
_local1.build(_root.film);
};
Ball.prototype = new Being();
Ball.prototype.initialize = function (name, scale, ix, iy, iz, colr1, colr2) {
var _local1 = this;
_local1.name = name;
_root.identify(_local1);
_local1.parent = _local1._parent;
_local1.x = ix;
_local1.y = iy;
_local1.z = iz;
_local1.kolor1 = colr1;
_local1.kolor2 = colr2;
};
Ball.prototype.Run = function (target) {
this.BallMove();
this.Draw();
};
Ball.prototype.variables = function (scl) {
var _local1 = this;
var _local2 = scl;
_local1.spotR = 4 * _local2;
_local1.r = 16 * _local2;
trace(_local2);
_local1.dx = (random(10) - 5) / 5;
_local1.dy = (random(10) - 5) / 5;
_local1.dz = 0;
_local1.spinrate = 0;
_local1.spinDir = 0;
_local1.dPitch = 0;
_local1.dYaw = 0;
_local1.dRote = 0;
_local1.grav = 0.2;
_local1.airDrag = 0.95;
_local1.floorDrag = 0.8;
_local1.pickup = 0;
_local1.z = 20;
};
Ball.prototype.build = function (p) {
var _local1 = this;
_local1.parent = p;
_local1.createForm();
_local1.createShadow();
_local1.shape = new Part("shape", _local1, 1);
_local1.shape.drawFullRound(_local1.r, _local1.kolor1, _root.film.shadowColor);
_local1.buildspots();
};
Ball.prototype.buildSpots = function (p) {
this.spot1 = new Part("spot1", this);
this.spot2 = new Part("spot2", this);
this.spot3 = new Part("spot3", this);
this.spot4 = new Part("spot4", this);
this.spot5 = new Part("spot5", this);
this.spot6 = new Part("spot6", this);
this.spot1.x = this.r;
this.spot2.y = this.r;
this.spot3.z = this.r;
n = 1;
while (n <= 6) {
path = eval ("this.spot" + n);
path.drawFullRound(this.spotr, this.kolor2, _root.film.shadowColor);
n++;
}
this.draw();
};
Ball.prototype.BallMove = function () {
var _local1 = this;
var _local2 = _root;
if (_local1.pickup == 0) {
_local1.dx = _local1.dx * _local1.airDrag;
_local1.dy = _local1.dy * _local1.airDrag;
if (_local1.z != 0) {
_local1.dz = _local1.dz - _local1.grav;
_local1.dz = _local1.dz * _local1.airDrag;
}
_local1.x = _local1.x + _local1.dx;
_local1.y = _local1.y + _local1.dy;
_local1.z = _local1.z + _local1.dz;
if ((_local1.z - _local1.r) < 0) {
_local1.z = ((_local1.r - _local1.z) * _local1.floorDrag) + _local1.r;
_local1.dz = _local1.dz * (-1 * _local1.floorDrag);
if (_local1.dz < _local1.grav) {
_local1.dz = 0;
_local1.z = _local1.r;
}
_local1.ballSpin = Pyt(_local1.dx, _local1.dy) / _local1.r;
_local1.dRote = 0;
_local1.dPitch = (-_local1.dx) / _local1.r;
_local1.dYaw = (-_local1.dy) / _local1.r;
}
} else {
var oldx = _local1.x;
var _local3 = _local1.z;
_local1.x = ((_local2.film._xmouse / (_local1.depth * _local2.scale)) + (_local1.x * 2)) / 3;
_local1.z = ((((-_local2.film._ymouse) / (_local1.depth * _local2.scale)) - _local2.film.pz) + (_local1.z * 2)) / 3;
if ((_local1.z < _local1.r) or (_local1.y > _local1.basey)) {
_local1.z = _local1.r;
var oz = (_local2.film.pz + _local1.r);
var ii = (((_local2.scale * _local2.perspex) * (-oz)) / _local2.film._ymouse);
var oy = ii;
_local1.y = (((-oy) - _local2.film.py) + (_local1.y * 2)) / 3;
}
_local1.dx = _local1.x - oldx;
_local1.dz = _local1.z - _local3;
if (ms == 0) {
_local1.pickup = 0;
}
}
_local1.collision(_local2.film.Thomas.head);
if (((ms == 1) and _local1.shape.form.hittest(_local2._xmouse, _local2._ymouse, true)) and (_local1.pickup == 0)) {
_local1.pickup = 1;
_local1.dRote = 0;
_local1.dPitch = 0;
_local1.dYaw = 0;
_local1.dy = 0;
_local1.basey = _local1.y;
}
};
Ball.prototype.nudge = function () {
var _local1 = this;
_local1.nudgex = (-_local1.x) / 200;
_local1.nudgey = (-_local1.y) / 200;
_local1.dx = _local1.dx + _local1.nudgeX;
_local1.dy = _local1.dy + _local1.nudgeY;
};
Ball.prototype.Collision = function (target) {
var _local1 = this;
_local1.target = target;
Hmx = _local1.target.px - _local1.oHx;
Hmy = _local1.target.py - _local1.oHy;
Hmz = _local1.target.pz - _local1.oHz;
_local1.oHx = _local1.target.px;
_local1.oHy = _local1.target.py;
_local1.oHz = _local1.target.pz;
_local1.px = _local1.x + _local1.parent.px;
_local1.py = _local1.y + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
if (_local1.HitDistance() < 0) {
_local1.pickup = 0;
var _local2 = -1;
var _local3 = 0;
q = 1;
while (q <= 6) {
n = Math.pow(2, q);
inc = (1 / n) * _local2;
_local3 = _local3 + inc;
_local1.x = _local1.x + (inc * _local1.dx);
_local1.y = _local1.y + (inc * _local1.dy);
_local1.z = _local1.z + (inc * _local1.dz);
_local1.px = _local1.x + _local1.parent.px;
_local1.py = _local1.y + _local1.parent.py;
_local1.pz = _local1.z + _local1.parent.pz;
Hx = Hx + (inc * Hmx);
Hy = Hy + (inc * Hmy);
Hz = Hz + (inc * Hmz);
if (q < 4) {
if (_local1.HitDistance() < 0) {
_local2 = -1;
} else {
_local2 = 1;
}
}
q++;
}
var tempX = (_local1.x + _local1.parent.px);
var tempY = (_local1.y + _local1.parent.py);
var tempZ = (_local1.z + _local1.parent.pz);
var Hangle = atan2(target.py - _local1.py, target.px - _local1.px);
var Vangle = atan2(target.pz - _local1.pz, Pyt(target.py - _local1.py, target.px - _local1.px));
var ix = (Hmx - _local1.dx);
var iy = (Hmy - _local1.dy);
var iz = (Hmz - _local1.dz);
var cosV = cos(Vangle);
var sinV = sin(Vangle);
var cosH = cos(Hangle);
var sinH = sin(Hangle);
var impactV = Pyt(Pyt((ix * cosV) * cosH, (iy * cosV) * sinH), iz * sinV);
_local1.dx = _local1.dx + ((((-impactV) * cosH) * cosV) * 1.75);
_local1.dy = _local1.dy + ((((-impactV) * sinH) * cosV) * 1.75);
_local1.dz = _local1.dz + (((-impactV) * sinV) * 2.5);
_local1.nudge();
_local1.x = _local1.x + (_local1.dx * (-_local3));
_local1.y = _local1.y + (_local1.dy * (-_local3));
_local1.z = _local1.z + (_local1.dz * (-_local3));
_local1.cx = target.px - _local1.px;
_local1.cy = target.py - _local1.py;
_local1.cz = target.pz - _local1.pz;
_local1.dRote = ((_local1.dRote + ((sin(hangle) * ix) / _local1.r)) - ((cos(hangle) * iy) / _local1.r)) / 2;
_local1.dPitch = ((_local1.dPitch - ((sin(vangle) * ix) / _local1.r)) - ((cos(vangle) * iz) / _local1.r)) / 2;
_local1.dYaw = ((_local1.dYaw - ((cos(vangle) * iz) / _local1.r)) - ((sin(vangle) * iy) / _local1.r)) / 2;
_local1.spin();
}
};
Ball.prototype.HitDistance = function () {
var _local1 = this;
var distX = (_local1.px - _local1.oHx);
var _local3 = _local1.py - _local1.oHy;
var _local2 = _local1.pz - _local1.oHz;
var distH = sqrt((distX * distX) + (_local3 * _local3));
var d = (sqrt((distH * distH) + (_local2 * _local2)) - (_local1.target.r + _local1.r));
return(d);
};
Ball.prototype.spin = function () {
var _local1 = this;
_local1.cx2 = (_local1.cx * cos(-hAngle)) + (_local1.cy * sin(-hAngle));
_local1.cy2 = (_local1.cy * cos(-hAngle)) - (_local1.cx * sin(-hAngle));
_local1.cz2 = _local1.cz;
_local1.cx3 = (_local1.cx2 * cos(-vAngle)) + (_local1.cz2 * sin(-vAngle));
_local1.cy3 = _local1.cy2;
_local1.cz3 = (_local1.cz2 * cos(-vAngle)) - (_local1.cx2 * sin(-vAngle));
_local1.spinRate = Pyt(_local1.cx3, _local1.cy3) / _local1.r;
_local1.spinDir = atan2(_local1.cy3, _local1.cx3);
};
Ball.prototype.Draw = function () {
var _local1 = _root;
var _local2 = this;
path = _local2;
path.px = path.x + _local1.film.px;
path.py = path.y + _local1.film.py;
path.pz = path.z + _local1.film.pz;
path.depth = (-_local1.perspex) / path.py;
path.vx = path.px * (path.depth * scale);
path.vy = (-path.pz) * (path.depth * scale);
var path = _local2.shape;
path.px = path.x + path.parent.px;
path.py = path.y + path.parent.py;
path.pz = path.z + path.parent.pz;
path.depth = (-_local1.perspex) / path.py;
path.shadow._x = (path.form._x = (path.vx = path.px * (path.depth * scale)));
path.form._y = (path.vy = (-path.pz) * (path.depth * scale));
path.shadow._y = (path.vys = (-_local1.film.pz) * (path.depth * scale));
path.form._yscale = (path.form._xscale = (path.shadow._xscale = (path.xs = (path.ys = 100 * (path.depth * scale)))));
path.sq = _local1.film.pz / path.py;
path.vys = (-_local1.film.pz) * (path.depth * scale);
path.shadow._yscale = path.ys * path.sq;
_local2.setDepth();
_local2.spotsSpin();
_local2.spotsDraw();
};
Ball.prototype.SpotsSpin = function () {
n = 1;
while (n <= 3) {
pt = eval ("this.spot" + n);
sp = sin(this.dPitch);
cp = cos(this.dPitch);
sy = sin(this.dYaw);
cy = cos(this.dYaw);
sr = sin(this.dRote);
cr = cos(this.dRote);
pt.x2 = (pt.x * cr) + (pt.y * sr);
pt.y2 = (pt.y * cr) - (pt.x * sr);
pt.z2 = pt.z;
pt.x3 = pt.x2;
pt.y3 = (pt.y2 * cy) - (pt.z2 * sy);
pt.z3 = (pt.z2 * cy) + (pt.y2 * sy);
pt.x4 = (pt.x3 * cp) - (pt.z3 * sp);
pt.y4 = pt.y3;
pt.z4 = (pt.z3 * cp) + (pt.x3 * sp);
pt.x = pt.x4;
pt.y = pt.y4;
pt.z = pt.z4;
n++;
}
};
Ball.prototype.SpotsDraw = function () {
n = 1;
while (n <= 3) {
spot = eval ("this.spot" + n);
aspot = eval ("this.spot" + (n + 3));
var path = spot;
path.px = path.x + path.parent.px;
path.py = path.y + path.parent.py;
path.pz = path.z + path.parent.pz;
path.depth = (-_root.perspex) / path.py;
path.vx = path.px * (path.depth * scale);
path.vy = (-path.pz) * (path.depth * scale);
var sx = (spot.vx - this.vx);
var sy = (spot.vy - this.vy);
var spot_angle = atan2(sy, sx);
var spot_d = sqrt((sx * sx) + (sy * sy));
var ratio = (spot_d / ((this.r * this.depth) * 10));
spot.form._rotation = (spot_angle / (PI / 180)) + 90;
if (ratio > 1) {
spot.form.ysq = 0;
} else {
spot.form.ysq = sqrt(1 - (ratio * ratio));
}
if (spot.depth < this.depth) {
spot.form._visible = 0;
aspot.form._visible = 1;
aspot.form._x = this.vx - (spot.vx - this.vx);
aspot.form._y = this.vy - (spot.vy - this.vy);
aspot.form._rotation = spot.form._rotation + 180;
aspot.form._xscale = 100 * (spot.depth * scale);
aspot.form._yscale = (100 * (spot.depth * scale)) * spot.form.ysq;
} else {
spot.form._visible = 1;
aspot.form._visible = 0;
spot.form._x = spot.vx;
spot.form._y = spot.vy;
spot.form._xscale = 100 * (spot.depth * scale);
spot.form._yscale = (100 * (spot.depth * scale)) * spot.form.ysq;
}
n++;
}
};
Instance of Symbol 1 MovieClip "globe_control" in Frame 1
onClipEvent (load) {
this._visible = 0;
_global.ms = 0;
beginFilm = 1;
}
onClipEvent (enterFrame) {
if (beginFilm == 1) {
beginFilm = 0;
_root.FilmInitialize();
film = _root.film;
film._x = _root.xcenter;
film._y = _root.ycenter;
film._xscale = (film._yscale = 10);
_root.backdrop._height = stage.height;
_root.backdrop._width = stage.width;
_root.backdrop._x = (_root.backdrop._y = 0);
_root.backdrop._visible = 1;
} else {
_root.FilmRun();
_root.mouseTrack();
}
}
onClipEvent (mouseUp) {
_global.ms = 0;
}
onClipEvent (mouseDown) {
_global.ms = 1;
}