Frame 1
stop();
delete human;
delete this.onEnterFrame;
var human = new Human(this);
human.trans(new Vec(100, -100));
human.draw();
if (!mouseListener) {
this.mouseListener = {onMouseDown:function () {
human.fire();
}};
Mouse.addListener(mouseListener);
}
this.onEnterFrame = function () {
this.clear();
human.hitTest(area);
human.update();
human.draw();
};
Instance of Symbol 36 MovieClip in Frame 1
on (press) {
_parent.gotoAndPlay(2);
}
Frame 2
var human = new Human(this);
human.trans(new Vec(0, 200));
human.draw();
var line = ((-human.pts[0].x) + (Stage.width / 2));
var depth = 1000;
this.attachMovie("Field", "field", depth++);
this.attachMovie("View", "view", 1000000);
var count = 0;
var level = 1;
var prev_level = 1;
this.onEnterFrame = function () {
this.clear();
human.hitTest(field);
human.hitTest(field2);
human.update();
human.draw();
var _local3 = -(line - (Stage.width / 2));
if ((field._x + field._width) < (_local3 + 600)) {
if (!field2) {
if (count < 11) {
this.attachMovie("Field" + count, "field" + depth, depth);
} else {
this.attachMovie("Field" + Math.floor(Math.random() * 11), "field" + depth, depth);
}
count++;
field2 = this["field" + depth];
depth++;
field2._x = field._x + field._width;
}
}
if (field2) {
if ((field._x + field._width) < (_local3 - 600)) {
field.removeMovieClip();
field = field2;
delete field2;
prev_level++;
}
}
if (prev_level == level) {
if (field2._x < human.pts[0].x) {
level++;
}
}
if (line > ((100 - human.pts[0].x) + (Stage.width / 2))) {
line = (line * 0.8) + (((100 - human.pts[0].x) + (Stage.width / 2)) * 0.2);
}
line = line - (1 - Math.floor(line / 50000));
_x = line;
view._x = (-_x) + 350;
view._y = (-_y) + 120;
view.level = "level " + level;
var _local2 = "" + (-int(line - (Stage.width / 2)));
if (_local2.length == 1) {
_local2 = "0" + _local2;
}
if (_local2.length == 2) {
_local2 = "0" + _local2;
}
view.m = (_local2.slice(0, _local2.length - 2) + ".") + _local2.slice(_local2.length - 2, _local2.length);
if ((human.pts[0].x < (_local3 - 400)) || (human.pts[0].y > 1000)) {
gotoAndPlay (3);
}
};
stop();
Frame 3
stop();
field.removeMovieClip();
field2.removeMovieClip();
view.removeMovieClip();
delete human;
delete field;
delete field2;
delete view;
var str = ("" + (-int(line - (Stage.width / 2))));
if (str.length == 1) {
str = "0" + str;
}
if (str.length == 2) {
str = "0" + str;
}
str = (str.slice(0, str.length - 2) + ".") + str.slice(str.length - 2, str.length);
text = ("Score : " + str) + " YD";
_x = 0;
var human = new Human(this);
human.trans(new Vec(300, 200));
human.draw();
this.onEnterFrame = function () {
this.clear();
human.hitTest(area);
human.update();
human.draw();
};
Instance of Symbol 43 MovieClip in Frame 3
on (press) {
_parent.gotoAndPlay(1);
}
Symbol 44 MovieClip [__Packages.Human] Frame 0
class Human
{
var mc, pts, size, left_wire, right_wire, walk_state, on_the_ground, use_left;
function Human (nmc) {
mc = nmc;
pts = new Array(11);
size = 3;
var _local4 = 4;
var _local3 = 6;
var _local2 = 4;
pts[0] = new Vec(0, (-size) * 2.5);
pts[1] = new Vec(0, -size);
pts[2] = new Vec(0, _local2 * size);
pts[3] = new Vec((-_local4) * size, 0);
pts[4] = new Vec(_local4 * size, 0);
pts[5] = new Vec(-size, (_local2 * size) + (_local3 * size));
pts[6] = new Vec(size, (_local2 * size) + (_local3 * size));
pts[7] = new Vec(((-_local4) * 2) * size, 0);
pts[8] = new Vec((_local4 * 2) * size, 0);
pts[9] = new Vec(-size, (_local2 * size) + ((_local3 * 2) * size));
pts[10] = new Vec(size, (_local2 * size) + ((_local3 * 2) * size));
pts[0].addLink(pts[1]);
pts[1].addLink(pts[2]);
pts[1].addLink(pts[3]);
pts[1].addLink(pts[4]);
pts[2].addLink(pts[5]);
pts[2].addLink(pts[6]);
pts[3].addLink(pts[7]);
pts[4].addLink(pts[8]);
pts[5].addLink(pts[9]);
pts[6].addLink(pts[10]);
left_wire = new Wire(mc, left_hand());
right_wire = new Wire(mc, right_hand());
left_wire.trans(left_hand());
right_wire.trans(right_hand());
walk_state = 0;
on_the_ground = 0;
use_left = true;
}
function left_hand() {
return(pts[8]);
}
function right_hand() {
return(pts[7]);
}
function trans(v) {
var _local2 = 0;
while (_local2 < pts.length) {
pts[_local2].x = pts[_local2].x + v.x;
pts[_local2].y = pts[_local2].y + v.y;
pts[_local2].px = pts[_local2].px + v.x;
pts[_local2].py = pts[_local2].py + v.y;
_local2++;
}
left_wire.trans(v);
right_wire.trans(v);
}
function addForce(v) {
var _local2 = 0;
while (_local2 < pts.length) {
pts[_local2].x = pts[_local2].x + v.x;
pts[_local2].y = pts[_local2].y + v.y;
_local2++;
}
}
function draw() {
var _local2 = pts[0].x - pts[1].x;
var _local3 = pts[0].y - pts[1].y;
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
_local2 = _local2 / _local4;
_local3 = _local3 / _local4;
mc.lineStyle(size, 0, 100);
mc.moveTo(pts[0].x, pts[0].y);
mc.lineTo(pts[1].x, pts[1].y);
mc.lineStyle(size * 2, 16711680, 100);
mc.moveTo(pts[0].x, pts[0].y);
mc.lineTo(pts[0].x + _local2, pts[0].y + _local3);
mc.lineStyle(size * 2, 16711680, 100);
mc.moveTo(pts[1].x, pts[1].y);
mc.lineTo(pts[2].x, pts[2].y);
mc.lineStyle(size, 255, 100);
mc.moveTo(pts[1].x, pts[1].y);
mc.lineTo(pts[3].x, pts[3].y);
mc.lineTo(pts[7].x, pts[7].y);
mc.moveTo(pts[1].x, pts[1].y);
mc.lineTo(pts[4].x, pts[4].y);
mc.lineTo(pts[8].x, pts[8].y);
mc.lineStyle(size, 255, 100);
mc.moveTo(pts[2].x, pts[2].y);
mc.lineTo(pts[5].x, pts[5].y);
mc.lineTo(pts[9].x, pts[9].y);
mc.moveTo(pts[2].x, pts[2].y);
mc.lineTo(pts[6].x, pts[6].y);
mc.lineTo(pts[10].x, pts[10].y);
left_wire.draw();
right_wire.draw();
}
function update() {
adjust();
left_wire.update();
right_wire.update();
var _local7 = false;
if (on_the_ground > 0) {
_local7 = true;
on_the_ground--;
}
var _local2 = 10 * size;
var _local8 = 20;
pts[7].x = pts[7].x + (pts[7].vx * 0.1);
pts[8].y = pts[8].y + (pts[8].vy * 0.1);
if (_local7) {
var _local9 = -0.8;
if (walk_state < _local8) {
pts[6].y = pts[6].y + (0.02 * _local2);
pts[10].y = pts[10].y + (0.05 * _local2);
pts[5].y = pts[5].y - (0.015 * _local2);
pts[9].y = pts[9].y - (0.01 * _local2);
pts[5].x = pts[5].x - ((0.02 * _local2) * _local9);
pts[1].y = pts[1].y - (0.02 * _local2);
pts[2].y = pts[2].y + (0.02 * _local2);
} else if (walk_state < (_local8 * 2)) {
pts[5].y = pts[5].y + (0.02 * _local2);
pts[9].y = pts[9].y + (0.05 * _local2);
pts[6].y = pts[6].y - (0.015 * _local2);
pts[10].y = pts[10].y - (0.01 * _local2);
pts[6].x = pts[6].x - ((0.02 * _local2) * _local9);
pts[1].y = pts[1].y - (0.02 * _local2);
pts[2].y = pts[2].y + (0.02 * _local2);
} else {
walk_state = 0;
}
walk_state++;
}
if (_local7) {
pts[0].y = pts[0].y - (0.01 * _local2);
pts[1].y = pts[1].y - (0.001 * _local2);
pts[5].x = pts[5].x - (0.001 * _local2);
pts[6].x = pts[6].x + (0.001 * _local2);
pts[9].y = pts[9].y + (0.02 * _local2);
pts[10].y = pts[10].y + (0.02 * _local2);
pts[3].y = pts[3].y + (0.001 * _local2);
pts[4].y = pts[4].y + (0.001 * _local2);
pts[3].x = pts[3].x - (0.0001 * _local2);
pts[4].x = pts[4].x + (0.0001 * _local2);
pts[7].y = pts[7].y - (0.001 * _local2);
pts[8].y = pts[8].y - (0.001 * _local2);
var _local4 = pts[6].x - pts[5].x;
var _local5 = pts[6].y - pts[5].y;
var _local6 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
_local4 = _local4 / _local6;
_local5 = _local5 / _local6;
pts[6].y = pts[6].y + ((_local5 * 0.001) * _local2);
pts[6].x = pts[6].x + ((_local4 * 0.001) * _local2);
pts[5].y = pts[5].y - ((_local5 * 0.001) * _local2);
pts[5].x = pts[5].x - ((_local4 * 0.001) * _local2);
pts[9].y = pts[9].y - ((_local5 * 0.001) * _local2);
pts[9].x = pts[9].x - ((_local4 * 0.001) * _local2);
pts[10].y = pts[10].y + ((_local5 * 0.001) * _local2);
pts[10].x = pts[10].x + ((_local4 * 0.001) * _local2);
} else {
var _local3 = 0;
while (_local3 < pts.length) {
pts[_local3].y = pts[_local3].y + (0.01 * _local2);
_local3++;
}
pts[0].y = pts[0].y - (0.01 * _local2);
pts[1].y = pts[1].y - (0.001 * _local2);
var _local4 = pts[6].x - pts[5].x;
var _local5 = pts[6].y - pts[5].y;
var _local6 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
_local4 = _local4 / _local6;
_local5 = _local5 / _local6;
pts[6].y = pts[6].y - ((_local5 * 0.001) * _local2);
pts[6].x = pts[6].x - ((_local4 * 0.001) * _local2);
pts[5].y = pts[5].y + ((_local5 * 0.001) * _local2);
pts[5].x = pts[5].x + ((_local4 * 0.001) * _local2);
pts[9].y = pts[9].y + ((_local5 * 0.001) * _local2);
pts[9].x = pts[9].x + ((_local4 * 0.001) * _local2);
pts[10].y = pts[10].y - ((_local5 * 0.001) * _local2);
pts[10].x = pts[10].x - ((_local4 * 0.001) * _local2);
}
var _local4 = ((pts[2].x - pts[5].x) + pts[2].x) - pts[6].x;
var _local5 = ((pts[2].y - pts[5].y) + pts[2].y) - pts[6].y;
var _local6 = Math.sqrt((_local4 * _local4) + (_local5 * _local5));
_local4 = _local4 / _local6;
_local5 = _local5 / _local6;
pts[1].y = pts[1].y + ((_local5 * 0.005) * _local2);
pts[1].x = pts[1].x + ((_local4 * 0.005) * _local2);
var _local3 = 0;
while (_local3 < pts.length) {
pts[_local3].update(0.995);
_local3++;
}
adjust();
}
function fire() {
if (use_left) {
left_wire.fire();
} else {
right_wire.fire();
}
use_left = !use_left;
}
function adjust() {
var _local2 = 0;
while (_local2 < pts.length) {
pts[_local2].adjustLinks();
_local2++;
}
}
function hitTest(field) {
left_wire.hitTest(field);
right_wire.hitTest(field);
var _local2 = 0;
while (_local2 < pts.length) {
var _local5 = 0;
if (field.hitTest(pts[_local2].x, pts[_local2].y, true)) {
on_the_ground = 10;
pts[_local2].x = pts[_local2].x - pts[_local2].vx;
pts[_local2].y = pts[_local2].y - pts[_local2].vy;
do {
if (!field.hitTest(pts[_local2].x, pts[_local2].y, true)) {
break;
}
var _local3 = pts[_local2].vx * 0.1;
var _local4 = pts[_local2].vy * 0.1;
if (_local5 > 5) {
_local3 = _local3 - ((pts[2].x - pts[_local2].x) * 0.1);
_local4 = _local4 - ((pts[2].y - pts[_local2].y) * 0.1);
}
pts[_local2].x = pts[_local2].x - _local3;
pts[_local2].y = pts[_local2].y - _local4;
pts[_local2].px = pts[_local2].px - _local3;
pts[_local2].py = pts[_local2].py - _local4;
_local5++;
} while (_local5 <= 10);
}
_local2++;
}
}
}
Symbol 45 MovieClip [__Packages.Vec] Frame 0
class Vec
{
var x, y, px, py, vx, vy, links, distances;
function Vec (xx, yy) {
x = xx;
y = yy;
px = xx;
py = yy;
vx = 0;
vy = 0;
links = [];
distances = [];
}
function addLink(other) {
if (Math.random() < 0.5) {
links.push(other);
distances.push(distance(other));
} else {
links.unshift(other);
distances.unshift(distance(other));
}
}
function clearLinks() {
links = [];
distances = [];
}
function update(o) {
vx = x - px;
vy = y - py;
px = x;
py = y;
vx = vx * o;
vy = vy * o;
x = x + vx;
y = y + vy;
}
function distance(other) {
var _local2 = x - other.x;
var _local3 = y - other.y;
return(Math.sqrt((_local2 * _local2) + (_local3 * _local3)));
}
function adjustUnit(other, distance) {
var _local3 = other.x - x;
var _local2 = other.y - y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
var _local6 = distance - _local5;
if (_local5 == 0) {
return(undefined);
}
_local3 = (_local3 / _local5) * (_local6 * 0.5);
_local2 = (_local2 / _local5) * (_local6 * 0.5);
x = x - _local3;
y = y - _local2;
other.x = other.x + _local3;
other.y = other.y + _local2;
}
function adjustUnitRate(other, distance, alpha) {
var _local3 = other.x - x;
var _local2 = other.y - y;
var _local5 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
var _local6 = distance - _local5;
if (_local5 == 0) {
return(undefined);
}
_local3 = _local3 / _local5;
_local2 = _local2 / _local5;
x = x - (_local3 * (_local6 * alpha));
y = y - (_local2 * (_local6 * alpha));
other.x = other.x + (_local3 * (_local6 * (1 - alpha)));
other.y = other.y + (_local2 * (_local6 * (1 - alpha)));
}
function adjustLinks() {
var _local2 = 0;
while (_local2 < links.length) {
adjustUnit(links[_local2], distances[_local2]);
_local2++;
}
}
function adjustLinks2(scale) {
var _local2 = 0;
while (_local2 < links.length) {
adjustUnit(links[_local2], distances[_local2] * scale);
_local2++;
}
}
}
Symbol 46 MovieClip [__Packages.Wire] Frame 0
class Wire
{
var mc, pts, hand, size, xtarget, ytarget, hit, fired, maxsize;
function Wire (nmc, nhand) {
mc = nmc;
pts = [];
var _local2 = 0;
while (_local2 < 10) {
pts.push(new Vec(0, _local2));
_local2++;
}
_local2 = 0;
while (_local2 < (pts.length - 1)) {
pts[_local2].addLink(pts[_local2 + 1]);
_local2++;
}
hand = nhand;
size = 0.1;
xtarget = 0;
ytarget = 0;
hit = 0;
fired = 0;
maxsize = 0.1;
}
function handpos() {
return(pts[0]);
}
function top() {
return(pts[pts.length - 1]);
}
function fire() {
if (fired > 0) {
return(undefined);
}
var _local2 = _xmouse - pts[pts.length - 1].x;
var _local3 = _ymouse - pts[pts.length - 1].y;
var _local4 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
_local2 = _local2 / _local4;
_local3 = _local3 / _local4;
xtarget = _local2 * 18;
ytarget = _local3 * 18;
size = 1;
fired = 15;
hit = 0;
}
function update() {
if (size <= 0) {
size = 0.0001;
}
var _local2 = 0;
while (_local2 < pts.length) {
pts[_local2].update(0.9);
_local2++;
}
var _local5 = pts[pts.length - 1].x;
var _local4 = pts[pts.length - 1].y;
_local2 = 0;
while (_local2 < pts.length) {
pts[_local2].adjustLinks2(size);
_local2++;
}
pts[pts.length - 1].x = _local5;
pts[pts.length - 1].y = _local4;
var _local3 = true;
if (fired > 0) {
fired--;
if (hit > 0) {
pts[pts.length - 1].x = xtarget;
pts[pts.length - 1].y = ytarget;
size = maxsize * 0.5;
hit--;
if (hit == 0) {
fired = 0;
}
hand.adjustUnit(pts[0], 0.1);
hand.x = pts[0].x;
hand.y = pts[0].y;
_local3 = false;
} else {
size = size + 1;
if (size > 10) {
size = 10;
}
pts[pts.length - 1].x = pts[pts.length - 1].x + xtarget;
pts[pts.length - 1].y = pts[pts.length - 1].y + ytarget;
pts[pts.length - 1].px = pts[pts.length - 1].x;
pts[pts.length - 1].py = pts[pts.length - 1].y;
}
} else {
size = 0.01;
pts[pts.length - 1].x = (pts[pts.length - 1].x * 0.95) + (pts[0].x * 0.05);
pts[pts.length - 1].y = (pts[pts.length - 1].y * 0.95) + (pts[0].y * 0.05);
}
if (_local3) {
pts[0].x = hand.x;
pts[0].y = hand.y;
}
hand.adjustUnitRate(handpos(), 0.1, 0.51);
}
function draw() {
mc.lineStyle(1, 16777215, 100);
mc.moveTo(hand.x, hand.y);
var _local2 = 0;
while (_local2 < pts.length) {
mc.lineTo(pts[_local2].x, pts[_local2].y);
_local2++;
}
}
function hitTest(field) {
if (((hit > 0) || (fired == 0)) || (fired > 14)) {
return(undefined);
}
var _local2 = pts.length - 1;
if (field.hitTest(pts[_local2].x, pts[_local2].y, true)) {
hit = 30;
fired = 999;
xtarget = pts[_local2].x;
ytarget = pts[_local2].y;
maxsize = size;
}
}
function trans(v) {
var _local2 = 0;
while (_local2 < pts.length) {
pts[_local2].x = pts[_local2].x + v.x;
pts[_local2].y = pts[_local2].y + v.y;
pts[_local2].px = pts[_local2].px + v.x;
pts[_local2].py = pts[_local2].py + v.y;
_local2++;
}
}
function addForce(v) {
var _local2 = 0;
while (_local2 < pts.length) {
pts[_local2].x = pts[_local2].x + v.x;
pts[_local2].y = pts[_local2].y + v.y;
_local2++;
}
}
}