Frame 1
FilmSpace = new Object();
FilmSpace.px = 0;
FilmSpace.py = 120;
FilmSpace.pz = -25;
FilmSpace.ceiling = 100;
FilmSpace.perspex = 1000;
FilmSpace.offset = -100;
_global.grav = -0.1;
Layout = function () {
this.width = 450;
this.height = 450;
this.ox = stage.width / 2;
this.oy = stage.height / 2;
this.cellRows = 4;
this.cellCols = 4;
this.gap = 0;
};
vangle = PI / 2;
Function.prototype.ptype = function (superClass) {
this.prototype.__constructor__ = superClass;
ASSetPropFlags(this.prototype, "__constructor__", 1);
this.prototype.__proto__ = superClass.prototype;
};
compress = function (value) {
if (value > PI) {
value = value - (PI * 2);
} else if (value < (-PI)) {
value = value + (PI * 2);
}
return(value);
};
Sin = Math.sin;
Cos = Math.cos;
aTan2 = Math.atan2;
asin = Math.asin;
acos = Math.acos;
abs = Math.abs;
sqrt = Math.sqrt;
PI = Math.PI.valueOf();
MovieClip.newClip = MovieClip.createEmptyMovieClip;
cosh = function (x) {
var y = ((Math.pow(Math.E, x) + Math.pow(Math.E, -x)) / 2);
return(y);
};
Pyt = function (x, y) {
return(sqrt((x * x) + (y * y)));
};
sift = function (tempVar, def) {
if ((tempVar == undefined) or (tempVar == 0)) {
return(def);
}
return(tempvar);
};
branch = function (tempVar, def1, def2) {
if ((tempVar == undefined) or (tempVar == 0)) {
return(def2);
}
return(def1);
};
Ybranch = function (tempVar, def1, def2, def3) {
if ((tempVar == undefined) or (tempVar == 0)) {
return(def2);
}
if (tempVar == 1) {
return(def1);
}
if (tempVar == -1) {
return(def3);
}
};
AngleSplit = function (num1, num2, factor) {
if (factor == undefined) {
factor = 1;
}
if (abs(num1 - num2) > PI) {
if (num1 > num2) {
num1 = num1 - (PI * 2);
} else {
num2 = num2 - (PI * 2);
}
}
var av = compress(((num1 * factor) + num2) / (factor + 1));
return(av);
};
Object.prototype.TangentFinder = function (x, y, r) {
var j = ((x * x) + (y * y));
var k = sqrt(j - (r * r));
var ra1 = acos(((r * x) + (y * k)) / j);
var ra2 = acos(((r * x) - (y * k)) / j);
var tx1 = (r * cos(ra1));
var ty1 = (r * sin(ra1));
var td1 = sqrt(((ty1 - y) * (ty1 - y)) + ((tx1 - x) * (tx1 - x)));
var tx2 = (r * cos(-ra1));
var ty2 = (r * sin(-ra1));
var td2 = sqrt(((ty2 - y) * (ty2 - y)) + ((tx2 - x) * (tx2 - x)));
var tx3 = (r * cos(ra2));
var ty3 = (r * sin(ra2));
var td3 = sqrt(((ty3 - y) * (ty3 - y)) + ((tx3 - x) * (tx3 - x)));
var tx4 = (r * cos(-ra2));
var ty4 = (r * sin(-ra2));
var td4 = sqrt(((ty4 - y) * (ty4 - y)) + ((tx4 - x) * (tx4 - x)));
if (abs(td2 - td4) < 0.0001) {
this.xt1 = tx2;
this.yt1 = ty2;
this.xt2 = tx4;
this.yt2 = ty4;
} else if (abs(td2 - td3) < 0.0001) {
this.xt1 = tx2;
this.yt1 = ty2;
this.xt2 = tx3;
this.yt2 = ty3;
} else if (abs(td1 - td4) < 0.0001) {
this.xt1 = tx1;
this.yt1 = ty1;
this.xt2 = tx4;
this.yt2 = ty4;
} else if (abs(td1 - td3) < 0.0001) {
this.xt1 = tx1;
this.yt1 = ty1;
this.xt2 = tx3;
this.yt2 = ty3;
}
};
kolor = function () {
};
kolor.prototype = new Object();
kolor.prototype.kolorBreak = function () {
var irgb = new Array(this.hex.substr(2, 2), this.hex.substr(4, 2), this.hex.substr(6, 2));
this.rgb = new Array();
c = 0;
while (c < 3) {
n1 = hexDigit(irgb[c].substr(0, 1));
n2 = hexDigit(irgb[c].substr(1, 1));
this.rgb[c] = (n1 * 16) + n2;
c++;
}
};
hexdigit = function (num) {
if (num < 10) {
var num = Number(num);
} else if ((num == "A") or (num == "a")) {
var num = 10;
} else if ((num == "B") or (num == "b")) {
var num = 11;
} else if ((num == "C") or (num == "c")) {
var num = 12;
} else if ((num == "D") or (num == "d")) {
var num = 13;
} else if ((num == "E") or (num == "e")) {
var num = 14;
} else if ((num == "F") or (num == "f")) {
var num = 15;
}
return(num);
};
function cursor() {
}
function Being() {
}
function idCount() {
idCounter = idCounter + 1;
return(idCounter);
}
function sCurve(num) {
var op = (((-cos(num * PI)) + 1) / 2);
return(op);
}
function iuratio(num) {
var n2 = abs((num - 0.5) * 2);
var op = (1 - (n2 * n2));
return(op);
}
function softHill(num) {
var op = cos((((num - 0.5) * 2) * PI) / 2);
return(op);
}
function XYZarray(src) {
this[0] = src.x;
this[1] = src.y;
this[2] = src.z;
}
cursor.prototype.update = function (path) {
this.vy = path.form._ymouse;
this.vx = path.form._xmouse;
this.state = 0;
var oz = path.pz;
var oy = (((scale * path.perspex) * (-oz)) / this.vy);
if (oy > 0) {
this.py = oy;
this.px = ((oy / path.perspex) * this.vx) / scale;
this.pz = oz;
} else {
this.py = 99999 /* 0x01869F */;
this.px = ((oy / path.perspex) * this.vx) / scale;
this.pz = oz;
}
};
ms = 0;
oms = 0;
_root.onMouseDown = function () {
if (ms == 0) {
oms = 1;
} else {
oms = 0;
}
ms = 1;
};
_root.onMouseUp = function () {
if (ms == 1) {
oms = 0;
} else {
oms = 1;
}
ms = 0;
};
Point = function (p, x, y, z) {
this.register(p);
if (x != undefined) {
this.xi = (this.x = x);
this.yi = (this.y = y);
this.zi = (this.z = z);
}
};
Point.prototype.attachTo = function (path) {
this.parent = path;
};
Point.prototype.XYZ = function (a, b, c) {
this.x = a;
this.y = b;
this.z = c;
};
Point.prototype.iXYZ = function (a, b, c) {
this.ix = a;
this.iy = b;
this.iz = c;
};
Point.prototype.zero = function () {
this.xyz(0, 0, 0);
};
Part = function (p, s, colr) {
if (p) {
this.register("Part", p, s);
}
if (colr != unefined) {
this.setColor(colr);
}
};
Part.prototype = new Point();
Part.prototype.makeForm = function (name, base, level) {
if (level == undefined) {
level = this.id;
}
base.form.createEmptyMovieClip((name + "F") + this.id, level);
this.form = eval ((((base.form + ".") + name) + "F") + this.id);
};
Part.prototype.makeShadow = function (name, base, level) {
if (level == undefined) {
level = this.id;
}
if (base.shadow != undefined) {
path = base.shadow;
} else {
path = this.form;
}
path.createEmptyMovieClip((name + "S") + this.id, level);
this.shadow = eval ((((path + ".") + name) + "S") + this.id);
};
Part.prototype.appear = function () {
this.form._visible = 1;
this.shadow._visible = 1;
};
Part.prototype.disappear = function () {
this.form._visible = 0;
this.shadow._visible = 0;
};
being.prototype = new Part();
Part.prototype.register = function (name, p, shadow, formBase) {
this.parent = p;
this.home = this.parent.home;
this.id = idCount();
if (formBase == undefined) {
var formBase = p;
}
this.makeForm(name, formBase);
if ((shadow == 1) or (shadow == -1)) {
this.makeShadow(name, formBase);
} else {
this.shadow = 0;
}
this.home.registry.push(this);
};
Point.prototype.register = function (p) {
this.parent = p;
this.home = this.parent.home;
this.id = idCount();
this.home.registry.push(this);
};
idCounter = 0;
Part.prototype.celBatch = function (nc, nf, shad) {
this.currentCel = 0;
this.cels = new Array();
n = 0;
while (n < nc) {
this.form.createEmptyMovieClip("cel" + n, 1000 + n);
var path = eval ("this.form.cel" + n);
if (shad) {
this.shadow.createEmptyMovieClip("cel" + n, 1000 + n);
path.shadow = eval ("this.shadow.cel" + n);
}
this.cels[n] = path;
m = 0;
while (m < nf) {
path.createEmptyMovieClip("subcel" + m, m);
m++;
}
n++;
}
};
Point.prototype.iFollow = function (target, number) {
this.recorder = new Object();
this.recorder.src = target;
this.recorder.steps = number;
this.recorder.states = new Array();
};
Point.prototype.Follow = function (xoffset, zoffset) {
trace("follow");
var path = this.recorder.src;
this.recorder.states.splice(0, 0, new Array(path.px, path.py, path.pz, path.face, path.v, path.turn));
var path = this.recorder.states[this.recorder.states.length - 1];
this.face = path[3];
this.px = path[0] + (xoffset * cos(this.face));
this.py = path[1] + (xoffset * sin(this.face));
this.pz = path[2] + zoffset;
this.v = path[4];
this.turn = path[5];
this.recorder.states.splice(this.recorder.steps, 1);
};
DoubleEase = function (num, max) {
return((1 - cos((num / max) * PI)) / 2);
};
Point.prototype.Locate = function () {
this.px = this.x + this.parent.px;
this.py = this.y + this.parent.py;
this.pz = this.z + this.parent.pz;
this.projectionData();
};
Point.prototype.LocateRote = function (rote) {
if (rote == undefined) {
var rote = this.parent.face;
}
var sinRote = sin(rote);
var cosRote = cos(rote);
this.px = ((this.x * cosRote) - (this.y * sinRote)) + this.parent.px;
this.py = ((this.y * cosRote) + (this.x * sinRote)) + this.parent.py;
this.pz = this.z + this.parent.pz;
this.projectionData();
};
Point.prototype.LocateRoteTilt = function (rote, tilt) {
var x2 = ((this.x * cos(tilt)) - (this.z * sin(tilt)));
var z2 = ((this.z * cos(tilt)) + (this.x * sin(tilt)));
this.px = ((x2 * cos(rote)) - (this.y * sin(rote))) + this.parent.px;
this.py = ((this.y * cos(rote)) + (x2 * sin(rote))) + this.parent.py;
this.pz = z2 + this.parent.pz;
this.projectionData();
};
Point.prototype.LocateRoteYaw = function (rote, yaw) {
var y2 = ((this.y * cos(yaw)) - (this.z * sin(yaw)));
var z2 = ((this.z * cos(yaw)) + (this.y * sin(yaw)));
this.px = ((this.x * cos(rote)) - (y2 * sin(rote))) + this.parent.px;
this.py = ((y2 * cos(rote)) + (this.x * sin(rote))) + this.parent.py;
this.pz = z2 + this.parent.pz;
this.projectionData();
};
Point.prototype.LocateRoteTiltYaw = function (rote, tilt, yaw) {
var y2 = ((this.y * cos(yaw)) - (this.z * sin(yaw)));
var z2 = ((this.z * cos(yaw)) + (this.y * sin(yaw)));
var x2 = ((this.x * cos(tilt)) - (z2 * sin(tilt)));
var z3 = ((z2 * cos(tilt)) + (this.x * sin(tilt)));
this.px = ((x2 * cos(rote)) - (y2 * sin(rote))) + this.parent.px;
this.py = ((y2 * cos(rote)) + (x2 * sin(rote))) + this.parent.py;
this.pz = z3 + this.parent.pz;
this.projectionData();
};
Point.prototype.ProjectionData = function () {
this.depth = filmSpace.perspex / this.py;
this.vx = this.px * (this.depth * 10);
this.vy = (-this.pz) * (this.depth * 10);
this.sc = 100 * (this.depth * 10);
this.vys = (-filmSpace.pz) * (this.depth * 10);
this.sq = filmSpace.pz / this.py;
};
Point.prototype.LocateRoteSrc = function (src) {
this.px = ((this.x * src.cosrote) - (this.y * src.sinrote)) + this.parent.px;
this.py = ((this.y * src.cosrote) + (this.x * src.sinrote)) + this.parent.py;
this.pz = this.z + this.parent.pz;
this.projectionData();
};
Point.prototype.LocateRoteYawSrc = function (pts) {
var L = pts.length;
n = 0;
while (n < L) {
var pt = pts[n];
pt.px = ((pt.x * this.cosrote) - (((pt.y * this.cosyaw) - (pt.z * this.sinyaw)) * this.sinrote)) + pt.parent.px;
pt.py = ((((pt.y * this.cosyaw) - (pt.z * this.sinyaw)) * this.cosrote) + (pt.x * this.sinrote)) + pt.parent.py;
pt.pz = ((pt.z * this.cosyaw) + (pt.y * this.sinyaw)) + pt.parent.pz;
pt.projectionData();
n++;
}
};
Point.prototype.LocateRoteTiltSrc = function (pts) {
var L = pts.length;
n = 0;
while (n < L) {
var pt = pts[n];
pt.px = ((((pt.x * this.costilt) - (pt.z * this.sintilt)) * this.cosrote) - (pt.y * this.sinrote)) + pt.parent.px;
pt.py = ((pt.y * this.cosrote) + (((pt.x * this.costilt) - (pt.z * this.sintilt)) * this.sinrote)) + pt.parent.py;
pt.pz = ((pt.z * this.costilt) + (pt.x * this.sintilt)) + pt.parent.pz;
pt.projectionData();
n++;
}
};
Point.prototype.LocateRoteTiltYawSrc = function (pts) {
var L = pts.length;
n = 0;
while (n < L) {
var pt = pts[n];
var y2 = ((pt.y * this.cosYaw) - (pt.z * this.sinyaw));
var z2 = ((pt.z * this.cosYaw) + (pt.y * this.sinyaw));
var x2 = ((pt.x * this.costilt) - (z2 * this.sinTilt));
var z3 = ((z2 * this.costilt) + (pt.x * this.sinTilt));
pt.px = ((x2 * this.cosRote) - (y2 * this.sinRote)) + pt.parent.px;
pt.py = ((y2 * this.cosRote) + (x2 * this.sinRote)) + pt.parent.py;
pt.pz = z3 + pt.parent.pz;
pt.projectionData();
n++;
}
};
Point.prototype.roteSet = function (rote) {
this.cosRote = cos(rote);
this.sinRote = sin(rote);
};
Point.prototype.yawSet = function (yaw) {
this.cosYaw = cos(yaw);
this.sinYaw = sin(yaw);
};
Point.prototype.tiltSet = function (tilt) {
this.cosTilt = cos(tilt);
this.sinTilt = sin(tilt);
};
Part.prototype.angleSet = function (rote, tilt, yaw) {
this.rote = rote;
this.tilt = tilt;
this.yaw = yaw;
this.cosRote = cos(rote);
this.sinRote = sin(rote);
this.cosYaw = cos(yaw);
this.sinYaw = sin(yaw);
this.cosTilt = cos(tilt);
this.sinTilt = sin(tilt);
};
XYZ.prototype = new Array();
Part.prototype.Place = function (x, y, xs, ys) {
this.form._x = x;
this.form._y = y;
if (xs != undefined) {
this.form._xscale = 100 * xs;
}
if (ys != undefined) {
this.form._yscale = 100 * ys;
}
};
Point.prototype.FullMatch = function (src) {
this.px = src.px;
this.py = src.py;
this.pz = src.pz;
this.depth = src.depth;
this.sc = src.sc;
this.vx = src.vx;
this.vy = src.vy;
this.vys = src.vys;
this.sq = src.sq;
};
Point.prototype.drag = function (path) {
path.form._x = this.vx;
path.form._y = this.vy;
path.form._xscale = this.sc;
path.form._yscale = this.sc;
};
Point.prototype.positionMatch = function (path) {
this.form._x = path.form._x;
this.form._y = path.form._y;
this.form._xscale = path.form._xscale;
this.form._yscale = path.form._yscale;
this.form._rotation = path.form._rotation;
};
Point.prototype.XYZmatch = function (src) {
this.x = src.x;
this.y = src.y;
this.z = src.z;
};
Point.prototype.iXYZmatch = function (src) {
this.ix = src.ix;
this.iy = src.iy;
this.iz = src.iz;
};
Point.prototype.XYZcapture = function () {
this.xi = this.x;
this.yi = this.y;
this.zi = this.z;
};
Part.prototype.AssignColor = function (num, path) {
this.colr = new color(path);
this.colr.setRGB(Palette[num].hex);
};
Part.prototype.setColor = function (colr) {
this.assignColor(colr, this.form);
};
Part.prototype.iColorBlend = function (colr1, colr2) {
this.colors = new Array(Palette[colr1], Palette[colr2]);
};
Part.prototype.ColorBlend = function (frac, colorPair) {
if (colorPair == undefined) {
var colorPair = this.colors;
}
if (frac < 0) {
frac = 0;
} else if (frac > 1) {
frac = 1;
}
this.colorFrac = frac;
var num = (100 * (1 - frac));
var ColorTransform = new Object();
var num2 = frac;
ColorTransform.ra = 0;
ColorTransform.rb = (colorPair[1].rgb[0] * num2) + (colorPair[0].rgb[0] * (1 - num2));
ColorTransform.ga = 0;
ColorTransform.gb = (colorPair[1].rgb[1] * num2) + (colorPair[0].rgb[1] * (1 - num2));
ColorTransform.ba = 0;
ColorTransform.bb = (colorPair[1].rgb[2] * num2) + (colorPair[0].rgb[2] * (1 - num2));
this.colr.setTransform(ColorTransform);
};
Part.prototype.iColorShade = function (num) {
this.setColor(0);
this.shadecolor = Palette[num];
};
Part.prototype.ColorShade = function (frac, colr) {
if (colr != undefined) {
this.shadecolor = Palette[colr];
}
if (frac < 0) {
frac = 0;
} else if (frac > 1) {
frac = 1;
}
var num = (100 * (1 - frac));
var ColorTransform = new Object();
var num2 = frac;
ColorTransform.ra = num;
ColorTransform.rb = this.shadecolor.rgb[0] * num2;
ColorTransform.ga = num;
ColorTransform.gb = this.shadecolor.rgb[1] * num2;
ColorTransform.ba = num;
ColorTransform.bb = this.shadecolor.rgb[2] * num2;
this.colr.setTransform(ColorTransform);
};
Part.prototype.Position = function () {
this.form._x = this.vx;
this.form._y = this.vy;
this.form._xscale = (this.form._yscale = this.sc);
};
Part.prototype.PositionShadow = function () {
this.shadow._x = this.vx;
this.shadow._y = this.vys;
this.shadow._xscale = this.sc;
this.shadow._yscale = this.sc * this.sq;
};
Part.prototype.PositionShadowSrc = function (src) {
this.shadow._x = src.vx;
this.shadow._y = src.vys;
this.shadow._xscale = src.sc;
this.shadow._yscale = src.sc * src.sq;
};
Part.prototype.PositionFull = function () {
this.position();
this.positionShadow();
};
Part.prototype.PositionSimple = function () {
this.form._x = this.vx;
this.form._y = this.vy;
};
Part.prototype.PositionShadowSimple = function () {
this.shadow._x = this.px - this.parent.px;
this.shadow._y = this.py - this.parent.py;
};
Part.prototype.setDepth = function (src) {
if (src != undefined) {
this.form.swapDepths(src.depth * 1000000);
} else {
this.form.swapDepths(this.depth * 1000000);
}
};
Part.prototype.setDepthNum = function (num) {
this.form.swapDepths(num * 1000000);
};
Part.prototype.fore = function (src, int) {
if (int == undefined) {
var int = 1;
}
this.form.swapDepths((src.depth * 1000000) + int);
};
Part.prototype.aft = function (src, int) {
if (int == undefined) {
var int = 1;
}
this.form.swapDepths((src.depth * 1000000) - int);
};
Cell = function (avatar, level, shadowColr) {
this.home = this;
this.parent = this;
this.registry = new Array();
this.level = level;
this.perspex = FilmSpace.perspex;
this.px = filmspace.px;
this.py = filmspace.py;
this.pz = filmspace.pz;
this.build(shadowColr);
this.avatar = new Avatar(this);
this.avatar.zero();
this.avatar.locate();
this.avatar.initialize(q);
this.avatar.enter();
};
Cell.prototype = new Part();
Cell.prototype.build = function (shadowColr) {
this.makeForm("Cell" + this.id, _root, this.level + 2);
this.makeShadow("Cell" + this.id, _root, this.level + 1);
this.form._xscale = (this.form._yscale = 9);
this.form._x = layout.ox;
this.form._y = layout.oy + filmspace.offset;
this.assignColor(shadowColr, this.shadow);
};
function Rectangle(p, colr) {
this.register("Rectangle", p);
this.setColor(colr);
this.Build(this.form);
}
function Bridge(p, path, pt, lnwt, colr, shadow, cvpoint) {
this.register("Bridge", p, shadow);
this.path = path;
this.pt = pt;
this.lw = lnwt;
this.Build(shadow);
this.setColor(colr);
if (cvpoint != undefined) {
this.cvpoint = cvpoint;
this.bridgeBasic = this.bridgeCurved;
} else {
this.bridgeBasic = this.bridgeSimple;
}
if (shadow == 1) {
this.draw = this.bridgeFull;
} else {
this.draw = this.bridgeBasic;
}
}
function limbBridge(p, src, lnwt, colr, shadow) {
this.superClass = Bridge;
this.superClass(p, src.base, src.end, lnwt, colr, shadow, src.mid);
}
function Side(p, otrside, pointSet, formBase, shadow) {
this.superclass = shape;
this.superclass(p, 0, otrside, pointSet, shadow, formBase);
if (otrside != null) {
this.otr = 1;
}
}
Circle = function (p, r, colr, shadow, formbase, kind) {
this.register("Circle", p, shadow, formbase);
this.r = r;
this.setColor(colr);
if (kind == undefined) {
kind = "circle";
}
this.form.attachMovie(kind, "shape", 1);
if (abs(shadow) == 1) {
this.shadow.attachMovie(kind, "shape", 1);
}
if (shadow == 1) {
this.draw = (this.CircleDraw = this.fullDraw);
} else {
this.draw = (this.CircleDraw = this.SimpleDraw);
}
this.normal = new Point(this, 1);
};
Circle.pType(Part);
Circle.prototype.extrabuild = function (shadow) {
if (shadow) {
this.shadow.clear();
this.shadow.createEmptyMovieClip("subshadow", 1);
this.render(this.shadow.subshadow);
}
};
Circle.prototype.SimpleDraw = function () {
this.form._x = this.vx;
this.form._y = this.vy;
this.form._xscale = (this.form._yscale = (this.sc * this.r) / scale);
};
Circle.prototype.FullDraw = function () {
this.form._x = this.vx;
this.form._y = this.vy;
this.form._xscale = (this.form._yscale = (this.sc * this.r) / scale);
this.shadowDraw(src);
};
Circle.prototype.ShadowDraw = function () {
this.shadow._x = this.vx;
this.shadow._y = this.vys;
this.shadow._xscale = (this.sc * this.r) / scale;
this.shadow._yscale = ((this.sc * this.sq) * this.r) / scale;
};
Circle.prototype.ShadowOff = function () {
this.shadow._visible = 0;
this.draw = this.SimpleDraw;
};
Circle.prototype.ShadowOn = function () {
this.shadow._visible = 1;
this.draw = this.FullDraw;
};
Circle.prototype.sizeRatio = function () {
return(this.form._xscale / this.form._yscale);
};
HalfCircle = function (p, r, colr, shadow) {
this.register("HalfCircle", p, shadow);
this.r = r;
this.setColor(colr);
this.src = Circle6;
this.render(this.form);
trace(this.shadow);
if (shadow == 1) {
this.render(this.shadow, ox, oy);
this.draw = (this.CircleDraw = this.fullDraw);
} else if (shadow == -1) {
this.render(this.shadow, ox, oy);
this.draw = (this.CircleDraw = this.SimpleDraw);
} else {
this.draw = (this.CircleDraw = this.SimpleDraw);
}
};
HalfCircle.pType(Circle);
Circle.prototype.render = (Part.prototype.renderCircle = function (path, ox, oy) {
path.attachMovie("circle", "shape", 1);
var ox = ((10 * ox) / this.r);
var oy = ((10 * oy) / this.r);
path.shape._x = ox;
path.shape._y = oy;
});
HalfCircle.prototype.render = (part.prototype.RenderHalfCircle = function (path) {
path.attachMovie("halfcircle", "shape", 1);
});
Disc = function (p, r, colr1, colr2, shadow) {
this.superClass = Circle;
this.superClass(p, r, colr1, shadow);
if (colr2 != null) {
this.colors = new Array(colr1, colr2);
this.sideFace = -1;
this.setColor(this.colors[1]);
}
this.extrabuild(shadow);
this.r = r;
this.draw = function (face, tilt) {
this.CircleDraw();
this.normal.locateRoteTilt(face, tilt);
this.squash(face, tilt, this.normal);
if (this.colors) {
this.sideCheck();
}
};
};
Disc.pType(Circle);
Disc.prototype.squash = function (face, tilt, normal) {
if (normal == undefined) {
normal = this.normal;
}
var d1 = sqrt(((normal.px * normal.px) + (normal.py * normal.py)) + (normal.pz * normal.pz));
var d2 = sqrt(((this.px * this.px) + (this.py * this.py)) + (this.pz * this.pz));
this.form._rotation = atan2(normal.vy - this.vy, normal.vx - this.vx) / (PI / 180);
this.squish = d1 - d2;
this.form._xscale = this.form._xscale * this.squish;
if (this.shadow) {
this.shadow.subshadow._xscale = sin(tilt) * 100;
this.shadow.subshadow._yscale = 100;
this.shadow.subshadow._rotation = face / (PI / 180);
}
};
Disc.prototype.sideCheck = function () {
if ((this.sideFace * this.form._xscale) < 0) {
this.sideFace = this.sideFace * -1;
this.setColor(this.colors[((-this.sideface) / 2) + 0.5]);
}
};
Disc.prototype.mimic = function (path) {
this.form._x = path.vx;
this.form._y = path.vy;
this.form._yscale = (path.sc * this.r) / 10;
this.form._xscale = ((path.sc * path.squish) * this.r) / 10;
this.form._rotation = path.form._rotation;
};
Rectangle.prototype = new Part();
Rectangle.prototype.draw = function (vx1, vy1, vx2, vy2) {
this.form._x = vx1;
this.form._y = vy1;
this.form._xscale = vx2 - vx1;
this.form._yscale = vy2 - vy1;
};
Rectangle.prototype.Build = function (path) {
path.clear();
path.beginFill(16777215);
path.moveTo(0, 0);
path.lineTo(100, 0);
path.lineTo(100, 100);
path.lineTo(0, 100);
path.lineTo(0, 0);
};
Bridge.prototype = new Part();
limbBridge.ptype(bridge);
Bridge.prototype.Build = function (shadow) {
this.render(this.form);
if (shadow != 0) {
this.render(this.shadow);
}
};
Bridge.prototype.BridgeFull = function () {
this.bridgeBasic();
this.BridgeShadow();
};
Bridge.prototype.bridgeSimple = function () {
this.tangentFinder(this.pt.vx - this.path.vx, this.pt.vy - this.path.vy, ((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
this.form.clear();
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
this.form.moveTo(this.pt.vx, this.pt.vy);
this.form.lineTo(this.path.vx + this.xt1, this.path.vy + this.yt1);
this.form.lineTo(this.path.vx + this.xt2, this.path.vy + this.yt2);
this.form.lineTo(this.pt.vx, this.pt.vy);
};
Bridge.prototype.bridgeShadow = function () {
var fac = (this.path.shadow.subshadow._xscale / this.path.shadow.subshadow._yscale);
var dx = (this.pt.vx - this.path.vx);
var dy = ((this.pt.vys - this.path.vys) / this.path.sq);
this.tangentFinder(0, Pyt(dx, dy) / fac, (this.path.r * this.path.depth) * scale);
this.shadow.clear();
this.shadow.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var xo1 = this.xt1;
var xo2 = this.xt2;
var yo1 = (this.yt1 * fac);
var yo2 = (this.yt2 * fac);
var rote = atan2(dy, dx);
this.shadow.moveTo(this.pt.vx, this.pt.vys);
this.shadow.lineTo((this.path.vx + (xo1 * sin(rote))) - (yo1 * cos(rote)), this.path.vys + ((((-yo1) * sin(rote)) - (xo1 * cos(rote))) * this.path.sq));
this.shadow.lineTo((this.path.vx + (xo2 * sin(rote))) - (yo2 * cos(rote)), this.path.vys + ((((-yo2) * sin(rote)) - (xo2 * cos(rote))) * this.path.sq));
this.shadow.lineTo(this.pt.vx, this.pt.vys);
};
Bridge.prototype.bridgeSimpleOval = function (rcheat) {
this.form.clear();
var fac = this.path.sizeRatio();
if ((this.pt.r == 0) or (this.pt.r == undefined)) {
var d = (Pyt(this.pt.vx - this.path.vx, this.pt.vy - this.path.vy) / fac);
var vr = (((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
if (d > vr) {
this.tangentFinder(0, d, vr);
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var xo1 = this.xt1;
var xo2 = this.xt2;
var yo1 = (this.yt1 * fac);
var yo2 = (this.yt2 * fac);
var rote = (((this.path.form._rotation * PI) / 180) + PI);
this.form.moveTo(this.pt.vx, this.pt.vy);
this.form.lineTo((this.path.vx + (xo1 * sin(rote))) - (yo1 * cos(rote)), (this.path.vy - (yo1 * sin(rote))) - (xo1 * cos(rote)));
this.form.lineTo((this.path.vx + (xo2 * sin(rote))) - (yo2 * cos(rote)), (this.path.vy - (yo2 * sin(rote))) - (xo2 * cos(rote)));
this.form.lineTo(this.pt.vx, this.pt.vy);
}
} else {
var vfac = (this.path.r / (this.path.r - this.pt.r));
var vtx = ((this.pt.vx - this.path.vx) * vfac);
var vty = ((this.pt.vy - this.path.vy) * vfac);
var d = (Pyt(vtx, vty) / fac);
var vr = (((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
if (d > vr) {
this.tangentFinder(0, d, vr);
var xo1 = this.xt1;
var xo2 = this.xt2;
var yo1 = (this.yt1 * fac);
var yo2 = (this.yt2 * fac);
var rote = (((this.path.form._rotation * PI) / 180) + PI);
var fac2 = this.pt.sizeRatio();
if (fac2 == 0) {
var fac2 = 0.001;
}
var d2 = (Pyt(vtx - (this.pt.vx - this.path.vx), vty - (this.pt.vy - this.path.vy)) / fac2);
var vr2 = ((abs((this.pt.r - (this.lw / 2)) + rcheat) * this.path.depth) * scale);
this.tangentFinder(0, d2, vr2);
var xo1b = this.xt1;
var xo2b = this.xt2;
var yo1b = (this.yt1 * fac2);
var yo2b = (this.yt2 * fac2);
var roteb = (((this.path.form._rotation * PI) / 180) + PI);
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var ox = ((this.pt.vx + (xo1b * sin(rote))) - (yo1b * cos(rote)));
var oy = ((this.pt.vy - (yo1b * sin(rote))) - (xo1b * cos(rote)));
this.form.moveTo(ox, oy);
this.form.lineTo((this.path.vx + (xo1 * sin(rote))) - (yo1 * cos(rote)), (this.path.vy - (yo1 * sin(rote))) - (xo1 * cos(rote)));
this.form.lineTo((this.path.vx + (xo2 * sin(rote))) - (yo2 * cos(rote)), (this.path.vy - (yo2 * sin(rote))) - (xo2 * cos(rote)));
this.form.lineTo((this.pt.vx + (xo2b * sin(rote))) - (yo2b * cos(rote)), (this.pt.vy - (yo2b * sin(rote))) - (xo2b * cos(rote)));
this.form.lineTo(ox, oy);
}
}
};
Bridge.prototype.bridgeCurved = function () {
this.form.clear();
var d1 = Pyt(this.path.vx - this.pt.vx, this.path.vy - this.pt.vy);
var temp = (Pyt(this.path.vx - this.cvpoint.vx, this.path.vy - this.cvpoint.vy) / d1);
var ratio = (temp * temp);
if (ratio > 1) {
var ratio = 1;
}
this.tangentFinder(((this.cvpoint.vx * ratio) + (this.pt.vx * (1 - ratio))) - this.path.vx, ((this.cvpoint.vy * ratio) + (this.pt.vy * (1 - ratio))) - this.path.vy, ((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var px1 = (this.path.vx + this.xt1);
var py1 = (this.path.vy + this.yt1);
var px2 = (this.path.vx + this.xt2);
var py2 = (this.path.vy + this.yt2);
this.form.moveTo(this.pt.vx, this.pt.vy);
this.form.curveTo((((this.cvpoint.vx * ratio) + (((1 - ratio) * (px1 + this.pt.vx)) / 2)) + px1) / 2, (((this.cvpoint.vy * ratio) + (((1 - ratio) * (py1 + this.pt.vy)) / 2)) + py1) / 2, px1, py1);
this.form.lineTo(px2, py2);
this.form.curveTo((((this.cvpoint.vx * ratio) + (((1 - ratio) * (px2 + this.pt.vx)) / 2)) + px2) / 2, (((this.cvpoint.vy * ratio) + (((1 - ratio) * (py2 + this.pt.vy)) / 2)) + py2) / 2, this.pt.vx, this.pt.vy);
this.form.endFill();
};
Bridge.prototype.bridgeCurved2 = function () {
this.form.clear();
var d1 = Pyt(this.path.vx - this.pt.vx, this.path.vy - this.pt.vy);
var ratio = 0.5;
this.tangentFinder(((this.cvpoint.vx * ratio) + (this.pt.vx * (1 - ratio))) - this.path.vx, ((this.cvpoint.vy * ratio) + (this.pt.vy * (1 - ratio))) - this.path.vy, ((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var px1 = (this.path.vx + this.xt1);
var py1 = (this.path.vy + this.yt1);
var px2 = (this.path.vx + this.xt2);
var py2 = (this.path.vy + this.yt2);
if ((d1 * scale) > ((this.path.r * this.path.sc) / scale)) {
this.form.moveTo(this.pt.vx, this.pt.vy);
this.form.curveTo((this.cvpoint.vx * ratio) + (((1 - ratio) * (px1 + this.pt.vx)) / 2), (this.cvpoint.vy * ratio) + (((1 - ratio) * (py1 + this.pt.vy)) / 2), px1, py1);
this.form.lineTo(px2, py2);
this.form.curveTo((this.cvpoint.vx * ratio) + (((1 - ratio) * (px2 + this.pt.vx)) / 2), (this.cvpoint.vy * ratio) + (((1 - ratio) * (py2 + this.pt.vy)) / 2), this.pt.vx, this.pt.vy);
} else {
trace("humph");
this.form.moveTo(px1, py1);
this.form.curveTo((this.cvpoint.vx * ratio) + ((1 - ratio) * this.pt.vx), (this.cvpoint.vy * ratio) + ((1 - ratio) * this.pt.vy), px2, py2);
}
this.form.endFill();
};
Bridge.prototype.bridgeCurvedEZ = function () {
this.form.clear();
var d1 = Pyt(this.path.vx - this.pt.vx, this.path.vy - this.pt.vy);
var ratio = 0.5;
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var angle = atan2(this.cvpoint.vy - this.path.vy, this.cvpoint.vx - this.path.vx);
var vrad = (((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
var vrx = (vrad * cos(angle + (PI / 2)));
var vry = (vrad * sin(angle + (PI / 2)));
var px1 = (this.path.vx + vrx);
var py1 = (this.path.vy + vry);
var px2 = (this.path.vx - vrx);
var py2 = (this.path.vy - vry);
if ((d1 * scale) > ((this.path.r * this.path.sc) / scale)) {
this.form.moveTo(this.pt.vx, this.pt.vy);
this.form.curveTo((this.cvpoint.vx * ratio) + (((1 - ratio) * (px1 + this.pt.vx)) / 2), (this.cvpoint.vy * ratio) + (((1 - ratio) * (py1 + this.pt.vy)) / 2), px1, py1);
this.form.lineTo(px2, py2);
this.form.curveTo((this.cvpoint.vx * ratio) + (((1 - ratio) * (px2 + this.pt.vx)) / 2), (this.cvpoint.vy * ratio) + (((1 - ratio) * (py2 + this.pt.vy)) / 2), this.pt.vx, this.pt.vy);
} else {
trace("humph");
this.form.moveTo(px1, py1);
this.form.curveTo((this.cvpoint.vx * ratio) + ((1 - ratio) * this.pt.vx), (this.cvpoint.vy * ratio) + ((1 - ratio) * this.pt.vy), px2, py2);
}
this.form.endFill();
};
Bridge.prototype.bridgeCurvedOval = function () {
var d1 = Pyt(this.path.vx - this.pt.vx, this.path.vy - this.pt.vy);
var temp = (Pyt(this.path.vx - this.cvpoint.vx, this.path.vy - this.cvpoint.vy) / d1);
var ratio = (temp * temp);
if (ratio > 1) {
var ratio = 1;
}
var fac = (this.path.form._xscale / this.path.form._yscale);
this.form.clear();
if ((d1 * scale) > (((this.path.r * this.path.sc) / scale) * fac)) {
this.tangentFinder(0, Pyt(this.cvpoint.vx - this.path.vx, this.cvpoint.vy - this.path.vy) / fac, ((this.path.r - (this.lw / 2)) * this.path.depth) * scale);
this.form.beginFill(16777215);
if (this.lw != 0) {
this.form.lineStyle((this.lw * this.path.depth) * scale, 16777215);
}
var xo1 = this.xt1;
var xo2 = this.xt2;
var yo1 = (this.yt1 * fac);
var yo2 = (this.yt2 * fac);
var rote = (((this.path.form._rotation * PI) / 180) + PI);
var px1 = ((this.path.vx + (xo1 * sin(rote))) - (yo1 * cos(rote)));
var px2 = ((this.path.vx + (xo2 * sin(rote))) - (yo2 * cos(rote)));
var py1 = ((this.path.vy - (yo1 * sin(rote))) - (xo1 * cos(rote)));
var py2 = ((this.path.vy - (yo2 * sin(rote))) - (xo2 * cos(rote)));
this.form.moveTo(this.pt.vx, this.pt.vy);
this.form.curveTo((((this.cvpoint.vx * ratio) + (((1 - ratio) * (px1 + this.pt.vx)) / 2)) + px1) / 2, (((this.cvpoint.vy * ratio) + (((1 - ratio) * (py1 + this.pt.vy)) / 2)) + py1) / 2, px1, py1);
this.form.lineTo(px2, py2);
this.form.curveTo((((this.cvpoint.vx * ratio) + (((1 - ratio) * (px2 + this.pt.vx)) / 2)) + px2) / 2, (((this.cvpoint.vy * ratio) + (((1 - ratio) * (py2 + this.pt.vy)) / 2)) + py2) / 2, this.pt.vx, this.pt.vy);
this.form.endFill();
}
};
vLimb = function (p, weight, colr, base, mid, end, lngth, cx) {
this.parent = p;
this.weight = weight;
this.setColor(colr);
if (base == 0) {
this.base = new Point(this.parent);
} else {
this.base = base;
}
if (mid == 0) {
this.mid = new Point(this.base);
} else {
this.mid = mid;
this.mid.parent = this.base;
}
if (end == 0) {
this.end = new Point(this.parent);
} else {
this.end = end;
}
if (cx == undefined) {
if ((mid == undefined) or (mid == 0)) {
this.draw = this.drawStraight;
} else {
this.draw = this.drawJointed;
}
} else {
this.draw = this.drawCurved;
}
this.lngth = lngth;
this.cx = cx;
this.dir = 1;
};
vLimb.ptype(Part);
Limb = function (p, weight, colr, base, mid, end, lngth, cx) {
this.register("Limb", p);
this.superClass = vLimb;
this.superClass(p, weight, colr, base, mid, end, lngth, cx);
};
Limb.ptype(vLimb);
vLimb.prototype.invert = function () {
this.dir = -1;
};
vLimb.prototype.bend = function (twist) {
if (this.end.parent == this.base) {
var rootx = 0;
var rooty = 0;
var rootz = 0;
} else if (this.end.parent == this.base.parent) {
var rootx = this.base.x;
var rooty = this.base.y;
var rootz = this.base.z;
} else {
var rootx = (this.base.x + this.base.parent.x);
var rooty = (this.base.y + this.base.parent.y);
var rootz = (this.base.z + this.base.parent.z);
}
var dx = (this.end.x - rootx);
var dy = Pyt(this.end.z - rootz, this.end.y - rooty);
var vRote = atan2(this.end.y - rooty, this.end.z - rootz);
var angle = atan2(dy, dx);
var kiX = (sqrt((dx * dx) + (dy * dy)) / 2);
if (this.cx != undefined) {
var mcx = ((((this.lngth * 2) - (kiX * 2)) * this.cx) / (this.lngth * 2));
if (mcx < 0) {
var mcx = 0;
}
}
L = (this.lngth * (1 + mcx)) * (1 + mcx);
if (kiX < L) {
var kiY = ((-sqrt((L * L) - (kiX * kiX))) * this.dir);
} else {
var kiY = 0;
}
this.mid.x = (kiX * cos(-angle)) + (kiY * sin(-angle));
this.mid.z = ((kiY * cos(-angle)) - (kiX * sin(-angle))) * cos(vRote);
this.mid.y = ((kiY * cos(-angle)) - (kiX * sin(-angle))) * sin(vRote);
};
Limb.prototype.drawJointed = function (rote, tilt) {
this.bend();
if (rote == undefined) {
this.mid.locateRote(this.face);
} else if (tilt != undefined) {
this.mid.locateRoteTilt(rote, tilt);
} else {
this.mid.locateRote(rote);
}
this.form.clear();
this.form.lineStyle((this.Weight * this.mid.depth) * scale, 16777215);
this.form.moveTo(this.base.vx, this.base.vy);
this.form.lineTo(this.mid.vx, this.mid.vy);
this.form.lineTo(this.end.vx, this.end.vy);
if (this.mid.form != undefined) {
this.mid.draw();
}
};
Limb.prototype.drawStraight = function () {
this.form.clear();
this.form.lineStyle((this.Weight * this.base.depth) * scale, 16777215);
this.form.moveTo(this.base.vx, this.base.vy);
this.form.lineTo(this.end.vx, this.end.vy);
};
Limb.prototype.drawCurved = function (face) {
if (face == undefined) {
face = this.face;
}
this.bend();
this.mid.locateRote(face);
this.form.clear();
this.form.lineStyle((this.Weight * this.mid.depth) * scale, 16777215);
this.form.moveTo(this.base.vx, this.base.vy);
this.form.curveTo(this.mid.vx, this.mid.vy, this.end.vx, this.end.vy);
};
Limb.prototype.drawFixed = function (face) {
this.form.clear();
this.form.lineStyle((this.Weight * this.mid.depth) * scale, 16777215);
this.form.moveTo(this.base.vx, this.base.vy);
this.form.lineTo(this.mid.vx, this.mid.vy);
this.form.lineTo(this.end.vx, this.end.vy);
};
Limb.prototype.zero = function () {
this.end.zero();
this.base.zero();
this.mid.zero();
};
Dome = function (p, r, colr1, colr2, shadow, formbase, offset) {
this.register("Dome", p, Math.ceil(shadow), formbase);
this.r = r;
if (shadow == 0.5) {
this.nose = new HalfCircle(this, r, colr1, 0);
this.base = new Disc(this, r, colr2, colr1, -1);
} else {
this.nose = new HalfCircle(this, r, colr1, abs(shadow) * -1);
this.base = new Disc(this, r, colr2, colr1, abs(shadow) * -1);
}
this.base.x = offset;
this.normal = this.base.normal;
};
Dome.ptype(Circle);
Dome.prototype.Draw = function (face, tilt) {
this.base.r = (this.nose.r = this.r);
this.base.FullMatch(this);
this.base.Draw(face, tilt);
this.nose.vx = this.vx;
this.nose.vy = this.vy;
this.nose.sc = this.sc;
this.nose.Draw();
this.nose.form._rotation = this.base.form._rotation;
if (this.shadow != undefined) {
this.ShadowDraw(this);
if (this.nose.shadow != undefined) {
this.nose.shadow._rotation = face / (PI / 180);
this.nose.shadow._xscale = (((100 * cos(tilt)) * cos(tilt)) * cos(tilt)) / abs(cos(tilt));
}
}
};
Part.prototype.drawCircuit = function (pointSet) {
this.depth = 0;
var L = this.pointSet.length;
var pt = this.pointSet[L - 1];
this.form.moveTo(pt.vx, pt.vy);
n = 0;
while (n < L) {
var pt = this.pointSet[n];
this.form.lineTo(pt.vx, pt.vy);
this.depth = this.depth + (pt.depth / L);
n++;
}
};
Part.prototype.drawShadowCircuit = function (pointSet) {
var L = this.pointSet.length;
var pt = this.pointSet[L - 1];
this.shadow.moveTo(pt.vx, pt.vys);
n = 0;
while (n < L) {
var pt = this.pointSet[n];
this.shadow.lineTo(pt.vx, pt.vys);
n++;
}
};
Shape = function (p, colr1, colr2, pointSet, shadow, formBase) {
this.register("Shape", p, shadow, formBase);
this.sideface = (this.iSideface = 1);
this.kolors = new Array(colr1, colr2);
this.setColor(colr1);
this.pointSet = pointSet;
};
Shape.pType(Part);
Shape.prototype.Draw = function () {
this.form.clear();
this.form.beginFill(16777215);
this.drawCircuit(this.pointSet);
if (this.sideCheck() != this.isideFace) {
this.isideFace = this.sideface;
this.setColor(this.kolors[(this.sideFace / 2) + 0.5]);
}
if (this.shadow) {
this.shadow.clear();
this.shadow.beginFill(16777215);
this.drawShadowCircuit(this.pointSet);
}
};
ThickShape = function (p, lnwt, colr, pointSet, shadow, formBase) {
this.register("Shape", p, shadow, formBase);
this.weight = lnwt;
this.setColor(colr);
this.pointSet = pointSet;
};
ThickShape.pType(Shape);
ThickShape.prototype.Draw = function () {
this.form.clear();
this.form.lineStyle((this.weight * this.pointset[0].depth) * scale, 16777215);
this.form.beginFill(16777215);
this.drawCircuit(this.pointSet);
if (this.shadow) {
this.shadow.clear();
this.shadow.beginFill(16777215);
this.drawShadowCircuit(this.pointSet);
}
};
Shape.prototype.setDepth = function () {
this.depth = (this.pointset[0].depth + this.pointset[2].depth) / 2;
this.setDepthNum(this.depth);
};
Shape.prototype.sideCheck = function () {
var dangle = (atan2(this.pointSet[1].vy - this.pointSet[0].vy, this.pointSet[1].vx - this.pointSet[0].vx) - atan2(this.pointSet[2].vy - this.pointSet[0].vy, this.pointSet[2].vx - this.pointSet[0].vx));
if (sin(dangle) > 0) {
this.sideface = 1;
} else {
this.sideface = -1;
}
return(this.sideface);
};
Side.pType(Shape);
Side.prototype.Draw = function () {
this.form.clear();
if ((this.sideCheck() == 1) or (this.otr == 1)) {
this.form.beginFill(16777215);
this.DrawCircuit(this.pointset);
}
if (this.shadow != undefined) {
this.shadow.clear();
this.shadow.beginFill(16777215);
this.drawShadowCircuit(this.pointSet);
}
};
Side.prototype.Draw2 = function () {
this.form.clear();
this.form.beginFill(16777215);
this.DrawCircuit(this.pointset);
if (this.shadow) {
this.shadow.clear();
this.shadow.beginFill(16777215);
this.drawShadowCircuit(this.pointSet);
}
};
Side.prototype.Blend = function () {
var tilt = ((this.pointSet[0].pz - this.pointSet[2].pz) / (this.unit * 2));
this.ColorBlend(tilt);
};
BasicCube = function (p, unit, topcolr, btmcolr, shadow, xs, ys, zs) {
if (xs == undefined) {
var xs = 1;
}
if (ys == undefined) {
var ys = 1;
}
if (zs == undefined) {
var zs = 1;
}
this.formbase = formbase;
this.register("BasicCube", p, shadow);
this.unit = unit;
this.pts = new Array();
this.sides = new Array();
n = 0;
while (n < 8) {
var j = n;
var a = ((Math.floor(j / 4) - 0.5) * 2);
if (j >= 4) {
j = j - 4;
}
var b = ((Math.floor(j / 2) - 0.5) * 2);
if (j >= 2) {
j = j - 2;
}
var c = ((Math.floor(j) - 0.5) * 2);
this.pts[n] = new Point(this, (unit * a) * xs, (unit * b) * ys, (unit * c) * zs);
n++;
}
var set0 = new Array(this.pts[0], this.pts[1], this.pts[3], this.pts[2]);
var set1 = new Array(this.pts[4], this.pts[6], this.pts[7], this.pts[5]);
var set2 = new Array(this.pts[6], this.pts[2], this.pts[3], this.pts[7]);
var set3 = new Array(this.pts[5], this.pts[1], this.pts[0], this.pts[4]);
var set4 = new Array(this.pts[7], this.pts[3], this.pts[1], this.pts[5]);
var set5 = new Array(this.pts[4], this.pts[0], this.pts[2], this.pts[6]);
this.colors = new array(Palette[btmcolr], Palette[topcolr]);
if (formbase == undefined) {
this.formbase = this;
} else {
this.formbase = formbase;
}
n = 0;
while (n < 6) {
this.sides[n] = new Side(this.parent, null, eval ("set" + n), this.formbase);
n++;
}
this.cpoint = this.pts[0];
};
BasicCube.pType(Part);
BasicCube.prototype.addLid = function (insidecolor) {
this.insideColor = insidecolor;
this.hinge = new Point(this);
this.hinge.x = -this.unit;
this.hinge.z = this.unit;
var h = this.hinge;
var u = this.unit;
var topSet = new Array(new Point(h, 2 * u, u), new Point(h, 2 * u, -u), new Point(h, 0, -u), new Point(h, 0, u));
this.lid = new side(this.parent, 0, topSet, this.formbase, 1);
};
BasicCube.prototype.drawLid = function (angle) {
this.sides[4].setColor(this.insideColor);
this.hinge.locateRote(this.face);
this.hinge.roteSet(this.face);
this.hinge.tiltSet(angle);
this.hinge.locateRoteTiltSrc(this.lid.pointset);
this.lid.draw();
this.lid.ColorBlend(0.5 - ((this.lid.sideFace * 0.5) * cos(angle)), this.colors);
if ((sin(angle) > 0) and (this.lid.sideface == -1)) {
trace("fore");
this.lid.fore(this.sides[4], 3);
} else {
this.lid.setDepth();
}
};
BasicCube.prototype.Draw = (BasicCube.prototype.BasicDraw = function (face, tilt) {
while (tilt < ((-PI) / 2)) {
tilt = tilt + (PI / 2);
}
while (tilt > 0) {
tilt = tilt - (PI / 2);
}
this.cpoint.roteSet(face);
this.cpoint.tiltSet(tilt);
this.cpoint.locateRoteTiltSrc(this.pts);
var L = this.sides.length;
sn = 0;
while (sn < L) {
this.sides[sn].draw();
if (this.sides[sn].sideface == 1) {
this.shade(this.sides[sn]);
}
sn++;
}
if (this.shadow != undefined) {
var shadowPts = new Array(this.pts[7], this.pts[5], this.pts[0], this.pts[2]);
this.shadow.clear();
this.shadow.beginFill(16777215);
this.shadow.moveTo(shadowPts[0].vx, shadowPts[0].vys);
this.shadow.lineTo(shadowPts[1].vx, shadowPts[1].vys);
this.shadow.lineTo(shadowPts[2].vx, shadowPts[2].vys);
this.shadow.lineTo(shadowPts[3].vx, shadowPts[3].vys);
this.shadow.lineTo(shadowPts[0].vx, shadowPts[0].vys);
}
});
BasicCube.prototype.Shade = function (path) {
path.ColorBlend(0.5 + ((0.5 * (((path.pointSet[0].pz + path.pointSet[2].pz) / 2) - this.pz)) / this.unit), this.colors);
};
BasicCube.prototype.setDepth = function () {
if ((this.formbase == this) and (this.lid == undefined)) {
this.setDepthNum(this.depth);
} else if (this.lid == undefined) {
sn = 0;
while (sn < 6) {
if (this.sides[sn].sideface == 1) {
this.sides[sn].setDepth();
}
sn++;
}
} else {
this.setDepthNum(this.depth);
sn = 0;
while (sn < 6) {
if (this.sides[sn].sideface == 1) {
this.sides[sn].setDepth();
}
sn++;
}
}
};
BasicCube.prototype.stackDepth = function (face) {
var num = ((((((((-(this.x - (q.boxunit * 2))) * cos(PI / 4)) * 80) * sin(face)) - ((((this.y + (q.boxunit * 2)) * 80) * cos(PI / 4)) * cos(face))) + (((this.z - q.boxunit) * sin(PI / 4)) * 20)) + 2000) / 2);
if (this.formbase == this) {
this.setDepthNum(num);
} else {
sn = 0;
while (sn < 6) {
if (this.sides[sn].sideface == 1) {
this.sides[sn].setDepthNum(num + sn);
}
sn++;
}
}
};
BasicCube.prototype.appear = function () {
n = 0;
while (n < 6) {
this.sides[n].appear();
n++;
}
};
BasicCube.prototype.disappear = function () {
n = 0;
while (n < 6) {
this.sides[n].disappear();
n++;
}
};
function Loke(parent, kind, legSrc, dataSrc, fulcrum) {
if (dataSrc == undefined) {
var dataSrc = q;
}
this.parent = parent;
this.x = this.parent.x;
this.y = this.parent.y;
this.cz = this.parent.center.z;
this.state = 1;
this.osc = 0;
switch (kind) {
case "hop" :
this.model = this.HopModel;
this.leg = new DataLeg(legsrc, 0, dataSrc.unit);
this.legs = new Array(this.leg);
break;
case "run" :
this.model = this.RunModel;
this.legs = new Array(new DataLeg(legSrc[0], -1, dataSrc.unit), new DataLeg(legSrc[1], 1, dataSrc.unit));
this.aLeg = this.legs[0];
this.iLeg = this.legs[1];
break;
case "walk" :
this.model = this.WalkModel;
this.legs = new Array(new DataLeg(legSrc[0], -1, dataSrc.unit), new DataLeg(legSrc[1], 1, dataSrc.unit));
this.aLeg = this.legs[0];
this.iLeg = this.legs[1];
break;
case "roll" :
this.model = this.RollModel;
this.legs = new Array(new DataLeg(legSrc[0], -1, dataSrc.unit), new DataLeg(legSrc[1], 1, dataSrc.unit));
this.aLeg = this.legs[0];
this.iLeg = this.legs[1];
break;
case "tri" :
this.model = this.TriWalkModel;
this.legs = new Array(new DataLeg(legSrc[0], 0, dataSrc.unit), new DataLeg(legSrc[1], 0, dataSrc.unit), new DataLeg(legSrc[2], 0, dataSrc.unit));
this.aLeg = this.legs[0];
this.iLegA = this.legs[1];
this.iLegB = this.legs[2];
}
if (fulcrum == undefined) {
this.fulcrum = legSrc[0].base.parent;
} else {
this.fulcrum = fulcrum;
}
this.lokeSet(dataSrc.czo, dataSrc.fxo, dataSrc.zo, dataSrc.unit, dataSrc.yw1, dataSrc.yw2, dataSrc.tBmx, dataSrc.sF, dataSrc.cF, dataSrc.ob);
}
Loke.prototype.LokeSet = function (czo, fxo, zo, unit, yw1, yw2, tBmx, sF, cF, ob) {
this.czo = czo;
this.fxo = fxo;
this.zo = zo;
this.unit = unit;
this.yw1 = yw1;
this.yw2 = yw2;
this.tBmx = tBmx;
this.sF = sF;
this.cF = cF;
this.ob = ob;
};
Loke.prototype.VarSuck = function (src) {
this.czo = src.czo;
this.fxo = src.fxo;
this.zo = src.zo;
this.unit = src.unit;
this.yw1 = src.yw1;
this.yw2 = src.yw2;
this.tBmx = src.tBmx;
this.sF = src.sF;
this.cF = src.cF;
this.ob = src.ob;
var L = this.legs.length;
n = 0;
while (n < L) {
this.legs[n].unit = this.unit;
n++;
}
};
DataLeg = function (src, side, unit) {
this.src = src;
this.sz = 1;
this.unit = unit;
this.__proto__ = this.src;
if (side != 0) {
this.side = side;
}
this.ankle = new Point();
this.ankle.x = src.end.x;
this.ankle.y = src.end.y;
this.ankle.z = src.end.z;
};
Dataleg.prototype = new Point();
Loke.prototype.process = (Loke.prototype.regProcess = function (v, vm) {
this.prepare(v);
this.model(this.v, vm);
this.transmit();
});
Loke.prototype.prepare = function (v) {
if (((this.fulcrum.x == 0) or (this.fulcrum == undefined)) or (this.fulcrum.x == undefined)) {
this.turn = this.parent.turn;
this.face = this.parent.face;
this.v = v;
} else {
var xo = this.fulcrum.x;
var yd = (sin(this.parent.turn) * xo);
this.face = atan2(yd, v) + this.parent.face;
this.turn = this.face - this.iface;
if (this.turn < ((-PI) * 2)) {
this.turn = this.turn + (PI * 2);
} else if (this.turn > (PI * 2)) {
this.turn = this.turn - (PI * 2);
}
this.iface = this.face;
this.v = sqrt((v * v) + (yd * yd));
}
};
Loke.prototype.transmit = function () {
q.tip = this.tip;
this.fulcrum.z = this.cz + this.czo;
this.feetMatch(this.legs.length);
};
Loke.prototype.attachTo = function (path) {
this.fulcrum = path;
var LN = this.legs.length;
n = 0;
while (n < LN) {
this.legs[n].src.base.attachTo(path);
this.legs[n].src.mid.attachTo(this.legs[n].src.base);
this.legs[n].src.end.attachTo(path);
n++;
}
};
Loke.prototype.LokeSync = function (src) {
this.osc = src.osc;
this.oscAdd = src.oscAdd;
this.state = src.state;
this.vzi = src.vzi;
this.vz = src.vz;
this.cz = src.cz;
this.airTime = src.airTime;
this.airCycle = src.airCycle;
this.vh = src.vh;
this.tip = src.tip;
};
Loke.prototype.feetMatch = function (num) {
n = 0;
while (n < num) {
var leg = this.legs[n];
leg.src.footTip = leg.footTip;
leg.src.footFace = leg.footFace;
leg.end.XYZmatch(leg.ankle);
leg.end.z = leg.end.z - this.czo;
n++;
}
};
Loke.prototype.wasMatch = (Loke.prototype.Match = function (src) {
this.lokeSync(src);
if (src.aleg == src.legs[0]) {
this.aleg = this.legs[0];
this.ileg = this.legs[1];
} else {
this.aleg = this.legs[1];
this.ileg = this.legs[0];
}
this.aleg.ankle.xyzMatch(src.aleg.ankle);
this.ileg.ankle.xyzMatch(src.ileg.ankle);
this.aleg.ankle.ixyzMatch(src.aleg.ankle);
this.ileg.ankle.ixyzMatch(src.ileg.ankle);
this.aleg.airfrac = src.aleg.airfrac;
this.ileg.airfrac = src.ileg.airfrac;
});
Loke.prototype.legSwitch = function () {
if (this.aLeg == this.legs[0]) {
this.aLeg = this.legs[1];
this.iLeg = this.legs[0];
} else {
this.aLeg = this.legs[0];
this.iLeg = this.legs[1];
}
};
Loke.prototype.RunModel = function (v, vm) {
this.vh = v;
this.tB = (this.tBmx * (v / vm)) + 0.0001;
if ((this.vzi == undefined) or (this.vzi == 0)) {
this.thrust = (this.unit * sin(this.oscAdd)) * this.sF;
this.vzi = this.thrust * cos(this.tB);
}
this.oscAdd = (Math.asin(v / ((sin(this.tB) * this.unit) * this.sF)) * v) / vm;
this.airGapCycle = (2 * this.vzi) / grav;
this.groundCycle = PI / this.oscAdd;
this.airCycle = this.groundCycle + (this.airGapCycle * 2);
switch (this.state) {
case 1 :
this.osc = this.osc + this.oscAdd;
if (this.osc > (PI / 2)) {
var springInc = ((this.osc - (PI / 2)) / this.oscAdd);
this.osc = PI / 2;
this.Spring(this.aLeg, 1 - springInc);
this.Launch(this.aLeg);
this.airGapCycle = (2 * this.vzi) / grav;
this.airCycle = this.groundCycle + (this.airGapCycle * 2);
this.Airborne(springInc);
this.iLeg.airFrac = ((springInc + this.airGapCycle) + this.groundCycle) / this.airCycle;
this.aLeg.airFrac = springInc / this.airCycle;
this.airLegFlex(this.aLeg, this.aLeg.airFrac);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
this.state = 2;
break;
}
this.aLeg.airFrac = ((this.osc - (PI / 2)) / this.oscAdd) / this.airCycle;
this.iLeg.airFrac = this.aLeg.airFrac + ((this.airGapCycle + this.groundCycle) / this.airCycle);
this.Spring(this.aLeg, 1);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
break;
case 2 :
if (this.iLeg.airFrac <= (1 - (1 / this.airCycle))) {
this.Airborne(1);
this.aLeg.airFrac = this.aLeg.airFrac + (1 / this.airCycle);
this.iLeg.airFrac = this.iLeg.airFrac + (1 / this.airCycle);
this.airLegFlex(this.aLeg, this.aLeg.airFrac);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
} else {
this.Airborne((1 - this.iLeg.airFrac) * this.airCycle);
this.airLegFlex(this.iLeg, 1);
this.aLeg.airFrac = this.aLeg.airFrac + (1 / this.airCycle);
this.iLeg.airFrac = this.iLeg.airFrac + (1 / this.airCycle);
this.osc = ((-PI) / 2) + (((this.iLeg.airFrac - 1) * this.oscAdd) * this.airCycle);
this.legSwitch();
this.Spring(this.aLeg, (this.aLeg.airFrac - 1) * this.airCycle);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
this.state = 1;
}
}
var TEMPvzi = (((this.unit * sin(this.oscAdd)) * this.sF) * cos(this.tB));
var TEMPairGapCycle = ((2 * TEMPvzi) / grav);
var wholeCycle = (2 * (TEMPairGapCycle + this.groundCycle));
if (this.state == 1) {
var halfcycle = ((this.osc + (PI / 2)) / this.oscAdd);
} else {
var halfcycle = ((PI / this.oscAdd) + (this.aleg.airfrac * this.airCycle));
}
if (this.aleg == this.legs[0]) {
var time = halfcycle;
} else {
var time = ((wholecycle / 2) + halfcycle);
}
this.cycle = ((2 * PI) * time) / wholeCycle;
};
Loke.prototype.WalkModel = function (v, vm) {
this.spd = v / vm;
this.vh = v;
this.tB = this.tBmx;
this.stride = ((sin(this.TB) * this.unit) / 2) * (0.7 + ((0.3 * v) / vm));
this.oscAdd = (PI * v) / (this.stride * 2);
this.osc = this.osc + this.oscAdd;
if (this.osc > (PI / 2)) {
this.WalkSpring(this.aLeg, ((PI / 2) - (this.osc - this.oscAdd)) / this.oscAdd);
this.airLegFlexWalk(this.iLeg, 1);
this.legSwitch();
this.osc = this.osc - PI;
this.WalkSpring(this.aLeg, (this.osc + (PI / 2)) / this.oscAdd);
} else {
this.WalkSpring(this.aLeg, 1);
}
this.iLeg.airFrac = (this.osc + (PI / 2)) / PI;
this.airLegFlexWalk(this.iLeg, this.iLeg.airFrac);
};
Loke.prototype.Spring = function (path, inc) {
var ankle = path.ankle;
var turn = (this.turn * inc);
this.tip = this.tB * sin(this.osc);
var extension = (path.unit - ((path.unit * cos(this.osc)) * this.sF));
this.cz = (cos(this.tip) * extension) - this.zo;
this.thrust = (path.unit * sin(this.oscAdd)) * this.sF;
ankle.z = ((-cos(this.tip)) * extension) - this.zo;
ankle.x = ankle.x - ((this.vh * cos(turn)) * inc);
ankle.y = ankle.y - ((this.vh * sin(turn)) * inc);
var tpx = (ankle.x - this.fxo);
var tpy = ankle.y;
ankle.x = ((tpx * cos(turn)) + (tpy * sin(turn))) + this.fxo;
ankle.y = (tpy * cos(turn)) - (tpx * sin(turn));
path.foottip = PI / 2;
};
Loke.prototype.TriWalkSpring = function (path, inc) {
var ankle = path.ankle;
ankle.ix = ankle.x;
ankle.iy = ankle.y;
var turn = (this.turn * inc);
this.tip = this.tb * sin(this.osc);
var extension = (path.unit - (((path.unit * (cos(this.osc * 2) + 1)) / 2) * this.sF));
var spring = (extension * cos(this.tip));
this.cz = spring - this.zo;
ankle.z = (-spring) - this.zo;
ankle.x = ankle.x - ((this.v * cos(turn)) * inc);
ankle.y = ankle.y - ((this.v * sin(turn)) * inc);
var tpx = (ankle.x - this.fxo);
var tpy = ankle.y;
ankle.x = ((tpx * cos(turn)) + (tpy * sin(turn))) + this.fxo;
ankle.y = (tpy * cos(turn)) - (tpx * sin(turn));
};
Loke.prototype.WalkSpring = function (path, inc) {
var ankle = path.ankle;
ankle.ix = ankle.x;
ankle.iy = ankle.y;
var turn = (this.turn * inc);
this.tip = this.tB * sin(this.osc);
var extension = (path.unit - (((path.unit * (cos(this.osc * 2) + 1)) / 2) * this.sF));
var spring = (cos(this.tip) * extension);
ankle.z = (-spring) - this.zo;
this.cz = spring - this.zo;
ankle.x = ankle.x - ((this.v * cos(turn)) * inc);
ankle.y = ankle.y - ((this.v * sin(turn)) * inc);
var tpx = (ankle.x - this.fxo);
var tpy = ankle.y;
ankle.x = ((tpx * cos(turn)) + (tpy * sin(turn))) + this.fxo;
ankle.y = (tpy * cos(turn)) - (tpx * sin(turn));
};
Loke.prototype.WalkSpring2 = function (path, inc) {
var ankle = path.ankle;
ankle.ix = ankle.x;
ankle.iy = ankle.y;
var turn = (this.turn * inc);
this.tip = this.tb * sin(this.osc);
var extension = (path.unit - (((path.unit * (cos(this.osc * 2) + 1)) / 2) * this.ob));
var spring = (cos(this.tip) * extension);
this.cz = spring - this.zo;
ankle.z = (-spring) - this.zo;
ankle.x = ankle.x - ((this.v * cos(turn)) * inc);
ankle.y = ankle.y - ((this.v * sin(turn)) * inc);
var tpx = (ankle.x - this.fxo);
var tpy = ankle.y;
ankle.x = ((tpx * cos(turn)) + (tpy * sin(turn))) + this.fxo;
ankle.y = (tpy * cos(turn)) - (tpx * sin(turn));
};
Loke.prototype.AirLegFlex = function (path, frac) {
trace("aflex");
var ankle = path.ankle;
var xi = ankle.x;
var zi = ankle.z;
var t = (2 * (frac - 0.5));
if (t < 0) {
ankle.x = (-ankle.ix) * t;
ankle.y = ((-ankle.iy) * t) + ((this.yw2 * path.side) * (1 + t));
} else {
var stride = (path.unit * sin(this.tB));
ankle.x = (stride + this.fxo) * t;
ankle.y = ((this.yw2 * path.side) * (1 - t)) + ((this.yw1 * path.side) * t);
}
var contract = (1 - (((cos(t * PI) + 1) / 2) * this.cF));
path.foottip = (((atan2(path.src.mid.z - ankle.z, path.src.mid.x - ankle.x) - (PI / 2)) * scurve(1 - abs(t))) - ((PI / 4) * scurve(1 - (t * t)))) + (PI / 2);
path.footface = this.parent.face;
ankle.z = (((-path.unit) * cos(this.tip)) * contract) - this.zo;
ankle.dx = ankle.x - xi;
ankle.dz = ankle.z - zi;
};
Loke.prototype.AirLegFlexWalk = function (path, frac) {
var ankle = path.ankle;
var t = (2 * (frac - 0.5));
if (t < 0) {
ankle.x = (-ankle.ix) * sin((t * PI) / 2);
ankle.y = (ankle.iy * scurve(-t)) + ((this.yw2 * path.side) * scurve(1 + t));
} else {
var stride = this.stride;
ankle.x = ((stride * sin(this.tB)) + this.fxo) * sin((t * PI) / 2);
ankle.y = ((this.yw2 * path.side) * scurve(1 - t)) + ((this.yw1 * path.side) * scurve(t));
}
var contract = ((1 - ((cos(PI * (frac - 0.5)) * this.cF) * this.spd)) - (0.25 * (1 - this.spd)));
path.foottip = (((atan2(path.src.mid.z - ankle.z, path.src.mid.x - ankle.x) - (PI / 2)) * (1 - abs(t))) - ((PI / 4) * (1 - (t * t)))) + (PI / 2);
path.footface = this.parent.face;
ankle.z = (((-path.unit) * cos(this.tip)) * contract) - this.zo;
};
Loke.prototype.JumpAirLegFlex = function (path, frac) {
var ankle = path.ankle;
var xi = ankle.x;
var zi = ankle.z;
var t = (2 * (frac - 0.5));
var footangle = ((PI / 2) - (t * (PI - this.tb)));
var extension = (path.unit - ((path.unit * cos((t * PI) / 2)) * this.cf));
var tz = (extension * sin(footangle));
var tx = (extension * cos(footangle));
if (t < 0) {
ankle.x = (tx * (1 - (t * t))) + ((ankle.ix * t) * t);
ankle.y = (-ankle.iy) * t;
ankle.z = tz + q.czo;
path.footTip = ((footangle + (PI / 2)) * (1 + t)) - (((5 * PI) / 2) * t);
} else {
ankle.y = 0;
ankle.x = tx;
ankle.z = tz + q.czo;
path.footTip = ((footangle + (PI / 2)) * (1 - t)) + ((PI / 2) * t);
}
ankle.dx = ankle.x - xi;
ankle.dz = ankle.z - zi;
};
Loke.prototype.Airborne = function (inc) {
this.vz = this.vz + (((-grav) * inc) / 2);
this.tip = this.tB * (this.vz / this.vzi);
this.x = this.x + ((this.vh * cos(this.face)) * inc);
this.y = this.y + ((this.vh * sin(this.face)) * inc);
this.cz = this.cz + (this.vz * inc);
this.vz = this.vz + (((-grav) * inc) / 2);
};
Loke.prototype.Launch = function (path) {
var ankle = path.ankle;
this.vz = (this.vzi = this.thrust * cos(this.tB));
ankle.ix = ankle.x;
ankle.iy = ankle.y;
ankle.iz = ankle.z;
};
being.prototype.legSet = function (path) {
path.cx = q.cx;
path.lngth = q.LL;
path.weight = q.LW;
path.appear();
};
Loke.prototype.RunModel = function (v, vm) {
this.spd = v / vm;
this.vh = v;
this.tB = (this.tBmx * (v / vm)) + 0.0001;
if ((this.vzi == undefined) or (this.vzi == 0)) {
this.thrust = (this.unit * sin(this.oscAdd)) * this.sF;
this.vzi = this.thrust * cos(this.tB);
}
this.oscAdd = (((PI / 2) * Math.asin(v / (sin(this.tB) * this.unit))) * v) / vm;
this.airGapCycle = (-(2 * this.vzi)) / grav;
this.groundCycle = PI / this.oscAdd;
this.airCycle = this.groundCycle + (this.airGapCycle * 2);
switch (this.state) {
case 1 :
this.osc = this.osc + this.oscAdd;
if (this.osc > (PI / 2)) {
var springInc = ((this.osc - (PI / 2)) / this.oscAdd);
this.osc = PI / 2;
this.Spring(this.aLeg, 1 - springInc);
this.Launch(this.aLeg);
this.airGapCycle = (-(2 * this.vzi)) / grav;
this.airCycle = this.groundCycle + (this.airGapCycle * 2);
this.Airborne(springInc);
this.iLeg.airFrac = ((springInc + this.airGapCycle) + this.groundCycle) / this.airCycle;
this.aLeg.airFrac = springInc / this.airCycle;
this.airLegFlex(this.aLeg, this.aLeg.airFrac);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
this.state = 2;
break;
}
this.aLeg.airFrac = ((this.osc - (PI / 2)) / this.oscAdd) / this.airCycle;
this.iLeg.airFrac = this.aLeg.airFrac + ((this.airGapCycle + this.groundCycle) / this.airCycle);
this.Spring(this.aLeg, 1);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
break;
case 2 :
if (this.iLeg.airFrac <= (1 - (1 / this.airCycle))) {
this.Airborne(1);
this.aLeg.airFrac = this.aLeg.airFrac + (1 / this.airCycle);
this.iLeg.airFrac = this.iLeg.airFrac + (1 / this.airCycle);
this.airLegFlex(this.aLeg, this.aLeg.airFrac);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
} else {
this.Airborne((1 - this.iLeg.airFrac) * this.airCycle);
this.airLegFlex(this.iLeg, 1);
this.aLeg.airFrac = this.aLeg.airFrac + (1 / this.airCycle);
this.iLeg.airFrac = this.iLeg.airFrac + (1 / this.airCycle);
this.osc = ((-PI) / 2) + (((this.iLeg.airFrac - 1) * this.oscAdd) * this.airCycle);
this.legSwitch();
this.Spring(this.aLeg, (this.aLeg.airFrac - 1) * this.airCycle);
this.airLegFlex(this.iLeg, this.iLeg.airFrac);
this.state = 1;
}
}
var TEMPvzi = (((this.unit * sin(this.oscAdd)) * this.sF) * cos(this.tB));
var TEMPairGapCycle = ((-(2 * TEMPvzi)) / grav);
var wholeCycle = (2 * (TEMPairGapCycle + this.groundCycle));
if (this.state == 1) {
var halfcycle = ((this.osc + (PI / 2)) / this.oscAdd);
} else {
var halfcycle = ((PI / this.oscAdd) + (this.aleg.airfrac * this.airCycle));
}
if (this.aleg == this.legs[0]) {
var time = halfcycle;
} else {
var time = ((wholecycle / 2) + halfcycle);
}
this.cycle = ((2 * PI) * time) / wholeCycle;
};
Loke.prototype.AirLegFlex = function (path, frac) {
var ankle = path.ankle;
var xi = ankle.x;
var zi = ankle.z;
var t = (2 * (frac - 0.5));
var stride = Math.asin(v / (sin(this.tB) * this.unit));
if (t < 0) {
ankle.x = (-ankle.ix) * t;
ankle.y = ((-ankle.iy) * t) + ((this.yw2 * path.side) * (1 + t));
} else {
var stride = (path.unit * sin(this.tB));
ankle.x = (stride + this.fxo) * t;
ankle.y = ((this.yw2 * path.side) * (1 - t)) + ((this.yw1 * path.side) * t);
}
var contract = (1 - (((cos(t * PI) + 1) / 2) * this.cF));
path.foottip = (((atan2(path.src.mid.z - ankle.z, path.src.mid.x - ankle.x) - (PI / 2)) * scurve(1 - abs(t))) - ((PI / 4) * scurve(1 - (t * t)))) + (PI / 2);
path.footface = this.parent.face;
ankle.z = (((-path.unit) * cos(this.tip)) * contract) - this.zo;
ankle.dx = ankle.x - xi;
ankle.dz = ankle.z - zi;
};
Loke.prototype.Airborne = function (inc) {
this.vz = this.vz + ((grav * inc) / 2);
this.tip = this.tB * (this.vz / this.vzi);
this.x = this.x + ((this.vh * cos(this.face)) * inc);
this.y = this.y + ((this.vh * sin(this.face)) * inc);
this.cz = this.cz + (this.vz * inc);
this.vz = this.vz + ((grav * inc) / 2);
};
Loke.prototype.Launch = function (path) {
var ankle = path.ankle;
this.vz = (this.vzi = this.thrust * cos(this.tB));
ankle.ix = ankle.x;
ankle.iy = ankle.y;
ankle.iz = ankle.z;
};
head = function (p, r, shadow) {
this.register("head", p, shadow);
this.hair = new Circle(this, r, 1, 1);
this.head = new dome(this, r, 0, 1, 0.1);
};
head.ptype(part);
head.prototype.draw = function (face, tilt) {
this.head.fullmatch(this);
this.hair.fullmatch(this);
this.head.draw(face, tilt);
this.hair.draw();
};
Being.prototype.MotionSet = function (a, vmax, tr, thresh, scl) {
this.a = a * scl;
this.vmax = vmax * scl;
this.vmin = 0.001;
this.tr = tr;
this.thresh = thresh * scl;
};
being.prototype.MotionMatch = function (src) {
this.v = src.v;
this.turn = src.turn;
this.face = src.face;
};
being.prototype.tipV = function (tip, fac, drag) {
if ((cos(tip) == 0) or (sin(tip) == 0)) {
q.tipV = 0;
} else {
q.tipV = q.tipV + ((((((-fac) * sin(tip)) / abs(sin(tip))) * cos(tip)) / abs(cos(tip))) * abs(cos(tip) * sin(tip)));
}
q.tipV = q.tipV * drag;
};
being.prototype.Move = function (target, tdrag, vdrag) {
this.moveData(target);
this.turn = this.turn * (1 - tdrag);
this.v = this.v * (1 - vdrag);
this.moveUpdate(this.turn, this.v);
};
being.prototype.MoveData = function (target) {
var ty = (target.py - this.py);
var tx = (target.px - this.px);
var aim = atan2(ty, tx);
this.diff = compress(aim - this.face);
this.d = sqrt((tx * tx) + (ty * ty));
var factor = (sqrt(abs(this.diff)) * (this.v / this.vmax));
if (factor > 1) {
factor = 1;
}
if (abs(this.diff) > 0.05) {
if (this.diff > 0) {
this.turn = this.turn + (this.tR * factor);
} else if (this.diff < 0) {
this.turn = this.turn - (this.tR * factor);
}
}
this.turn = this.turn * 0.9;
this.tmin = this.thresh;
if (this.d > this.tmin) {
var steps = (this.v / this.a);
var threshold = (((steps * this.v) / 2) + this.tmin);
} else {
threshold = this.tmin;
}
if ((this.d < threshold) or (this.slowSwitch == 1)) {
this.slowSwitch = 0;
if (abs(this.v) < abs(this.a + this.vmin)) {
this.v = this.vmin;
} else if (this.v > (this.a + this.vmin)) {
this.v = this.v - this.a;
} else if (this.v < (this.a + this.vmin)) {
this.v = this.vmin;
}
} else if (this.d > threshold) {
this.v = this.v + this.a;
if (this.v > this.vmax) {
if ((this.v - this.vmax) > (2 * this.a)) {
this.v = this.v - (2 * this.a);
} else {
this.v = this.vmax;
}
}
}
};
being.prototype.MoveUpdate = function (turn, v) {
this.face = compress(this.face + turn);
this.movx = cos(this.face) * v;
this.movy = sin(this.face) * v;
this.x = this.x + this.movx;
this.y = this.y + this.movy;
};
q = new Object();
fullBoy = function (p) {
q.scl = 0.06;
q.r = 16 * q.scl;
q.torsor = (q.r * 18) / 30;
q.LW = 4 * q.scl;
q.iz = q.LW / 2;
q.hipr = q.r / 2.3;
q.shoulderR = q.r / 2.5;
q.handr = q.r / 5;
q.armlength = q.r * 1.75;
q.ballR = q.r * 0.9;
q.tBmx = PI / 3.5;
q.sF = 0.2;
q.cF = 0.6;
q.YS = 1;
q.boyR = 22 * q.scl;
q.hx = 3 * q.scl;
q.hz = q.torsoR + (q.r / 1.3);
q.tz = q.r + (q.torsor * 1.3);
q.hzo = 18.5 * q.scl;
q.LL = 32 * q.scl;
q.unit = 68 * q.scl;
q.bodyLength = (-q.r) * 2.1;
q.throwAngle = PI / 1.4;
q.restAngle = (-PI) / 2;
q.carryangle = (-PI) / 8;
q.throwReach = q.armLength * 1.6;
q.carrybend = PI / 20;
q.tipfactor = 0;
q.cx = 0.4;
q.cx2 = 0.8;
q.oy = q.r * 0.4;
q.yw1 = q.oy * 0.4;
q.yw2 = q.oy;
q.runBend = (-PI) / 12;
q.swayR = q.armlength * 1.35;
this.register("fullboy", p, 1);
q.pickup = 0;
q.state = 1;
};
fullBoy.ptype(Being);
fullBoy.prototype.run = function () {
switch (q.state) {
case 0 :
this.iNormal();
break;
case 1 :
if (abs((cursor.px - q.ball.px) < 10)) {
if (Pyt(cursor.px - q.ball.px, cursor.py - q.ball.py) < 10) {
q.target = q.ball;
} else {
q.target = cursor;
}
} else {
q.target = cursor;
}
this.Normal(q.target);
if (this.qPickUpBall()) {
if (Pyt(this.px - q.ball.px, this.py - q.ball.py) < (this.thresh * 1.1)) {
q.state = 2;
this.iPickupBall();
}
} else if (q.ball.sink == 1) {
q.state = 5;
}
break;
case 2 :
this.PickupBall();
if (q.liftOsc > (2 * PI)) {
q.state = 3;
this.iWalkBall();
}
break;
case 3 :
this.WalkBall();
if ((q.drawback == 1) and (ms == 0)) {
q.state = 4;
this.iThrow();
}
break;
case 4 :
this.Throw();
if ((q.pickup == 0) and (q.releaseCount == 0)) {
q.state = 1;
this.iNormal();
}
break;
case 5 :
this.slowswitch = 1;
this.Normal(q.target);
}
this.draw();
};
fullBoy.prototype.Initialize = function () {
this.motionSet(0.1, 3, 0.01, (q.r * 2.2) / q.scl, q.scl);
this.arrange();
this.setting(0);
q.loke = new Loke(this, "walk", q.legs);
q.state = 1;
this.z = q.iz;
this.v = 0.1;
q.vHands = new Array(new Point(this), new Point(this));
q.ball.z = q.ball.r;
q.ball.x = random(30) - 15;
q.ball.y = random(30) - 15;
};
Point.prototype.blend = function (src, frac) {
this.x = (src.x * (1 - frac)) + (this.x * frac);
this.y = (src.y * (1 - frac)) + (this.y * frac);
this.z = (src.z * (1 - frac)) + (this.z * frac);
};
fullBoy.prototype.Normal = function (target) {
this.Move(target);
this.legsWalk();
this.torsoWalk(1);
this.runSeg(10);
this.lookSwivel(1, 1 - (0.5 * q.seg), 0);
this.BallMove(1);
q.bend = ((q.runbend / 2) * this.v) / this.vmax;
this.walkSwing();
};
fullBoy.prototype.iNormal = function () {
this.iseg();
};
fullBoy.prototype.lookSwivel = function (amt, tStiff, drag) {
var aim = compress(atan2(cursor.py - this.py, cursor.px - this.px) - this.face);
if (aim > (PI / 2)) {
var aim = (PI / 2);
} else if (aim < ((-PI) / 2)) {
var aim = ((-PI) / 2);
}
var angleDiff = (compress(aim - q.hSwivel) * amt);
var factor = abs(angleDiff / (PI / 4));
if (factor > 1) {
var factor = 1;
}
if (angleDiff > 0) {
var turn = (0.04 * factor);
} else {
var turn = (-0.04 * factor);
}
var newAngle = compress(q.hSwivel + turn);
if (newAngle > (PI / 2)) {
var newAngle = (PI / 2);
} else if (newAngle < ((-PI) / 2)) {
var newAngle = ((-PI) / 2);
}
q.hSwivel = (newAngle * (1 - drag)) + (q.hSwivel * drag);
q.tSwivel = q.hSwivel * tStiff;
};
fullBoy.prototype.pickupBall = function () {
q.liftosc = q.liftosc + (PI / 45);
var fac = ((cos(q.liftOsc) + 1) / 2);
if (q.liftOsc < PI) {
var dx = (q.ball.px - q.torso.px);
var dy = (q.ball.py - q.torso.py);
var dz = (q.ball.pz - q.torso.pz);
var dh = Pyt(dx, dy);
var d = Pyt(dh, dz);
var liftangle = ((q.iliftangle = atan2(dz, dh)));
q.torso.z = q.tz;
var swivel = ((q.oswivel = (compress(atan2(q.ball.py - this.py, q.ball.px - this.px) - this.face) * (1 - fac)) + (q.itSwivel * fac)));
this.torsoSet(((-PI) / 2.6) * (1 - fac), swivel);
this.headSet(q.iHSwivel * fac, 0);
} else {
q.pickup = 1;
var liftangle = ((q.iliftangle * (1 - fac)) + (q.carryangle * fac));
var bd = 1;
var swivel = compress(q.oswivel * (1 - fac));
this.torsoSet((((-PI) / 2.6) * (1 - fac)) + (q.carrybend * fac), swivel);
this.headSet(0, 0);
}
this.legsCrouch((-(q.center.z / 2)) * (1 - fac));
this.armsPinch(q.swayR, liftangle);
if (q.liftOsc < PI) {
q.arms[0].end.blend(q.vHands[0], 1 - fac);
q.arms[1].end.blend(q.vHands[1], 1 - fac);
}
if (q.pickup == 1) {
this.ballHold();
if (q.ball.z < q.ball.r) {
q.ball.z = q.ball.r;
}
}
};
fullBoy.prototype.qPickupBall = function () {
if ((this.v < 0.02) and (q.target == q.ball)) {
return(1);
}
};
fullBoy.prototype.iPickupBall = function () {
q.itSwivel = q.tSwivel;
q.iHswivel = q.hSwivel;
q.pickup = 0;
q.liftosc = 0;
n = 0;
while (n < 2) {
q.vhands[n].XYZmatch(q.arms[n].end);
n++;
}
};
fullBoy.prototype.WalkBall = function () {
this.move(cursor);
this.legsWalk();
this.segRun(10);
this.lookSwivel(q.seg, 1);
this.torsoBob();
if (ms == 1) {
this.slowswitch = 1;
if (q.drawback < 1) {
q.drawBack = q.drawBack + 0.025;
if (q.drawBack > 1) {
q.drawBack = 1;
}
}
var sfac = scurve(q.drawback);
q.bend = (q.carrybend * (1 - sfac)) - ((PI / 24) * sfac);
} else if ((q.drawBack > 0) and (q.drawBack < 1)) {
q.drawBack = q.drawBack - 0.025;
if (q.drawBack < 0) {
q.drawBack = 0;
}
var sfac = scurve(q.drawback);
q.bend = (q.carrybend * (1 - sfac)) - ((PI / 24) * sfac);
} else if (q.drawBack == 1) {
var sfac = 1;
}
var reach = ((q.swayR * (1 - sfac)) + (q.throwReach * sfac));
var liftangle = ((q.carryangle * (1 - sfac)) + (q.throwAngle * sfac));
this.armsPinch(reach, liftangle);
this.ballHold();
};
fullBoy.prototype.iWalkBall = function () {
q.drawback = 0;
q.bend = q.carrybend;
this.iSeg();
};
fullBoy.prototype.segRun = function (amt) {
if (q.seg < 1) {
q.seg = q.seg + (1 / amt);
if (q.seg >= 1) {
q.seg = 1;
}
}
};
fullBoy.prototype.iSeg = function () {
q.uSeg = 0;
q.seg = 0;
};
fullBoy.prototype.Throw = function () {
if ((ms == 0) and (q.releaseCount == 0)) {
q.releaseAngle = PI / 2.2;
if (q.hole.form.hitTest(_xmouse, _ymouse)) {
var tx = (q.hole.px - q.torso.px);
var ty = (q.hole.py - q.torso.py);
} else {
var tx = (cursor.px - q.torso.px);
var ty = (cursor.py - q.torso.py);
}
var d = Pyt(tx, ty);
var angle = atan2(tx, ty);
var tc = sqrt((-(((q.torso.pz - filmspace.pz) + q.throwReach) - q.ball.r)) / (0.5 * grav));
var rda = asin((d / tc) / (sin(q.releaseAngle) * q.throwreach));
if (rda < (PI / 7)) {
} else {
rda = PI / 7;
}
q.releaseDangle = -rda;
q.drawAdv = (q.releaseDangle / (q.releaseAngle - q.throwAngle)) / (PI / 2);
}
var inc = 1;
if (q.pickup == 1) {
q.releaseCount = q.releaseCount + q.drawAdv;
if (q.releaseCount > 1) {
q.pickup = 0;
this.armsPinchData(q.throwReach, q.releaseAngle);
this.ballHold();
q.ball.vh = ((-q.armsExt) * sin(q.releaseDangle)) * sin(q.releaseAngle);
q.ball.vz = (q.armsExt * sin(q.releaseDangle)) * cos(q.releaseAngle);
q.ball.face = this.face + q.tSwivel;
var inc = ((q.releaseCount - 1) / q.drawAdv);
q.drawAdv = (q.releaseDangle / (q.carryangle - q.releaseAngle)) / (PI / 2);
q.releaseCount = 1 - (q.drawAdv * inc);
q.targetAngle = q.restAngle;
}
} else if (q.releaseCount > 0) {
q.releaseCount = q.releaseCount - q.drawAdv;
if (q.releaseCount < 0) {
q.releaseCount = 0;
}
}
var sfac = ((-cos((q.releaseCount * PI) / 2)) + 1);
var liftangle = ((q.releaseAngle * sfac) + (q.targetAngle * (1 - sfac)));
if (q.pickup == 1) {
q.bend = (-PI) / 24;
var reach = q.throwReach;
this.armsPinch(reach, liftangle);
this.ballHold();
} else {
q.bend = ((-PI) / 24) * sfac;
var reach = ((q.throwReach * sfac) + (q.swayR * (1 - sfac)));
this.armsPinch(reach, liftangle);
this.ballMove(inc);
}
};
fullBoy.prototype.iThrow = function () {
q.targetAngle = q.throwAngle;
q.releaseCount = 0;
};
fullBoy.prototype.legsWalk = function (target) {
q.loke.cf = (q.cf * this.v) / this.vmax;
q.loke.tbmx = (((q.tbmx * this.v) / this.vmax) * 0.7) + (q.tbmx * 0.3);
q.loke.process(this.v, this.vmax);
};
fullBoy.prototype.legsRun = function (target) {
q.loke.process(this.v, this.vmax);
};
fullBoy.prototype.legsCrouch = function (amt) {
q.center.z = q.loke.cz + amt;
q.legs[0].end.z = -q.center.z;
q.legs[1].end.z = -q.center.z;
};
fullBoy.prototype.torsoSet = function (bend, swivel) {
q.bend = bend;
q.tSwivel = swivel;
};
fullBoy.prototype.torsoWalk = function (amt) {
q.torso.z = (q.r + (q.torsor * 1.3)) + ((((q.torsor * 0.2) * sin(q.loke.osc * 2)) * q.loke.spd) * amt);
};
fullBoy.prototype.armsSwing = function (amt) {
q.swing = amt;
q.arms[0].end.x = (q.arms[1].end.x = q.swayR / 2.5);
q.arms[0].end.z = (q.arms[1].end.z = (-q.swayR) * cos(q.swing));
q.arms[0].end.y = (q.arms[1].end.y = (-q.swayR) * sin(q.swing));
};
fullBoy.prototype.runSwing = function () {
if (q.loke.aleg == q.loke.legs[0]) {
var addOsc = PI;
}
this.armsSwing(((PI / 4) * cos((q.loke.cycle + PI) - (PI / 4))) * q.loke.spd);
};
fullBoy.prototype.walkSwing = function (amt) {
if (q.loke.aleg == q.loke.legs[0]) {
var addOsc = PI;
}
this.armsSwing(((PI / 6) * cos((q.loke.osc + addOsc) - (PI / 4))) * q.loke.spd);
};
fullBoy.prototype.armsPinchData = function (reach, angle) {
q.armsExt = reach;
q.armsAngle = angle;
q.handz = reach * sin(angle);
q.handx = (q.ballr + q.handr) - q.shoulder0.x;
q.handy = reach * cos(angle);
};
fullBoy.prototype.armsPinch = function (reach, angle) {
this.armsPinchData(reach, angle);
q.arms[0].end.x = (q.arms[1].end.x = q.handx);
q.arms[0].end.z = (q.arms[1].end.z = q.handz);
q.arms[0].end.y = q.handy;
q.arms[1].end.y = -q.handy;
};
fullboy.prototype.HeadSet = function (face, tilt) {
q.hSwivel = face;
q.hTilt = tilt;
};
fullBoy.prototype.ballHold = function () {
q.ball.x = this.x + ((q.handy - (q.torso.z * sin(q.bend))) * cos(this.face + q.tSwivel));
q.ball.y = this.y + ((q.handy - (q.torso.z * sin(q.bend))) * sin(this.face + q.tSwivel));
q.ball.z = (((this.z + q.center.z) + (q.torso.z * cos(q.bend))) + q.shoulder0.z) + q.handz;
};
fullBoy.prototype.BallMove = function (inc) {
q.ball.vz = q.ball.vz + ((grav / 2) * inc);
q.ball.x = q.ball.x + ((q.ball.vh * cos(q.ball.face)) * inc);
q.ball.y = q.ball.y + ((q.ball.vh * sin(q.ball.face)) * inc);
q.ball.z = q.ball.z + (q.ball.vz * inc);
if ((q.ball.z < q.ball.r) and (q.ball.sink != 1)) {
if (Pyt(q.ball.x - q.hole.x, q.ball.y - q.hole.y) < q.hole.r) {
q.ball.sink = 1;
q.hole.mask.form._visible = 1;
q.ball.shadow._visible = 0;
q.ball.form.setMask(q.hole.mask.form);
} else {
var frac = ((-(q.ball.r - q.ball.z)) / q.ball.vz);
q.ball.vz = q.ball.vz * -0.7;
q.ball.z = ((q.ball.r - q.ball.z) * 0.7) + q.ball.r;
q.ball.x = q.ball.x - ((q.ball.vh * cos(q.ball.face)) * frac);
q.ball.y = q.ball.y - ((q.ball.vh * sin(q.ball.face)) * frac);
q.ball.vh = q.ball.vh * 0.7;
q.ball.x = q.ball.x + ((q.ball.vh * frac) * cos(q.ball.face));
q.ball.y = q.ball.y + ((q.ball.vh * frac) * sin(q.ball.face));
}
}
q.ball.vz = q.ball.vz + ((grav / 2) * inc);
};
fullBoy.prototype.arrange = function (setting) {
q.center = new Point(this);
q.belly = new Circle(this, q.r / 1.3, 6, 1);
q.belly.attachTo(q.center);
q.torso = new Point(q.center);
q.torso.r = q.torsoR;
q.torso.z = q.r + (q.torsor * 1.5);
q.legs = new Array(new vLimb(this, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, q.cx2), new vLimb(this, 0, 0, new Point(q.center), new Point(q.center), new Point(q.center), 0, q.cx2));
this.legSet(q.legs[0]);
this.legSet(q.legs[1]);
q.legs[0].cx = (q.legs[1].cx = q.cx2);
q.legs[0].base.r = (q.legs[1].base.r = q.hipr);
q.legs[0].base.y = -q.oy;
q.legs[1].base.y = q.oy;
q.leg0 = new limbBridge(this, q.legs[0], q.lw, 6, 0);
q.leg1 = new limbBridge(this, q.legs[1], q.lw, 6, 0);
q.belly.z = q.r / 8;
q.belly.form.swapDepths(4);
this.z = q.iz;
q.shoulder0 = new Point(q.torso);
q.shoulder1 = new Point(q.torso);
q.shoulder0.r = (q.shoulder1.r = q.shoulderR);
q.shoulder0.x = q.r / 4;
q.shoulder1.x = q.r / 4;
q.shoulder0.z = (q.shoulder1.z = q.torsoR - q.shoulderR);
q.arms = new Array(new vLimb(this, 0, 0, q.shoulder0, new Point(q.shoulder0), new Point(q.shoulder0), q.armlength, 0.4), new vLimb(this, 0, 0, q.shoulder1, new Point(q.shoulder1), new Point(q.shoulder1), q.armlength, 0.4));
q.arms[0].bridge = new limbBridge(this.parent, q.arms[0], q.lw, 6, 0);
q.arms[1].bridge = new limbBridge(this.parent, q.arms[1], q.lw, 6, 0);
q.hands = new Array(new Circle(this.parent, q.handR, 0), new Circle(this.parent, q.handR, 0));
q.hands[0].attachTo(q.arms[0].end);
q.hands[1].attachTo(q.arms[1].end);
q.boyhead = new head(this.parent, q.r / 1.3, 1);
q.boyhead.attachTo(q.torso);
q.boyhead.z = q.hz;
q.boyhead.x = q.hx;
q.tcv = new Point(q.torso);
q.tcv.x = q.torsor / 1.5;
q.tBridge = new Bridge(this, q.belly, q.torso, q.torsor * 2, 6, 0, q.tcv);
};
fullBoy.prototype.setting = function (setting) {
switch (setting) {
case 0 :
q.ball = new Circle(this.parent, q.ballR, 5, 1);
q.hole.mask = new Part(this.parent);
q.hole.mask.disc = new Disc(q.hole.mask, q.r * 1.5, 7);
q.hole.mask.disc.positionMatch(q.hole);
q.hole.mask.square = new Part(q.hole.mask);
var path = q.hole.mask.square.form;
path.beginFill(16777215);
path.moveTo(q.hole.vx - (q.hole.form._width / 2), q.hole.vy);
path.lineTo(q.hole.vx + (q.hole.form._width / 2), q.hole.vy);
path.lineTo(q.hole.vx + (q.hole.form._width / 2), q.hole.vy - (q.hole.form._height * 10));
path.lineTo(q.hole.vx - (q.hole.form._width / 2), q.hole.vy - (q.hole.form._height * 10));
path.lineTo(q.hole.vx - (q.hole.form._width / 2), q.hole.vy);
q.hole.mask.form._visible = 0;
return;
case 1 :
}
};
fullBoy.prototype.draw = function () {
this.locate();
q.center.locate(this.face);
q.torso.locateRoteTilt(this.face + q.tSwivel, q.bend);
q.boyhead.locateRoteTilt(this.face + q.tSwivel, q.bend);
q.boyhead.draw(this.face + q.hSwivel, (q.hTilt - (PI / 2)) + (PI / 8));
q.boyhead.setDepth();
this.legDraw(q.legs[0], 0, q.tSwivel / 2);
this.legDraw(q.legs[1], 0, q.tSwivel / 2);
this.legDraw(q.arms[0], ((-PI) / 2) + q.tSwivel, 0);
this.legDraw(q.arms[1], (PI / 2) + q.tSwivel, 0);
q.belly.locate();
q.belly.draw();
q.leg0.bridgecurved2();
q.leg1.bridgecurved2();
q.tcv.locateRoteTilt(this.face, q.bend);
q.tbridge.bridgecurved();
n = 0;
while (n < 2) {
q.arms[n].bridge.bridgecurved2();
q.hands[n].x = -q.handr;
q.hands[n].fullmatch(q.arms[n].end);
q.hands[n].draw();
q.hands[n].setDepth();
q.arms[n].bridge.setDepth(q.arms[n].mid);
n++;
}
this.setDepth();
q.ball.locate();
q.ball.draw();
q.ball.setDepth();
};
fullBoy.prototype.legDraw = function (path, addface, baseaddface) {
path.base.locateRote((this.face + addface) + baseaddface);
path.end.locateRote(this.face + addface);
path.bend(twist);
path.mid.locateRote(this.face + addface);
};
Loke.prototype.WalkSpring = function (path, inc) {
var ankle = path.ankle;
ankle.ix = ankle.x;
ankle.iy = ankle.y;
var turn = (this.turn * inc);
this.tip = this.tb * sin(this.osc);
var extension = ((path.unit - ((((path.unit * (cos((this.osc * 2) + q.oSync) + 1)) / 2) * this.sf) * this.spd)) - (((1 - this.spd) * path.unit) * this.sf));
var spring = (cos(this.tip) * extension);
this.cz = spring - this.zo;
ankle.z = (-spring) - this.zo;
if (this.aleg == this.legs[0]) {
q.swayfactor = -1;
} else {
q.swayfactor = 1;
}
var cy = ((q.sway * cos(this.osc)) * q.swayfactor);
q.center.y = cy;
ankle.y = ankle.y + ((((q.sway * sin(this.oscAdd * inc)) * sin(this.osc)) * q.swayfactor) * inc);
ankle.x = ankle.x - ((this.v * cos(turn)) * inc);
ankle.y = ankle.y - ((this.v * sin(turn)) * inc);
var tpx = (ankle.x - this.fxo);
var tpy = (ankle.y + cy);
ankle.x = ((tpx * cos(turn)) + (tpy * sin(turn))) + this.fxo;
ankle.y = ((tpy * cos(turn)) - (tpx * sin(turn))) - cy;
};
_root.onEnterFrame = function () {
var t1 = new Date();
cursor.update(film, 500);
film.avatar.run(cursor);
film.avatar.atmosphere();
var t2 = new Date();
timing = ((t2.getTime() - t1.getTime()) + (timing * 9)) / 10;
trace("time " + (timing / 0.0333333333333333));
};
Part.prototype.colorGrade = function () {
return(((this.py + 50) - filmspace.py) / 350);
};
Being.prototype.Atmosphere = function () {
this.colorShade(this.colorGrade());
};
_root.onLoad = function () {
_root.form = _root;
scale = 10;
Layout = new Layout();
cursor = new Cursor();
buildPalette();
film = new Cell(fullboy, 3, 3);
film.avatar.form.swapdepths(100);
};
buildPalette = function () {
Palette = new Array();
n = 0;
while (n <= 8) {
Palette[n] = new kolor();
n++;
}
Palette[0].hex = "0xFFE6D0";
Palette[1].hex = "0xA09060";
Palette[2].hex = "0x0076A0";
Palette[3].hex = "0x007056";
Palette[4].hex = "0x66a9c9";
Palette[5].hex = "0x69A9c9";
Palette[6].hex = "0x66c9a9";
Palette[7].hex = "0x333333";
Palette[8].hex = "0x7090a0";
n = 0;
while (n < Palette.length) {
Palette[n].kolorBreak();
n++;
}
};