[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (92 B)
loadMovieNum ("http://www.kerb.co.uk/logging/miniclip_freekickchallenge.swf", 10);
stop();
Instance of Symbol 107 MovieClip "preloader_mc" in Frame 1 (201 B)
onClipEvent (enterFrame) {
var myPercent = Math.floor((_root.getBytesLoaded() * 100) / _root.getBytesTotal());
if (myPercent >= 100) {
_root.play();
} else {
this.gotoAndStop(myPercent);
}
}
Frame 3 (48.63 KiB) ● ● ● ●
function object3D(x, y, z, rx, ry, rz) {
var _local1 = this;
_local1.numpoints = 0;
_local1.pointlist = new Array();
_local1.tpointlist = new Array();
_local1.numlines = 0;
_local1.lines = new Array();
_local1.numquads = 0;
_local1.quads = new Array();
_local1.disabled = false;
_local1.pos = new Vector(x, y, z);
}
function image3d(x, y, z, scale, source, targetclip) {
var _local1 = this;
var _local2 = targetclip;
clipCount++;
_local1.pos = new Vector(x, y, z);
_local1.tpos = new Vector(x, y, z);
_local1.scale = scale;
_local2.attachMovie(source, "image" + clipCount, 100000 - clipCount);
_local1.clip_mc = _local2["image" + clipCount];
}
function line3d(p1, p2, lthickness, lcolour, targetclip) {
var _local1 = this;
var _local2 = targetclip;
_local1.p1 = p1;
_local1.p2 = p2;
if (!lthickness) {
_local1.linethickness = 0;
} else {
_local1.linethickness = lthickness;
}
if (!lcolour) {
_local1.linecolour = 16777215 /* 0xFFFFFF */;
} else {
_local1.linecolour = lcolour;
}
clipCount++;
if (!_local2) {
_local2 = dynamicGFX;
}
_local2.createEmptyMovieClip("image" + clipCount, 100000 - clipCount);
_local1.clip_mc = _local2["image" + clipCount];
_local1.linetype = DRAW;
}
function lineImage(p1, p2, imagename, scale) {
var _local1 = this;
_local1.p1 = p1;
_local1.p2 = p2;
clipCount++;
dynamicGFX.attachMovie(imagename, "image" + clipCount, 100000 - clipCount);
_local1.clip_mc = dynamicGFX["image" + clipCount];
_local1.linetype = IMAGE;
_local1.ignoreDepth = false;
}
function quad3d(p1, p2, p3, p4, col, targetclip) {
var _local1 = this;
var _local2 = targetclip;
_local1.p1 = p1;
_local1.p2 = p2;
_local1.p3 = p3;
_local1.p4 = p4;
clipCount++;
if (!_local2) {
_local2 = dynamicGFX;
}
_local2.createEmptyMovieClip("image" + clipCount, 100000 - clipCount);
_local1.clip_mc = _local2["image" + clipCount];
_local1.col = col;
_local1.ignoreDepth = false;
}
function camera3d(x, y, z, rx, ry, rz, zoom) {
var _local1 = this;
_local1.pos = new Vector(x, y, z);
_local1.rot = new Vector(rx, ry, rz);
_local1.zoom = zoom;
}
function setCam(cam, speed) {
var _local1 = speed;
var _local2 = cam;
if (!_local1) {
_local1 = 0.5;
}
vCopy(_local2.pos, worldDestPos);
vCopy(_local2.rot, worldDestRot);
worldDestZoom = _local2.zoom;
if (!_local1) {
worldDestSpeed = 0.3;
} else {
worldDestSpeed = _local1;
}
}
function updateCamera() {
var _local1 = new Vector(0, 0, 0);
if (!EqualiseVectors(worldPos, worldDestPos, 0.5)) {
vSubtract(worldDestPos, worldPos, _local1);
vMultiplyWithScalar(_local1, worldDestSpeed);
vAdd(worldPos, _local1);
viewChanged = true;
}
if (!EqualiseVectors(worldRot, worldDestRot, 0.1)) {
vSubtract(worldDestRot, worldRot, _local1);
vMultiplyWithScalar(_local1, worldDestSpeed);
vAdd(worldRot, _local1);
viewChanged = true;
}
if (Math.abs(d - worldDestZoom) < 2) {
d = worldDestZoom;
} else if (Math.abs(d - worldDestZoom) > 2) {
_local1 = worldDestZoom - d;
d = d + (_local1 * worldDestSpeed);
viewChanged = true;
}
}
function drawNet(p1, p2, p3, p4, xdivide, ydivide, lineweight, linecol, linealpha, targetclip, edging) {
var _local1 = targetclip;
_local1.clear();
_local1.lineStyle(lineweight, linecol, linealpha);
var top = new Vector(p1.x, p1.y, 0);
var _local3 = new Vector(p3.x, p3.y, 0);
var topdiff = new Vector(0, 0, 0);
var botdiff = new Vector(0, 0, 0);
vSubtract(p2, p1, topdiff);
vSubtract(p4, p3, botdiff);
vDivideByScalar(topdiff, ydivide);
vDivideByScalar(botdiff, ydivide);
var left = new Vector(p1.x, p1.y, 0);
var right = new Vector(p2.x, p2.y, 0);
var leftdiff = new Vector(0, 0, 0);
var rightdiff = new Vector(0, 0, 0);
vSubtract(p3, p1, leftdiff);
vSubtract(p4, p2, rightdiff);
vDivideByScalar(leftdiff, xdivide);
vDivideByScalar(rightdiff, xdivide);
if (edging) {
ydivide++;
xdivide++;
}
var _local2 = 0;
while (_local2 < ydivide) {
_local1.moveTo(top.x, top.y);
_local1.lineTo(_local3.x, _local3.y);
vAdd(top, topdiff);
vAdd(_local3, botdiff);
_local2++;
}
_local2 = 0;
while (_local2 < xdivide) {
_local1.moveTo(left.x, left.y);
_local1.lineTo(right.x, right.y);
vAdd(left, leftdiff);
vAdd(right, rightdiff);
_local2++;
}
}
function clipZOrder(clip_mc, z1, z2) {
var _local2 = z1;
var _local3 = clip_mc;
_local2 = _local2 * 10;
z2 = z2 * 10;
var _local1 = _local2;
depthTracker[_local3.getDepth()] = false;
if (z2) {
_local1 = _local2 + ((z2 - _local2) / 2);
}
_local1 = 100000 - Math.floor(_local1);
while (depthTracker[_local1]) {
_local1++;
}
depthTracker[_local1] = _local3;
_local3.swapDepths(_local1);
}
DRAW = 0;
IMAGE = 1;
FILL = 0;
MESH = 1;
depthTracker = new Array();
object3D.prototype.addline = function (p1num, p2num, lthickness, lcolour, targetclip) {
this.lines.push(new line3D(p1num, p2num, lthickness, lcolour, targetclip));
this.numlines++;
};
object3D.prototype.addlineimage = function (p1num, p2num, imagename, targetclip) {
this.lines.push(new lineImage(p1num, p2num, imagename, targetclip));
this.numlines++;
};
object3D.prototype.addquad = function (p1num, p2num, p3num, p4num, col, targetclip, alpha) {
var _local1 = this;
_local1.quads.push(new quad3D(p1num, p2num, p3num, p4num, col, targetclip));
_local1.quads[_local1.numquads].quadtype = FILL;
if (alpha) {
_local1.quads[_local1.numquads].clip_mc._alpha = alpha;
}
_local1.numquads++;
};
object3D.prototype.addnet = function (p1num, p2num, p3num, p4num, lineweight, linecol, linealpha, xdivide, ydivide, targetclip) {
var _local1 = this;
_local1.quads.push(new quad3D(p1num, p2num, p3num, p4num, linecol, targetclip));
_local1.quads[_local1.numquads].lineweight = lineweight;
_local1.quads[_local1.numquads].clip_mc._alpha = linealpha;
_local1.quads[_local1.numquads].quadtype = MESH;
_local1.quads[_local1.numquads].xdivide = xdivide;
_local1.quads[_local1.numquads].ydivide = ydivide;
_local1.edging = false;
_local1.numquads++;
};
object3D.prototype.addpoint = function (point) {
var _local1 = this;
var _local2 = point;
_local1.pointlist[_local1.numpoints] = _local2;
_local1.tpointlist[_local1.numpoints] = new Vector(_local2.x, _local2.y, _local2.z);
_local1.numpoints++;
};
object3D.prototype.updatePoints = function () {
var _local2 = this;
if (_local2.disabled) {
return(true);
}
pyawsin = sin(worldRot.y);
pyawcos = cos(worldRot.y);
ppitchsin = sin(worldRot.x);
ppitchcos = cos(worldRot.x);
i = 0;
while (i < _local2.numpoints) {
var _local1 = new Vector(0, 0, 0);
vSubtract(_local2.pos, worldPos, _local1);
vAdd(_local1, _local2.pointlist[i]);
_local1.x = (pyawcos * _local1.x) - (pyawsin * _local1.z);
var _local3 = (pyawsin * _local1.x) + (pyawcos * _local1.z);
var ty = _local1.y;
_local1.z = (ppitchcos * _local3) - (ppitchsin * ty);
_local1.y = (ppitchsin * _local3) + (ppitchcos * ty);
vCopy(_local1, _local2.tpointlist[i]);
i++;
}
return(undefined);
};
object3D.prototype.draw = function () {
var _local3 = this;
if (_local3.disabled) {
return(true);
}
i = _local3.numquads - 1;
while (i >= 0) {
var _local1 = _local3.quads[i];
p1ind = _local1.p1;
p2ind = _local1.p2;
var p1 = _local3.tpointlist[_local1.p1];
var p2 = _local3.tpointlist[_local1.p2];
var p3 = _local3.tpointlist[_local1.p3];
var p4 = _local3.tpointlist[_local1.p4];
if ((((p1.z > 1) && (p2.z > 1)) && (p3.z > 1)) && (p4.z > 1)) {
sx1 = (d * (p1.x / p1.z)) + screencenterX;
sy1 = (d * (p1.y / p1.z)) + screencenterY;
sx2 = (d * (p2.x / p2.z)) + screencenterX;
sy2 = (d * (p2.y / p2.z)) + screencenterY;
sx3 = (d * (p3.x / p3.z)) + screencenterX;
sy3 = (d * (p3.y / p3.z)) + screencenterY;
sx4 = (d * (p4.x / p4.z)) + screencenterX;
sy4 = (d * (p4.y / p4.z)) + screencenterY;
_local1.clip_mc._visible = true;
if (_local1.quadtype == FILL) {
_local1.clip_mc.clear();
_local1.clip_mc.moveTo(sx1, sy1);
_local1.clip_mc.beginFill(_local1.col, 100);
_local1.clip_mc.lineTo(sx2, sy2);
_local1.clip_mc.lineTo(sx3, sy3);
_local1.clip_mc.lineTo(sx4, sy4);
_local1.clip_mc.lineTo(sx1, sy1);
_local1.clip_mc.endFill();
} else if (_local1.quadtype == MESH) {
drawNet(new Vector(sx1, sy1), new Vector(sx2, sy2), new Vector(sx3, sy3), new Vector(sx4, sy4), _local1.xdivide, _local1.ydivide, _local1.lineweight, _local1.col, 100, _local1.clip_mc, _local1.edging);
}
clipZOrder(_local1.clip_mc, p1.z, p2.z);
} else {
_local1.clip_mc._visible = false;
}
i--;
}
i = _local3.numlines - 1;
while (i >= 0) {
var _local2 = _local3.lines[i];
p1ind = _local2.p1;
p2ind = _local2.p2;
var p1 = _local3.tpointlist[p1ind];
var p2 = _local3.tpointlist[p2ind];
if ((p1.z > 1) && (p2.z > 1)) {
sx1 = (d * (p1.x / p1.z)) + screencenterX;
sy1 = (d * (p1.y / p1.z)) + screencenterY;
sx2 = (d * (p2.x / p2.z)) + screencenterX;
sy2 = (d * (p2.y / p2.z)) + screencenterY;
_local2.clip_mc._visible = true;
if (_local2.linetype == DRAW) {
if (_local2.linethickness > 0) {
var thickness = (((d / (p1.z + ((p2.z - p1.z) >> 1))) * _local2.linethickness) / 5);
} else {
thickness = 0;
}
_local2.clip_mc.clear();
_local2.clip_mc.lineStyle(thickness, _local2.linecolour, 100);
_local2.clip_mc.moveTo(sx1, sy1);
_local2.clip_mc.lineTo(sx2, sy2);
} else if (_local2.linetype == IMAGE) {
var linevec = new Vector(sx2 - sx1, sy2 - sy1);
_local2.clip_mc._rotation = vAngle(linevec);
_local2.clip_mc._x = sx1;
_local2.clip_mc._y = sy1;
_local2.clip_mc._xscale = vMagnitude(linevec);
_local2.clip_mc._yscale = _local2.clip_mc._xscale;
}
clipZOrder(_local2.clip_mc, p1.z, p2.z);
} else {
_local2.clip_mc._visible = false;
}
i--;
}
return(undefined);
};
object3D.prototype.disable = function () {
var _local1 = this;
_local1.disabled = true;
i = 0;
while (i < _local1.numquads) {
_local1.quads[i].clip_mc._visible = false;
i++;
}
i = 0;
while (i < _local1.numlines) {
_local1.lines[i].clip_mc._visible = false;
i++;
}
};
object3D.prototype.enable = function () {
var _local1 = this;
_local1.disabled = false;
i = 0;
while (i < _local1.numquads) {
_local1.quads[i].clip_mc._visible = true;
i++;
}
i = 0;
while (i < _local1.numlines) {
_local1.lines[i].clip_mc._visible = true;
i++;
}
_local1.updatePoints();
_local1.draw();
};
image3d.prototype.disable = function () {
this.disabled = true;
this.clip_mc._visible = false;
};
image3d.prototype.enable = function () {
var _local1 = this;
_local1.disabled = false;
_local1.clip_mc._visible = true;
_local1.updatePos();
_local1.draw();
};
image3D.prototype.updatePos = function () {
if (this.disabled) {
return(true);
}
pyawsin = sin(worldRot.y);
pyawcos = cos(worldRot.y);
ppitchsin = sin(worldRot.x);
ppitchcos = cos(worldRot.x);
var _local1 = new Vector(0, 0, 0);
vSubtract(this.pos, worldPos, _local1);
_local1.x = (pyawcos * _local1.x) - (pyawsin * _local1.z);
var _local2 = (pyawsin * _local1.x) + (pyawcos * _local1.z);
var _local3 = _local1.y;
_local1.z = (ppitchcos * _local2) - (ppitchsin * _local3);
_local1.y = (ppitchsin * _local2) + (ppitchcos * _local3);
vCopy(_local1, this.tpos);
return(undefined);
};
image3D.prototype.draw = function () {
var _local1 = this;
if (_local1.disabled) {
return(true);
}
newPos = new Vector(0, 0, 0);
vCopy(_local1.tpos, newPos);
if (newPos.z > 0) {
sx = (d * (newPos.x / newPos.z)) + screencenterX;
sy = (d * (newPos.y / newPos.z)) + screencenterY;
_local1.clip_mc._visible = true;
_local1.clip_mc._x = sx;
_local1.clip_mc._y = sy;
scale = ((d * 100) / newPos.z) * _local1.scale;
if (_local1.clip_mc._xscale < 0) {
_local1.clip_mc._xscale = -scale;
} else {
_local1.clip_mc._xscale = scale;
}
if (_local1.clip_mc._yscale < 0) {
_local1.clip_mc._yscale = -scale;
} else {
_local1.clip_mc._yscale = scale;
}
clipZOrder(_local1.clip_mc, newPos.z);
} else {
_local1.clip_mc._visible = false;
}
return(undefined);
};
function dial(clip_mc, minVal, maxVal, minDisplay, maxDisplay, updateFunction) {
var _local1 = this;
_local1.clip_mc = clip_mc;
_local1.minVal = minVal;
_local1.maxVal = maxVal;
_local1.minDisplay = minDisplay;
_local1.maxDisplay = maxDisplay;
_local1.updateFunction = updateFunction;
_local1.currentSetting = minVal;
_local1.active = false;
_local1.needle_mc = _local1.clip_mc.needle_mc;
_local1.needleVel = (_local1.maxDisplay - _local1.minDisplay) / (16 - needleSpeed);
_local1.needle_mc._rotation = minDisplay;
_local1.clip_mc.set_btn.dialObj = _local1;
_local1.clip_mc.set_btn._visible = false;
_local1.clip_mc.set_btn.onPress = function () {
this.dialObj.setFunction();
};
_local1.clip_mc._xscale = 0;
_local1.clip_mc._yscale = 0;
_local1.clip_mc._visible = false;
_local1.targetScale = _local1.clip_mc._xscale;
_local1.targetDelay = 0;
_local1.updateFunction(true);
}
function updateDials() {
var _local2 = 0;
while (_local2 < dials.length) {
var _local1 = dials[_local2];
_local1.updateFunction();
if (_local1.targetScale != _local1.clip_mc._xscale) {
if (_local1.targetDelay > 0) {
_local1.targetDelay--;
} else {
var _local3 = (_local1.targetScale - _local1.clip_mc._xscale) * 0.5;
_local1.clip_mc._xscale = _local1.clip_mc._xscale + _local3;
_local1.clip_mc._yscale = _local1.clip_mc._xscale;
if (_local1.clip_mc._xscale < 0.1) {
_local1.clip_mc._visible = false;
} else {
_local1.clip_mc._visible = true;
}
}
}
_local2++;
}
}
function updateRotateDial(refresh) {
var _local1 = this;
if (_local1.active || (refresh)) {
if (_local1.needleAngle == undefined) {
_local1.needleAngle = _local1.minDisplay;
} else {
_local1.needleAngle = _local1.needleAngle + _local1.needleVel;
}
if (_local1.needleAngle >= _local1.maxDisplay) {
_local1.needleAngle = _local1.maxDisplay;
_local1.needleVel = -_local1.needleVel;
} else if (_local1.needleAngle <= _local1.minDisplay) {
_local1.needleAngle = _local1.minDisplay;
_local1.needleVel = -_local1.needleVel;
}
_local1.needle_mc._rotation = _local1.needleAngle;
_local1.currentSetting = (((_local1.needleAngle - _local1.minDisplay) / (_local1.maxDisplay - _local1.minDisplay)) * (_local1.maxVal - _local1.minVal)) + _local1.minVal;
}
}
function updateCurveDial(refresh) {
var _local1 = this;
if (_local1.active || (refresh)) {
if (_local1.curvePos == undefined) {
_local1.curvePos = 0;
}
_local1.clip_mc.curve_mc.clear();
_local1.clip_mc.curve_mc.lineStyle(2, 16711680, 100);
_local1.clip_mc.curve_mc.moveTo(0, -20);
_local1.clip_mc.curve_mc.curveTo(_local1.curvePos, 0, 0, 20);
_local1.curvePos = _local1.curvePos + _local1.needleVel;
if (_local1.curvePos >= _local1.maxDisplay) {
_local1.curvePos >= _local1.maxDisplay;
_local1.needleVel = -_local1.needleVel;
} else if (_local1.curvePos <= _local1.minDisplay) {
_local1.curvePos >= _local1.minDisplay;
_local1.needleVel = -_local1.needleVel;
}
_local1.currentSetting = (((_local1.curvePos - _local1.minDisplay) / (_local1.maxDisplay - _local1.minDisplay)) * (_local1.maxVal - _local1.minVal)) + _local1.minVal;
}
}
function updateNumberDial(clip_mc, num) {
var _local1 = num % 10;
var _local2 = Math.floor(num / 10) % 10;
var _local3 = Math.floor(num / 100) % 10;
clip_mc.hundreds_mc.gotoAndStop(_local3 + 1);
clip_mc.tens_mc.gotoAndStop(_local2 + 1);
clip_mc.units_mc.gotoAndStop(_local1 + 1);
}
dial.prototype.activate = function () {
var _local2 = this;
_local2.active = true;
_local2.clip_mc.set_btn._visible = true;
_local2.targetScale = 120;
var _local1 = 0;
while (_local1 < dials.length) {
if (dials[_local1].clip_mc.getDepth() > _local2.clip_mc.getDepth()) {
_local2.clip_mc.swapDepths(dials[_local1].clip_mc);
}
_local1++;
}
};
dial.prototype.deactivate = function () {
var _local1 = this;
_local1.active = false;
_local1.clip_mc.set_btn._visible = false;
_local1.targetScale = 100;
};
dial.prototype.shrink = function (delay) {
var _local1 = this;
_local1.targetScale = 0;
if (delay) {
_local1.targetDelay = delay;
} else {
_local1.targetDelay = 0;
}
};
dial.prototype.enlarge = function (delay) {
var _local1 = this;
_local1.targetScale = 100;
if (delay) {
_local1.targetDelay = delay;
} else {
_local1.targetDelay = 0;
}
};
function AreVectorsEqual(v1, v2) {
var _local1 = v2;
var _local2 = v1;
if (((_local2.x == _local1.x) && (_local2.y == _local1.y)) && (_local2.z == _local1.z)) {
return(true);
}
return(false);
}
function EqualiseVectors(v1, v2, acc) {
var _local3 = v2;
if (AreVectorsEqual(v1, _local3)) {
return(true);
}
var _local1 = new Vector(0, 0, 0);
vSubtract(_local3, v1, _local1);
var _local2 = ((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z);
if (_local2 < (acc * acc)) {
vCopy(v1, _local3);
return(true);
}
return(false);
}
function vIsLessThan(v1, mag) {
var _local1 = v1;
var _local2 = ((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z);
if (_local2 < (mag * mag)) {
return(true);
}
return(false);
}
function vIsGreaterThan(v1, mag) {
var _local1 = v1;
var _local2 = ((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z);
if (_local2 > (mag * mag)) {
return(true);
}
return(false);
}
function InitLookups(accuracy) {
if (accuracy) {
MATHACCURACY = accuracy;
}
sinLookUp = new Array();
var _local1 = 0;
while (_local1 <= (360 * MATHACCURACY)) {
sinLookUp[_local1] = Math.sin(DegreesToRadians(_local1 / MATHACCURACY));
_local1++;
}
cosLookUp = new Array();
_local1 = 0;
while (_local1 <= (360 * MATHACCURACY)) {
cosLookUp[_local1] = Math.cos(DegreesToRadians(_local1 / MATHACCURACY));
_local1++;
}
tanLookUp = new Array();
_local1 = 0;
while (_local1 <= (360 * MATHACCURACY)) {
tanLookUp[_local1] = Math.tan(DegreesToRadians(_local1 / MATHACCURACY));
_local1++;
}
}
function Vector(x, y, z) {
var _local1 = this;
_local1.x = x;
_local1.y = y;
_local1.z = z;
}
function vCopy(u, w) {
var _local1 = u;
var _local2 = w;
_local2.x = _local1.x;
_local2.y = _local1.y;
_local2.z = _local1.z;
}
function vMagnitude(v) {
var _local1 = v;
return(Math.sqrt(((_local1.x * _local1.x) + (_local1.y * _local1.y)) + (_local1.z * _local1.z)));
}
function vNormalise(v, w) {
var _local1 = w;
var _local3 = v;
if (!_local1) {
_local1 = _local3;
}
var _local2 = vMagnitude(_local3);
if (_local2 <= tol) {
_local2 = 1;
}
_local1.x = _local3.x / _local2;
_local1.y = _local3.y / _local2;
_local1.z = _local3.z / _local2;
if (Math.abs(_local1.x) < tol) {
_local1.x = 0;
}
if (Math.abs(_local1.y) < tol) {
_local1.y = 0;
}
if (Math.abs(_local1.z) < tol) {
_local1.y = 0;
}
}
function vReverse(v, w) {
var _local1 = w;
var _local2 = v;
if (!_local1) {
_local1 = _local2;
}
_local1.x = -_local2.x;
_local1.y = -_local2.y;
_local1.z = -_local2.z;
}
function vAdd(u, v, w) {
var _local1 = w;
var _local2 = u;
var _local3 = v;
if (!_local1) {
_local1 = _local2;
}
_local1.x = _local2.x + _local3.x;
_local1.y = _local2.y + _local3.y;
_local1.z = _local2.z + _local3.z;
}
function vSubtract(u, v, w) {
var _local1 = w;
var _local2 = u;
var _local3 = v;
if (!_local1) {
_local1 = _local2;
}
_local1.x = _local2.x - _local3.x;
_local1.y = _local2.y - _local3.y;
_local1.z = _local2.z - _local3.z;
}
function vMultiply(u, v, w) {
var _local1 = w;
var _local2 = u;
var _local3 = v;
if (!_local1) {
_local1 = _local2;
}
_local1.x = _local2.x * _local3.x;
_local1.y = _local2.y * _local3.y;
_local1.z = _local2.z * _local3.z;
}
function vMultiplyWithScalar(v, s, w) {
var _local1 = w;
var _local2 = v;
var _local3 = s;
if (!_local1) {
_local1 = _local2;
}
_local1.x = _local2.x * _local3;
_local1.y = _local2.y * _local3;
_local1.z = _local2.z * _local3;
}
function vDivide(u, v, w) {
var _local1 = w;
var _local2 = u;
var _local3 = v;
if (!_local1) {
_local1 = _local2;
}
_local1.x = _local2.x / _local3.x;
_local1.y = _local2.y / _local3.y;
_local1.z = _local2.z / _local3.z;
}
function vDivideByScalar(v, s, w) {
var _local1 = w;
var _local2 = v;
var _local3 = s;
if (!_local1) {
_local1 = _local2;
}
_local1.x = _local2.x / _local3;
_local1.y = _local2.y / _local3;
_local1.z = _local2.z / _local3;
}
function vCross(u, v) {
return((u.x * v.y) - (u.y * v.x));
}
function v3dCross(u, v, w) {
var _local1 = v;
var _local2 = u;
var _local3 = w;
_local3.x = (_local2.y * _local1.z) - (_local2.z * _local1.y);
_local3.y = ((-_local2.x) * _local1.z) + (_local2.z * _local1.x);
_local3.z = (_local2.x * _local1.y) - (_local2.y * _local1.x);
}
function vDot(p, q) {
var _local1 = (p.x * q.x) + (p.y * q.y);
return(_local1);
}
function vProj(u, v, w) {
var _local1 = v;
var _local3 = w;
if (!_local3) {
_local3 = u;
}
var _local2 = vDot(u, _local1) / vDot(_local1, _local1);
vMultiplyWithScalar(_local1, _local2, _local3);
}
function vAngle(u) {
var _local2 = u;
var _local1 = atan(_local2.y / _local2.x);
if (_local2.x < 0) {
_local1 = _local1 + 180;
}
return(_local1);
}
function vAngleBetween(u, v) {
var _local1 = (vAngle(v) - vAngle(u)) % 360;
if (_local1 > 180) {
_local1 = _local1 - 360;
} else if (_local1 < -180) {
_local1 = _local1 + 360;
}
return(_local1);
}
function DegreesToRadians(deg) {
return((deg * Math.PI) / 180);
}
function RadiansToDegrees(rad) {
return((rad * 180) / Math.PI);
}
function vRotate2D(angle, u, w) {
var _local2 = angle;
var _local3 = u;
if (!w) {
w = _local3;
}
_local2 = normaliseAngle(_local2);
var _local1 = new Vector(0, 0, 0);
_local1.x = (_local3.x * cos(-_local2)) + (_local3.y * sin(-_local2));
_local1.y = ((-_local3.x) * sin(-_local2)) + (_local3.y * cos(-_local2));
w.x = _local1.x;
w.y = _local1.y;
}
function vRotateX(angle, u, w) {
var _local2 = angle;
var _local3 = u;
if (!w) {
w = _local3;
}
_local2 = normaliseAngle(_local2);
var _local1 = new Vector(0, 0, 0);
_local1.z = (_local3.z * cos(-_local2)) + (_local3.y * sin(-_local2));
_local1.y = ((-_local3.z) * sin(-_local2)) + (_local3.y * cos(-_local2));
w.z = _local1.z;
w.y = _local1.y;
}
function vRotateY(angle, u, w) {
var _local2 = angle;
var _local3 = u;
if (!w) {
w = _local3;
}
_local2 = normaliseAngle(_local2);
var _local1 = new Vector(0, 0, 0);
_local1.z = (_local3.z * cos(-_local2)) + (_local3.x * sin(-_local2));
_local1.x = ((-_local3.z) * sin(-_local2)) + (_local3.x * cos(-_local2));
w.z = _local1.z;
w.x = _local1.x;
}
function vRotateYAroundPoint(angle, u, v, w) {
var _local3 = angle;
if (!w) {
w = u;
}
var _local2 = new Vector(0, 0, 0);
var _local1 = new Vector(0, 0, 0);
vSubtract(u, v, _local1);
_local3 = normaliseAngle(_local3);
_local2.z = (_local1.z * cos(-_local3)) + (_local1.x * sin(-_local3));
_local2.x = ((-_local1.z) * sin(-_local3)) + (_local1.x * cos(-_local3));
vAdd(_local2, v);
w.z = _local2.z;
w.x = _local2.x;
}
function VRotate2DAroundPoint(angle, u, v, w) {
var _local3 = angle;
if (!w) {
w = u;
}
var _local2 = new Vector(0, 0, 0);
var _local1 = new Vector(0, 0, 0);
vSubtract(u, v, _local1);
_local2.x = (_local1.x * cos(-_local3)) + (_local1.y * sin(-_local3));
_local2.y = ((-_local1.x) * sin(-_local3)) + (_local1.y * cos(-_local3));
vAdd(_local2, v);
w.x = _local2.x;
w.y = _local2.y;
}
function cos(a) {
var _local1 = Math.round(a * MATHACCURACY);
_local1 = _local1 % (360 * MATHACCURACY);
if (_local1 < 0) {
_local1 = _local1 + (360 * MATHACCURACY);
}
return(cosLookup[_local1]);
}
function sin(a) {
var _local1 = Math.round(a * MATHACCURACY);
_local1 = _local1 % (360 * MATHACCURACY);
if (_local1 < 0) {
_local1 = _local1 + (360 * MATHACCURACY);
}
return(sinLookup[_local1]);
}
function tan(a) {
return(Math.tan(DegreesToRadians(a)));
}
function atan(s) {
return(RadiansToDegrees(Math.atan(s)));
}
function acos(s) {
return(RadiansToDegrees(Math.acos(s)));
}
function normaliseAngle(angle) {
var _local1 = angle;
_local1 = _local1 % 360;
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
function initConstants() {
GRAVITY = 0.3;
DAMPING = 0.95;
DRAG = 0.9;
BOUNCE = 0.5;
NETZPOS = 540;
NETBOUNCE = 0.1;
NETXDAMPING = 0.2;
NETLEFT = -35;
NETRIGHT = 35;
NETTOP = -20;
KEEPERDEFLECT = 0.5;
SPINDRAG = 0.95;
BOARDZPOS = 600;
BOARDBOUNCE = 0.5;
GOALLEFT = -40;
GOALRIGHT = 40;
GOALTOP = -26;
BALLRADIUS = 0.5;
GROUND = -1;
}
function initVars() {
_global.main_mc = this;
InitLookups(20);
viewChanged = true;
screencenterX = 275;
screencenterY = 200;
d = 1079.8;
worldPos = new Vector(0, 0, 0);
worldDestPos = new Vector(0, 0, 0);
worldDestRot = new Vector(0, 0, 0);
worldDestZoom = d;
worldDestSpeed = 1;
worldRot = new Vector(0, 0, 0);
cams = new Array();
cams.push(new camera3d(0, -290, 252, -12, 0, 0, 620));
cams.push(new camera3d(0, -35, 250, -14, 0, 0, 620));
cams.push(new camera3d(0, -64, 411, -21, 0, 0, 620));
cams.push(new camera3d(0, -25, 383, -14, 0, 0, 620));
camnum = 2;
setCam(cams[2], 1);
vCopy(worldDestPos, worldPos);
vCopy(worldDestRot, worldRot);
d = worldDestZoom;
resolution = 10;
startPoint = new Vector(0, -1, 410);
ballStart = 26;
gameplaying = false;
clipCount = 0;
startPointRotation = 0;
rotatePoint = new Vector(0, 0, 500);
goalcount = 0;
bestSoFar = 0;
soundOn = true;
senderEmail = "";
senderName = "";
receiverEmail = "";
receiverName = "";
if (getQS("a", this._url) == "1") {
allowCameraMoves = true;
} else {
allowCameraMoves = false;
}
}
function initClips() {
instructions_mc._visible = false;
instructions_mc.stop();
GFX3D_mc._visible = false;
preloadedclips_mc._visible = false;
grain_mc._visible = false;
lose_mc._visible = false;
lose_mc.gotoAndStop(1);
win_mc._visible = false;
win_mc.gotoAndStop(1);
emailClip_mc._visible = false;
if (soundOn) {
s_music.start(0, 1000);
}
}
function instructionsFinished() {
instructions_mc._visible = false;
instructions_mc.gotoAndStop(1);
intro_mc._visible = true;
}
function initDials() {
var _local2 = this;
dials = new Array();
dials.push(new dial(dialDir_mc, -20, 20, -40, 40, updateRotateDial));
dials.push(new dial(dialPitch_mc, 50, 0, 6, 61, updateRotateDial));
dials.push(new dial(dialSwerve_mc, 2.5, -2.5, -60, 60, updateCurveDial));
dials.push(new dial(dialPower_mc, 1, 30, -69, 69, updateRotateDial));
dials[0].setFunction = function () {
this.deactivate();
dials[1].activate();
};
dials[1].setFunction = function () {
this.deactivate();
dials[2].activate();
};
dials[2].setFunction = function () {
this.deactivate();
dials[3].activate();
};
dials[3].setFunction = function () {
this.deactivate();
vSubtract(rotatePoint, ball.pos, ball.vel);
vNormalise(ball.vel);
vMultiplyWithScalar(ball.vel, dials[3].currentSetting);
vRotateY(dials[0].currentSetting, ball.vel);
vRotateX(dials[1].currentSetting, ball.vel);
ball.spin = dials[2].currentSetting;
ballDir = dials[0].currentSetting;
var _local1 = 0;
while (_local1 < dials.length) {
dials[_local1].shrink(_local1);
_local1++;
}
gameplaying = true;
gameprogress = 0;
player.clip_mc.play();
};
needleSpeed = 0.5;
}
function playResult() {
if (goalscored) {
win_mc._visible = true;
win_mc.play();
} else {
lose_mc._visible = true;
lose_mc.play();
if (bestSoFar == 1) {
bestSoFarText = "1 Free Kick";
} else {
bestSoFarText = bestSoFar + " Free Kicks";
}
if (goalcount == 1) {
scoreText = "1 Free Kick";
} else {
scoreText = goalcount + " Free Kicks";
}
_global.main_mc.scoreText;
s_crowdloop.stop();
goalcount = 0;
registerScore();
if (soundOn) {
s_music.start(0, 1000);
}
}
gameplaying = false;
}
function startGame() {
intro_mc._visible = false;
instructions_mc._visible = false;
resetGame();
}
function showInstructions() {
intro_mc._visible = false;
instructions_mc._visible = true;
instructions_mc.gotoAndPlay(1);
}
function resetGame() {
stopAllSounds();
lose_mc._visible = false;
lose_mc.gotoAndStop(1);
win_mc._visible = false;
win_mc.gotoAndStop(1);
GFX3D_mc._visible = true;
var _local1 = 1;
while (_local1 < dials.length) {
dials[_local1].enlarge(_local1);
_local1++;
}
dials[0].activate();
ball.pos.x = 0;
ball.pos.y = -1;
ball.pos.z = 360;
player.pos.x = -3;
player.pos.y = -3;
player.pos.z = 350;
defenders.pos.x = 0;
defenders.pos.y = 0;
defenders.pos.z = 450;
defenders.clip_mc.def1_mc.gotoAndStop(1);
defenders.clip_mc.def2_mc.gotoAndStop(1);
defenders.clip_mc.def3_mc.gotoAndStop(1);
goalie.clip_mc.gotoAndStop(1);
goalscored = false;
setCam(cams[2], 1);
vCopy(worldDestPos, worldPos);
vCopy(worldDestRot, worldRot);
gameplaying = false;
player.clip_mc.gotoAndStop(1);
grain_mc._visible = true;
defenders.clip_mc.gotoAndStop(goalcount + 1);
startPointRotation = (Math.random() * 40) - 20;
vRotateYAroundPoint(startPointRotation, ball.pos, rotatePoint);
vRotateYAroundPoint(startPointRotation, player.pos, rotatePoint);
vRotateYAroundPoint(startPointRotation, defenders.pos, rotatePoint);
setCam(cams[1], 0.1);
vRotateYAroundPoint(startPointRotation, WorldDestPos, rotatePoint);
worldDestRot.y = startPointRotation;
s_crowdloop.stop();
if (soundOn) {
s_crowdloop.start(0, 1000);
}
updateNumberDial(goals_mc, goalcount);
updateNumberDial(bestscore_mc, bestSoFar);
scoreRegistered = false;
playSound(s_comments[(scommentcount++) % 4]);
}
function toggleCams() {
camnum = (camnum + 1) % cams.length;
setCam(cams[camnum], 0.6);
}
function camButton(num) {
camnum = num;
setCam(cams[camnum], 0.6);
}
function initPitch() {
GFX3D_mc.createEmptyMovieClip("dynamicGFX_mc", 4);
dynamicGFX = GFX3D_mc.dynamicGFX_mc;
GFX3D_mc.createEmptyMovieClip("dynamicBG2_mc", 3);
dynamicBG2 = GFX3D_mc.dynamicBG2_mc;
GFX3D_mc.createEmptyMovieClip("dynamicBG_mc", 2);
dynamicBG = GFX3D_mc.dynamicBG_mc;
GFX3D_mc.createEmptyMovieClip("dynamicBG3_mc", 1);
dynamicBG3 = GFX3D_mc.dynamicBG3_mc;
pitch = new object3D(0, 0, 0, 0, 0, 0);
p = pitch.numpoints;
pitch.addpoint(new Vector(-230, 0, 520));
pitch.addpoint(new Vector(230, 0, 520));
pitch.addpoint(new Vector(230, 0, 380));
pitch.addpoint(new Vector(-230, 0, 380));
pitch.addline(p, p + 1, 3, 16777215, dynamicBG2);
pitch.addline(p + 1, p + 2, 3, 16777215, dynamicBG2);
pitch.addline(p + 3, p, 3, 16777215, dynamicBG2);
p = pitch.numpoints;
pitch.addpoint(new Vector(-120, 0, 520));
pitch.addpoint(new Vector(120, 0, 520));
pitch.addpoint(new Vector(120, 0, 400));
pitch.addpoint(new Vector(-120, 0, 400));
pitch.addline(p + 3, p + 2, 3, 16777215, dynamicBG2);
pitch.addline(p + 1, p + 2, 3, 16777215, dynamicBG2);
pitch.addline(p, p + 3, 3, 16777215, dynamicBG2);
p = pitch.numpoints;
pitch.addpoint(new Vector(-70, 0, 520));
pitch.addpoint(new Vector(70, 0, 520));
pitch.addpoint(new Vector(70, 0, 465));
pitch.addpoint(new Vector(-70, 0, 465));
pitch.addline(p + 1, p + 2, 3, 16777215, dynamicBG2);
pitch.addline(p + 2, p + 3, 3, 16777215, dynamicBG2);
pitch.addline(p + 3, p + 0, 3, 16777215, dynamicBG2);
p = pitch.numpoints;
pitch.addpoint(new Vector(-0.3, 0, 410));
pitch.addpoint(new Vector(0.3, 0, 410));
pitch.addline(p, p + 1, 2, false, dynamicBG);
goal = new object3D(0, 0, 0, 0, 0, 0);
p = goal.numpoints;
goal.addpoint(new Vector(GOALLEFT, 0, 520));
goal.addpoint(new Vector(GOALLEFT, GOALTOP, 520));
goal.addpoint(new Vector(GOALRIGHT, GOALTOP, 520));
goal.addpoint(new Vector(GOALRIGHT, 0, 520));
goal.addline(p + 1, p, 5, 16777215);
goal.addline(p + 1, p + 2, 5, 16777215);
goal.addline(p + 2, p + 3, 5, 16777215);
goal.addpoint(new Vector(GOALLEFT, 0, 550));
goal.addpoint(new Vector(GOALLEFT, GOALTOP, 550));
goal.addpoint(new Vector(GOALRIGHT, GOALTOP, 550));
goal.addpoint(new Vector(GOALRIGHT, 0, 550));
goal.addquad(p + 4, p + 5, p + 6, p + 7, 16777215, dynamicGFX, 30);
goal.addquad(p, p + 1, p + 5, p + 4, 16777215, dynamicGFX, 40);
goal.addquad(p + 1, p + 2, p + 6, p + 5, 16777215, dynamicGFX, 40);
goal.addquad(p + 6, p + 2, p + 3, p + 7, 16777215, dynamicGFX, 40);
goal.addline(p + 4, p + 5, 1, 16777215);
goal.addline(p + 5, p + 6, 1, 16777215);
goal.addline(p + 6, p + 7, 1, 16777215);
goal.addline(p + 1, p + 5, 1, 16777215);
goal.addline(p + 6, p + 2, 1, 16777215);
var _local1 = 0;
while (_local1 <= 16) {
var p = pitch.numpoints;
pitch.addpoint(new Vector(-250, 0, 200 + (_local1 * 25)));
pitch.addpoint(new Vector(250, 0, 200 + (_local1 * 25)));
if (_local1 > 0) {
if ((_local1 % 2) == 0) {
pitch.addquad(p, p + 1, p - 1, p - 2, 8421504, dynamicBG);
} else {
pitch.addquad(p, p + 1, p - 1, p - 2, 9474192, dynamicBG);
}
}
_local1++;
}
ball = new image3D(0, -1, 360, 0.11, "ball", _root.dynamicGFX);
ballshadow = new image3D(0, 0, 360, 0.11, "ballshadow", dynamicGFX);
ball.vel = new Vector(0, 0, 0);
ball.spin = 0;
player = new image3D(-3, -3, 350, 0.15, "playerShoot", dynamicGFX);
goalie = new image3D(0, 0, 515, 0.07, "goalie", dynamicGFX);
defenders = new image3D(0, 0, 450, 0.06, "defenders", dynamicGFX);
frontadboards = new image3D(0, 0, 600, 0.6, "backstand", dynamicBG3);
objects3d = new Array(pitch, goal, goalie, player, defenders, frontadboards);
ball.clip_mc.spots_mc.stop();
GOALWIDTH = 73.2;
GOALHEIGHT = -24.4;
ROWS = 5;
COLS = 7;
GOALX = -36.6;
GOALZ = 519;
GOALY = 0;
}
function updateFrameRate() {
if (!lasttimer) {
lasttimer = getTimer();
} else {
thistimer = getTimer();
diff = thistimer - lasttimer;
framerate = Math.round(1000 / diff);
lasttimer = thistimer;
}
}
function frameFunction() {
updateFrameRate();
if (!gameplaying) {
moveCameraWithMouse();
}
checkKeys();
updateCamera();
checkFade();
updateDials();
if (viewChanged) {
viewChanged = false;
for (var _local1 in objects3d) {
objects3d[_local1].updatePoints();
objects3d[_local1].updatePos();
objects3d[_local1].draw();
}
}
if (gameprogress > ballStart) {
updateBall();
}
if (gameprogress == 0) {
playSound(s_whistle, 60);
}
if (gameprogress == ballStart) {
playSound(s_kick, 100);
}
ball.updatePos();
ball.draw();
ballshadow.updatePos();
ballshadow.draw();
updateBallSpots();
gameprogress++;
}
function updateBall() {
if (ball.pos.y < GROUND) {
vMultiplyWithScalar(ball.vel, DAMPING);
vRotateY(ball.spin, ball.vel);
ball.spin = ball.spin * SPINDRAG;
} else {
vMultiplyWithScalar(ball.vel, DRAG);
}
ball.vel.y = ball.vel.y + gravity;
ball.newpos = new Vector(0, 0, 0);
vAdd(ball.pos, ball.vel, ball.newpos);
if (ball.newpos.y > GROUND) {
ball.newpos.y = GROUND;
ball.vel.y = (-ball.vel.y) * bounce;
}
if ((ball.newpos.z > boardZpos) && (ball.vel.z > 0)) {
ball.newpos.z = boardZpos;
ball.vel.z = ball.vel.z * (-BOARDBOUNCE);
}
if (checkCollisionWithFlat(defenders)) {
if (ball.clip_mc.hitTest(defenders.clip_mc.def1_mc)) {
defenders.clip_mc.def1_mc.play();
}
if (ball.clip_mc.hitTest(defenders.clip_mc.def2_mc)) {
defenders.clip_mc.def2_mc.play();
}
if (ball.clip_mc.hitTest(defenders.clip_mc.def3_mc)) {
defenders.clip_mc.def3_mc.play();
}
setCam(cams[3], 0.1);
worldDestPos.x = defenders.pos.x;
registerScore();
}
if (checkCollisionWithFlat(goalie)) {
registerScore();
}
if ((ball.pos.z < 520) && (ball.newpos.z > 520)) {
if (ball.clip_mc.hitTest(goalie.clip_mc)) {
ball.vel.z = ball.vel.z * (-KEEPERDEFLECT);
ball.newpos.z = goalie.pos.z;
playSound(s_kick, 100);
}
if (((((!goalscored) && (!goaliesave)) && (ball.newpos.x >= (GOALLEFT + BALLRADIUS))) && (ball.newpos.x <= (GOALRIGHT - BALLRADIUS))) && (ball.newpos.y > (GOALTOP + BALLRADIUS))) {
goalscored = true;
} else {
goalscored = false;
}
if (((ball.newpos.x > (GOALLEFT - BALLRADIUS)) && (ball.newpos.x < (GOALLEFT + BALLRADIUS))) && (ball.newpos.y > GOALTOP)) {
ball.newpos.z = 519;
ball.vel.z = ball.vel.z * (-KEEPERDEFLECT);
playSound(s_kick, 100);
} else if (((ball.newpos.x < (GOALRIGHT + BALLRADIUS)) && (ball.newpos.x > (GOALRIGHT - BALLRADIUS))) && (ball.newpos.y > GOALTOP)) {
ball.newpos.z = 519;
ball.vel.z = ball.vel.z * (-KEEPERDEFLECT);
playSound(s_kick, 100);
} else if ((((ball.newpos.x > GOALLEFT) && (ball.newpos.x < GOALRIGHT)) && (ball.newpos.y > (GOALTOP - BALLRADIUS))) && (ball.newpos.y < (GOALTOP + BALLRADIUS))) {
ball.newpos.z = 519;
ball.vel.z = ball.vel.z * (-KEEPERDEFLECT);
playSound(s_kick, 100);
}
registerScore();
}
if (goalscored) {
if ((ball.newpos.z > NETZPOS) && (ball.vel.z > 0)) {
ball.vel.z = ball.vel.z * (-NETBOUNCE);
ball.vel.x = ball.vel.x * NETXDAMPING;
}
if ((ball.newpos.x < NETLEFT) && (ball.vel.x < 0)) {
ball.vel.x = ball.vel.x * (-NETBOUNCE);
}
if ((ball.newpos.x > NETRIGHT) && (ball.vel.x > 0)) {
ball.vel.x = ball.vel.x * (-NETBOUNCE);
}
if ((ball.newpos.y < NETTOP) && (ball.vel.y < 0)) {
ball.vel.y = ball.vel.y * (-NETBOUNCE);
}
}
if ((ball.pos.z <= 450) && (ball.newpos.z >= 450)) {
if ((ballDir < -2) && (ballDir > -30)) {
if (goalie.clip_mc._xscale < 0) {
goalie.clip_mc._xscale = -goalie.clip_mc._xscale;
}
goalie.clip_mc.play();
} else if ((ballDir > 2) && (ballDir < 30)) {
if (goalie.clip_mc._xscale > 0) {
goalie.clip_mc._xscale = -goalie.clip_mc._xscale;
}
goalie.clip_mc.play();
} else if ((ballDir >= -2) && (ballDir <= 2)) {
goalie.clip_mc.gotoAndPlay("save2");
}
}
vCopy(ball.newpos, ball.pos);
ballshadow.pos.x = ball.newpos.x;
ballshadow.pos.z = ball.newpos.z;
var _local1 = Math.round(Math.abs(ball.newpos.y / 2));
if (_local1 > ballshadow.clip_mc._totalframes) {
_local1 = ballshadow.clip_mc._totalframes;
}
ballshadow.clip_mc.gotoAndStop(_local1);
if ((gameplaying && (Math.abs(ball.vel.z) < 0.01)) && (gameprogress > ballStart)) {
ball.vel.x = 0;
ball.vel.y = 0;
ball.vel.z = 0;
playResult();
}
if (((worldDestPos.z - ball.pos.z) < -150) && (worldDestPos.z < 400)) {
worldDestPos.z = ball.pos.z - 150;
}
}
function registerScore() {
if (!scoreRegistered) {
if (goalscored) {
debuginfo = debuginfo + "\nSCORED!!!";
goalcount++;
goalinfo = "SCORE!";
playSound(s_goal[(sgoalcount++) % 4]);
playSound(s_cheer, 25);
} else {
debuginfo = debuginfo + "\nMISS!!!";
if (goalcount > bestSoFar) {
bestSoFar = goalcount;
}
goalinfo = "MISS!";
updateNumberDial(bestscore_mc, bestSoFar);
playSound(s_miss[(smisscount++) % 4]);
playSound(s_boo, 25);
}
updateNumberDial(goals_mc, goalcount);
scoreRegistered = true;
}
}
function checkCollisionWithFlat(flat) {
var _local1 = flat;
if ((ball.pos.z < _local1.pos.z) && (ball.newpos.z > _local1.pos.z)) {
if (ball.clip_mc.hitTest(_local1.clip_mc)) {
ball.vel.z = ball.vel.z * (-KEEPERDEFLECT);
ball.newpos.z = _local1.pos.z;
playSound(s_kick, 100);
return(true);
}
}
return(false);
}
function updateBallSpots() {
if (ball.pos.y <= startPoint.y) {
var _local1 = parseInt((ball.pos.z % ball.clip_mc.spots_mc._totalframes) + 1);
ball.clip_mc.spots_mc.gotoAndPlay(_local1);
}
}
function checkKeys() {
if (Key.isDown(Key.Left) && (Key.isDown(Key.Right))) {
allowCameraMovement = true;
}
}
function moveCameraWithMouse() {
var _local1 = _root;
if (!allowCameraMovement) {
return(false);
}
var _local3 = 0;
var rightlimit = 550;
var _local2 = 0;
var bottomlimit = 300;
var xmin = -55;
var xmax = 55;
var zmin = 400;
var zmax = 240;
if ((((_local1._xmouse > _local3) && (_local1._xmouse < rightlimit)) && (_local1._ymouse > _local2)) && (_local1._ymouse < bottomlimit)) {
worldDestPos.x = (((_local1._xmouse - _local3) / (rightlimit - _local3)) * (xmax - xmin)) + xmin;
worldDestPos.z = (((_local1._ymouse - _local2) / (bottomlimit - _local2)) * (zmax - zmin)) + zmin;
worldDestRot.y = worldDestPos.x * -0.15;
worldDestSpeed = 0.15;
resetCam = false;
} else if (!resetCam) {
setCam(cams[1], 0.15);
vRotateYAroundPoint(startPointRotation, WorldDestPos, rotatePoint);
worldDestRot.y = startPointRotation;
resetCam = true;
}
return(undefined);
}
function swapClips(oldClip_mc, newClipName, targetClip_mc) {
var _local1 = oldClip_mc;
targetClip_mc.attachMovie(newClipName, _local1._name + "_tmp", _local1.getDepth() + 100000);
var _local2 = targetClip_mc[_local1._name + "_tmp"];
_local2._xscale = _local1._xscale;
_local2._yscale = _local1._yscale;
_local2._x = _local1._x;
_local2._y = _local1._y;
_local1.swapDepths(_local2);
var _local3 = _local1._name;
removeMovieClip(_local1);
_local2._name = _local3;
return(_local2);
}
function B4(t) {
var _local1 = t;
return((_local1 * _local1) * _local1);
}
function B3(t) {
var _local1 = t;
return(((3 * _local1) * _local1) * (1 - _local1));
}
function B2(t) {
var _local1 = t;
return(((3 * _local1) * (1 - _local1)) * (1 - _local1));
}
function B1(t) {
var _local1 = t;
return(((1 - _local1) * (1 - _local1)) * (1 - _local1));
}
function startFadeOut(speed, donefunction) {
if (!currBrightness) {
currBrightness = 0;
}
if (fadeFunction) {
fadeFunction();
}
fadeFunction = donefunction;
fadeChange = -(100 / speed);
}
function startFadeIn(speed, donefunction) {
if (!currBrightness) {
currBrightness = -100;
}
if (fadeFunction) {
fadeFunction();
}
fadeFunction = donefunction;
fadeChange = 100 / speed;
}
function checkFade() {
if (fadeChange) {
currBrightness = currBrightness + fadeChange;
if (currBrightness > 0) {
currBrightness = 0;
fadeChange = false;
if (fadeFunction) {
fadeFunction();
fadeFunction = null;
}
} else if (currBrightness < -100) {
currBrightness = -100;
fadeChange = false;
if (fadeFunction) {
fadeFunction();
fadeFunction = null;
}
}
adjustBrightness(currBrightness);
}
}
function adjustBrightness(brightness) {
var _local1 = new Color(GFX3D_mc);
_local1.setBrightness(brightness, true);
}
function initSounds() {
var _local2 = 1;
sounds_mc.createEmptyMovieClip("kick_mc", _local2++);
s_kick = new Sound(sounds_mc.kick_mc);
s_kick.attachSound("s_kick");
sounds_mc.createEmptyMovieClip("cheer_mc", _local2++);
s_cheer = new Sound(sounds_mc.cheer_mc);
s_cheer.attachSound("s_cheer");
sounds_mc.createEmptyMovieClip("boo_mc", _local2++);
s_boo = new Sound(sounds_mc.boo_mc);
s_boo.attachSound("s_boo");
sounds_mc.createEmptyMovieClip("whistle_mc", _local2++);
s_whistle = new Sound(sounds_mc.whistle_mc);
s_whistle.attachSound("s_whistle");
sounds_mc.createEmptyMovieClip("crowdloop_mc", _local2++);
s_crowdloop = new Sound(sounds_mc.crowdloop_mc);
s_crowdloop.attachSound("s_crowdloop");
s_crowdloop.setVolume(7);
sounds_mc.createEmptyMovieClip("s_music", _local2++);
s_music = new Sound(sounds_mc.s_music);
s_music.attachSound("s_music");
s_music.setVolume(15);
s_comments = new Array();
s_goal = new Array();
s_miss = new Array();
var _local1 = 1;
while (_local1 <= 4) {
sounds_mc.createEmptyMovieClip("s_comments" + _local1, _local2++);
s_comments.push(new Sound(sounds_mc["s_comments" + _local1]));
s_comments[_local1 - 1].attachSound("comment" + _local1);
sounds_mc.createEmptyMovieClip("s_goal" + _local1, _local2++);
s_goal.push(new Sound(sounds_mc["s_goal" + _local1]));
s_goal[_local1 - 1].attachSound("goal" + _local1);
sounds_mc.createEmptyMovieClip("s_miss" + _local1, _local2++);
s_miss.push(new Sound(sounds_mc["s_miss" + _local1]));
s_miss[_local1 - 1].attachSound("miss" + _local1);
_local1++;
}
}
function playSound(soundobj, vol, delay) {
if (soundOn) {
if (delay == undefined) {
delay = 0;
}
if (vol != undefined) {
soundobj.setVolume(vol);
}
soundobj.start();
}
}
function playSwish() {
playSound(s_swish, 50);
}
function toggleSound() {
if (soundOn) {
stopAllSounds();
soundbutton_mc.gotoAndStop(2);
} else {
s_crowdloop.start(0, 1000);
soundbutton_mc.gotoAndStop(1);
}
soundOn = !soundOn;
}
function emailClipFinished() {
emailClip_mc._visible = false;
lose_mc._visible = true;
}
function showEmailClip() {
lose_mc._visible = false;
emailClip_mc._visible = true;
emailClip_mc.gotoAndStop(1);
emailClip_mc.senderscore = bestSoFar;
}
function getQS(strTarget, strURL) {
var _local3 = strTarget;
var nPos;
var _local2;
var _local1;
var strPara;
if (strURL.lastIndexOf("?")) {
strURL = strURL.substring(strURL.lastIndexOf("?") + 1, strURL.length);
_local2 = strURL.split("&");
_local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1].substr(0, _local3.length).toLowerCase() == _local3.toLowerCase()) {
return(_local2[_local1].substr(_local2[_local1].indexOf("=") + 1));
}
_local1++;
}
}
return("");
}
TWOPI = (Math.PI*2);
Color.prototype.setTint = function (col, percent, resetMode) {
if (isNaN(col) || (isNaN(percent))) {
return(undefined);
}
col = ((col <= 0) ? 0 : (((col >= 16777215) ? 16777215 : (Math.round(col)))));
percent = ((percent <= 0) ? 0 : (((percent >= 100) ? 1 : (percent / 100))));
if ((resetMode == undefined) || ((resetMode != true) && (resetMode != false))) {
resetMode = true;
}
var trans = this.getTransform();
if (resetMode) {
with (trans) {
ra = (ga = (ba = 100));
rb = (gb = (bb = 0));
}
}
with (trans) {
ra = ra - (ra * percent);
ga = ga - (ga * percent);
ba = ba - (ba * percent);
rb = rb + ((((col & 16711680) >> 16) - rb) * percent);
gb = gb + ((((col & 65280) >> 8) - gb) * percent);
bb = bb + (((col & 255) - bb) * percent);
}
this.setTransform(trans);
};
Color.prototype.resetBrightness = function () {
var trans = this.getTransform();
with (trans) {
ra = (ga = (ba = 100));
rb = (gb = (bb = 0));
}
this.setTransform(trans);
};
Color.prototype.setBrightness = function (value, resetMode) {
if (isNaN(value)) {
return(undefined);
}
value = ((value <= -100) ? -100 : (((value >= 100) ? 100 : (value))));
if ((resetMode == undefined) || ((resetMode != true) && (resetMode != false))) {
resetMode = true;
}
var trans = this.getTransform();
if (resetMode) {
with (trans) {
ra = (ga = (ba = 100));
rb = (gb = (bb = 0));
}
}
var percent = (Math.abs(value) / 100);
var brightnessColor = ((value > 0) ? 255 : 0);
with (trans) {
ra = ra - (ra * percent);
ga = ga - (ga * percent);
ba = ba - (ba * percent);
rb = rb + ((brightnessColor - rb) * percent);
gb = gb + ((brightnessColor - gb) * percent);
bb = bb + ((brightnessColor - bb) * percent);
}
this.setTransform(trans);
};
Color.prototype.negative = function () {
var trans = this.getTransform();
with (trans) {
ra = ra * -1;
ga = ga * -1;
ba = ba * -1;
rb = 255 - rb;
gb = 255 - gb;
bb = 255 - bb;
}
this.setTransform(trans);
};
Color.prototype.reset = function () {
this.setTransform({ra:100, ga:100, ba:100, aa:100, rb:0, gb:0, bb:0, ab:0});
};
Color.getColor = function (r, g, b) {
var _local1 = b;
var _local2 = r;
var _local3 = g;
if ((isNaN(_local2) || (isNaN(_local3))) || (isNaN(_local1))) {
return(-1);
}
_local2 = ((_local2 <= 0) ? 0 : (((_local2 >= 255) ? 255 : (Math.round(_local2)))));
_local3 = ((_local3 <= 0) ? 0 : (((_local3 >= 255) ? 255 : (Math.round(_local3)))));
_local1 = ((_local1 <= 0) ? 0 : (((_local1 >= 255) ? 255 : (Math.round(_local1)))));
return(((_local2 << 16) | (_local3 << 8)) | _local1);
};
initSounds();
stop();
initConstants();
initVars();
initDials();
initClips();
initPitch();
main_mc.onEnterFrame = frameFunction;
Symbol 107 MovieClip Frame 1 (8 B)
stop();
Symbol 125 MovieClip [playerShoot] Frame 1 (8 B)
stop();
Symbol 125 MovieClip [playerShoot] Frame 37 (8 B)
stop();
Symbol 141 MovieClip [goalie] Frame 1 (8 B)
stop();
Symbol 141 MovieClip [goalie] Frame 11 (8 B)
stop();
Symbol 141 MovieClip [goalie] Frame 18 (8 B)
stop();
Symbol 154 MovieClip [ballshadow] Frame 1 (8 B)
stop();
Symbol 158 MovieClip Frame 1 (8 B)
stop();
Symbol 158 MovieClip Frame 4 (8 B)
stop();
Symbol 162 MovieClip Frame 1 (8 B)
stop();
Symbol 162 MovieClip Frame 4 (8 B)
stop();
Symbol 166 MovieClip Frame 1 (8 B)
stop();
Symbol 166 MovieClip Frame 4 (8 B)
stop();
Symbol 167 MovieClip [defenders] Frame 1 (8 B)
stop();
Symbol 193 MovieClip Frame 1 (8 B)
stop();
Symbol 205 MovieClip Frame 1 (8 B)
stop();
Symbol 267 Button (48 B)
on (release) {
_global.main_mc.toggleSound();
}
Symbol 269 Button (48 B)
on (release) {
_global.main_mc.toggleSound();
}
Symbol 270 MovieClip Frame 1 (8 B)
stop();
Symbol 296 Button (40 B)
on (release) {
gotoAndPlay ("step0");
}
Symbol 303 Button (40 B)
on (release) {
gotoAndPlay ("step1");
}
Symbol 308 Button (40 B)
on (release) {
gotoAndPlay ("step2");
}
Symbol 317 Button (40 B)
on (release) {
gotoAndPlay ("step3");
}
Symbol 331 Button (40 B)
on (release) {
gotoAndPlay ("step4");
}
Symbol 354 Button (57 B)
on (release) {
_global.main_mc.instructionsFinished();
}
Symbol 358 MovieClip Frame 1 (1 B)
Symbol 358 MovieClip Frame 89 (8 B)
stop();
Symbol 358 MovieClip Frame 110 (8 B)
stop();
Instance of Symbol 248 MovieClip in Symbol 358 MovieClip Frame 113 (119 B)
onClipEvent (load) {
this.needle_mc._visible = false;
this.set_btn._visible = false;
this.set_btn.enabled = false;
}
Symbol 358 MovieClip Frame 179 (23 B)
gotoAndPlay ("step1");
Instance of Symbol 238 MovieClip in Symbol 358 MovieClip Frame 183 (119 B)
onClipEvent (load) {
this.needle_mc._visible = false;
this.set_btn._visible = false;
this.set_btn.enabled = false;
}
Symbol 358 MovieClip Frame 248 (23 B)
gotoAndPlay ("step2");
Instance of Symbol 242 MovieClip in Symbol 358 MovieClip Frame 251 (119 B)
onClipEvent (load) {
this.needle_mc._visible = false;
this.set_btn._visible = false;
this.set_btn.enabled = false;
}
Symbol 358 MovieClip Frame 317 (23 B)
gotoAndPlay ("step3");
Instance of Symbol 245 MovieClip in Symbol 358 MovieClip Frame 320 (119 B)
onClipEvent (load) {
this.needle_mc._visible = false;
this.set_btn._visible = false;
this.set_btn.enabled = false;
}
Symbol 358 MovieClip Frame 383 (23 B)
gotoAndPlay ("step4");
Symbol 421 Button (46 B)
on (release) {
_global.main_mc.startGame();
}
Symbol 425 Button (53 B)
on (release) {
_global.main_mc.showInstructions();
}
Symbol 427 MovieClip Frame 262 (8 B)
stop();
Symbol 436 Button (43 B)
on (release) {
gotoAndPlay ("endFrame");
}
Symbol 458 Button (46 B)
on (release) {
_global.main_mc.resetGame();
}
Symbol 466 MovieClip Frame 86 (8 B)
stop();
Symbol 466 MovieClip Frame 214 (8 B)
stop();
Symbol 472 MovieClip Frame 92 (29 B)
_global.main_mc.resetGame();
Symbol 482 Button (29 B)
on (release) {
sendForm();
}
Symbol 484 Button (54 B)
on (release) {
_global.main_mc.emailClipFinished();
}
Symbol 494 Button (34 B)
on (release) {
gotoAndStop (1);
}
Symbol 496 MovieClip Frame 1 (706 B)
function sendForm() {
var _local1 = _global;
_local1.main_mc.senderEmail = senderEmail;
_local1.main_mc.senderName = senderName;
_local1.main_mc.receiverEmail = receiverEmail;
_local1.main_mc.receiverName = receiverName;
if ((((senderEmail != "") && (senderName != "")) && (receiverEmail != "")) && (receiverName != "")) {
loadVariables ("sendfreekickmail.aspx", this, "POST");
gotoAndStop (3);
} else {
gotoAndStop (2);
}
}
senderEmail = _global.main_mc.senderEmail;
senderName = _global.main_mc.senderName;
receiverEmail = _global.main_mc.receiverEmail;
receiverName = _global.main_mc.receiverName;
senderscore = _global.main_mc.bestSoFar;
stop();