Combined Code
movieClip 6 Solid {
#initclip
Object.registerClass('Solid', Solid);
#endinitclip
}
movieClip 8 Exit {
#initclip
Object.registerClass('Exit', Exit);
#endinitclip
}
movieClip 9 magenta {
#initclip
Object.registerClass('magenta', Fish);
#endinitclip
}
movieClip 11 cyan {
#initclip
Object.registerClass('cyan', Fish);
#endinitclip
}
movieClip 13 yellow {
#initclip
Object.registerClass('yellow', Fish);
#endinitclip
}
movieClip 15 star {
}
movieClip 17 seadust5 {
}
movieClip 19 seadust4 {
}
movieClip 21 seadust3 {
}
movieClip 23 seadust2 {
}
movieClip 25 seadust1 {
}
movieClip 28 red_radar {
}
movieClip 31 red {
#initclip
Object.registerClass('red', Fish);
#endinitclip
}
movieClip 33 radarmask {
}
movieClip 35 radarborder {
}
movieClip 36 radarbg {
}
movieClip 38 Radar {
#initclip
Object.registerClass('Radar', Radar);
#endinitclip
}
movieClip 41 purple_radar {
}
movieClip 45 {
}
movieClip 47 purple {
#initclip
Object.registerClass('purple', Fish);
#endinitclip
}
movieClip 49 pinball {
}
movieClip 52 orange_radar {
}
movieClip 54 orange {
#initclip
Object.registerClass('orange', Fish);
#endinitclip
}
movieClip 57 green_radar {
}
movieClip 60 {
}
movieClip 62 green {
#initclip
Object.registerClass('green', Fish);
#endinitclip
}
movieClip 64 eaten {
}
movieClip 66 escaped {
}
movieClip 70 repulsor {
#initclip
Object.registerClass('repulsor', Repulsor);
#endinitclip
}
movieClip 73 yellow_radar {
}
movieClip 76 cyan_radar {
}
movieClip 79 magenta_radar {
}
movieClip 81 end_fade {
#initclip
Object.registerClass('end_fade', GameOver);
#endinitclip
}
movieClip 83 game {
#initclip
Object.registerClass('game', Game);
#endinitclip
}
movieClip 84 menu_fade {
#initclip
Object.registerClass('menu_fade', TitleScreen);
#endinitclip
}
// unknown tag 88 length 172
movieClip 87 loading {
#initclip
Object.registerClass('loading', Preloader);
#endinitclip
}
frame 1 {
stop();
}
movieClip 90 __Packages.Exit {
#initclip
if (!_global.Exit) {
var v1 = function () {
super();
};
_global.Exit = v1;
_global.Exit extends MovieClip;
var v2 = v1.prototype;
ASSetPropFlags(_global.Exit.prototype, null, 1);
}
#endinitclip
}
movieClip 91 __Packages.Fish {
#initclip
if (!_global.Fish) {
var v1 = function () {
super();
};
_global.Fish = v1;
_global.Fish extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
for (var v2 in this) {
if (this[v2] instanceof Solid || this[v2] instanceof Exit || this[v2] instanceof Repulsor) {
this[v2]._visible = false;
}
}
};
v2.ctr = 0;
ASSetPropFlags(_global.Fish.prototype, null, 1);
}
#endinitclip
}
movieClip 92 __Packages.Solid {
#initclip
if (!_global.Solid) {
var v1 = function () {
super();
};
_global.Solid = v1;
_global.Solid extends MovieClip;
var v2 = v1.prototype;
ASSetPropFlags(_global.Solid.prototype, null, 1);
}
#endinitclip
}
movieClip 93 __Packages.Repulsor {
#initclip
if (!_global.Repulsor) {
var v1 = function () {
super();
};
_global.Repulsor = v1;
_global.Repulsor extends MovieClip;
var v2 = v1.prototype;
ASSetPropFlags(_global.Repulsor.prototype, null, 1);
}
#endinitclip
}
movieClip 94 __Packages.Radar {
#initclip
if (!_global.Radar) {
var v1 = function () {
super();
};
_global.Radar = v1;
_global.Radar extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
this.mask = this.createEmptyMovieClip('rm', 99997);
this.mask._x = 0;
this.mask._y = 0;
this.mask.beginFill(8043312);
this.mask.moveTo(0, 0);
this.mask.lineTo(0, Radar.HEIGHT);
this.mask.lineTo(Radar.WIDTH, Radar.HEIGHT);
this.mask.lineTo(Radar.WIDTH, 0);
this.mask.endFill();
this.setMask(this.mask);
this.attachMovie('radarborder', 'radarborder', 10000, {'_x': 0, '_y': 0});
this.radarbg._visible = false;
};
v2.setBackground = function (hexcolor) {
if (this.background) {
this.background.removeMovieClip();
}
this.background = this.createEmptyMovieClip('rbg', 7000);
this.background._x = 0;
this.background._y = 0;
this.background.beginFill(hexcolor);
this.background.moveTo(0, 0);
this.background.lineTo(0, Radar.HEIGHT);
this.background.lineTo(Radar.WIDTH, Radar.HEIGHT);
this.background.lineTo(Radar.WIDTH, 0);
this.background.endFill();
};
v1.WIDTH = 225;
v1.HEIGHT = 175;
v2.background = null;
ASSetPropFlags(_global.Radar.prototype, null, 1);
}
#endinitclip
}
movieClip 95 __Packages.GameOver {
#initclip
if (!_global.GameOver) {
var v1 = function () {
super();
};
_global.GameOver = v1;
_global.GameOver extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
Key.addListener(this);
this.endmusic = new Sound(this);
this.endmusic.attachSound('freedom.mp3');
this.endmusic.setVolume(100);
this.endmusic.start(0, 99999);
};
v2.onEnterFrame = function () {
++this.frames;
if (this.frames < this.FADEFRAMES) {
}
var v2 = 100;
if (this.frames < this.FADEFRAMES) {
v2 = this.frames * this.ALPHAMULT;
}
if (this.frames > this.FADEFRAMES) {
if (this.starting > 0) {
this.endmusic.setVolume(this.starting * this.ALPHAOUTMULT);
--this.starting;
v2 = this.starting * this.ALPHAOUTMULT;
if (!this.starting) {
this.reallyStart();
}
}
}
this._alpha = 100 - v2;
};
v2.triggerStart = function () {
if (this.frames > 32) {
this.starting = this.FADEOUTFRAMES;
}
};
v2.onKeyDown = function () {
var v2 = Key.getCode();
switch (v2) {
if (v2 !== 38) {
} else {
case 32:
this.triggerStart();
}
}
};
v2.reallyStart = function () {
Key.removeListener(this);
trace('reallystartover!');
this.endmusic.stop();
this.swapDepths(0);
this.removeMovieClip();
_root.gotoAndStop('menu');
};
v2.frames = 0;
v2.starting = -1;
v2.FADEFRAMES = 10;
v2.ALPHAMULT = 10;
v2.FADEOUTFRAMES = 20;
v2.ALPHAOUTMULT = 5;
ASSetPropFlags(_global.GameOver.prototype, null, 1);
}
#endinitclip
}
movieClip 96 __Packages.Game {
#initclip
if (!_global.Game) {
var v1 = function () {
super();
};
_global.Game = v1;
_global.Game extends MovieClip;
var v2 = v1.prototype;
v2.onKeyDown = function () {
var v2 = Key.getCode();
this.advance = true;
switch (v2) {
break;
case 's':
case 27:
case 'r':
this.holdingEsc = true;
break;
case 38:
case 32:
this.jumpframes = 0;
this.holdingUp = true;
break;
case 37:
this.holdingLeft = true;
break;
case 39:
this.holdingRight = true;
break;
case 40:
this.holdingDown = true;
}
};
v2.onKeyUp = function () {
var v2 = Key.getCode();
switch (v2) {
case 27:
this.holdingEsc = false;
break;
case 32:
case 38:
this.holdingUp = false;
break;
case 37:
this.holdingLeft = false;
break;
case 39:
this.holdingRight = false;
break;
case 40:
this.holdingDown = false;
}
};
v2.setBackground = function (hexcolor) {
if (this.background_mc) {
this.background_mc.removeMovieClip();
}
this.background_mc = _root.createEmptyMovieClip('bg', 1000);
this.background_mc._x = 0;
this.background_mc._y = 0;
this.background_mc.beginFill(hexcolor);
this.background_mc.moveTo(0, 0);
this.background_mc.lineTo(0, this.SCREENH);
this.background_mc.lineTo(this.SCREENW, this.SCREENH);
this.background_mc.lineTo(this.SCREENW, 0);
this.background_mc.endFill();
};
v2.getFishPieces = function (f) {
this.borders = [];
this.exits = [];
this.repulsors = [];
for (var v13 in f) {
if (f[v13] instanceof Solid) {
var v3 = f[v13];
var v12 = v3._xscale;
var v9 = (v3._rotation / 360) * 2 * Math.PI;
var v7 = v3._x;
var v5 = v3._y;
var v6 = v7 + Math.cos(v9) * v12;
var v4 = v5 + Math.sin(v9) * v12;
this.borders.push({'x0': v7, 'y0': v5, 'x1': v6, 'y1': v4, 'w': v12, 'rrad': v9});
} else {
if (f[v13] instanceof Exit) {
var v3 = f[v13];
this.exits.push({'x0': v3._x, 'y0': v3._y, 'x1': v3._x + v3._xscale, 'y1': v3._y + v3._yscale});
} else {
if (f[v13] instanceof Repulsor) {
var v3 = f[v13];
this.repulsors.push({'x': v3._x, 'y': v3._y, 'mc': v3, 'r': v3._width / 92});
}
}
}
}
};
v2.setFish = function (name) {
++this.ctr;
this.fish_mc = _root.attachMovie(name, 'fish' + this.ctr, 4000, {'_x': -10000, '_y': -10000});
this.fish_mc.gotoAndStop(1);
this.fish_mc_radar = this.radar_mc.attachMovie(name + '_radar', 'myfish', 8100, {'_x': -10000, '_y': -10000});
this.fish_mc_radar.gotoAndStop(1);
this.fishr = Math.random() * Math.PI - 1.570796326794897;
this.fishdr = 0;
this.targetscale = this.all_fishes[name].s;
this.fishdx = Math.random() * this.MAX_FISH_VELOCITY * 0.2 - this.MAX_FISH_VELOCITY / 0.4;
this.fishdy = Math.random() * this.MAX_FISH_VELOCITY * 0.2 - this.MAX_FISH_VELOCITY / 0.4;
this.fishboredom = 1000;
this.borders = null;
this.exits = null;
};
v2.initializeOthers = function () {
var v3 = 0;
while (v3 < this.other_fish.length) {
this.other_fish[v3].mc_big.removeMovieClip();
this.other_fish[v3].mc_radar.removeMovieClip();
++v3;
}
this.other_fish = [];
v3 = 0;
while (v3 < this.NUM_OTHER) {
var v4 = this.fishnames[int(Math.random() * 9999) % this.fishnames.length];
var v16 = Math.random() * this.WORLD_WIDTH - this.WORLD_WIDTH / 3;
var v15 = Math.random() * this.WORLD_HEIGHT - this.WORLD_HEIGHT / 3;
var v14 = Math.random() * this.WORLD_WIDTH - this.WORLD_WIDTH / 6;
var v13 = Math.random() * this.WORLD_HEIGHT - this.WORLD_HEIGHT / 6;
var v11 = _root.attachMovie(v4, 'other' + v3, 3900 + v3, {'_x': -10000, '_y': -10000});
v11.gotoAndStop(1);
var v17 = this.radar_mc.attachMovie(v4 + '_radar', 'otherr' + v3, 8000 + v3, {'_x': -10000, '_y': -10000});
v17.gotoAndStop(1);
var v5 = Math.random() * 2 * Math.PI - Math.PI;
var v12 = 0;
this.other_fish.push({'who': v4, 'x': v16, 'y': v15, 'mc_big': v11, 'mc_radar': v17, 'r': v5, 'dr': v12, 'dx': 0, 'dy': 0, 'hungry': false, 'destx': v14, 'desty': v13});
++v3;
}
};
v2.setDustDepth = function (m, n) {
if (n < this.MIN_DUST_DEPTH) {
return undefined;
}
var v3 = _root.getInstanceAtDepth(n);
if (v3 == n) {
return undefined;
}
if (v3 != undefined) {
this.setDustDepth(v3, n - 1);
}
m.swapDepths(n);
};
v2.initializeDust = function () {
var v3 = 0;
while (v3 < this.all_seadust.length) {
this.all_seadust[v3].mc.removeMovieClip();
++v3;
}
this.all_seadust = [];
this.dustalphaframes = 0;
v3 = 0;
while (v3 < this.NUM_SEADUST) {
var v9 = Math.random();
var v8 = this.FRUSTUM * v9;
var v13 = Math.random() * this.DUSTW - this.DUSTW / 2;
var v12 = Math.random() * this.DUSTH - this.DUSTH / 2;
var v7 = 0;
var v5 = 0;
var v6 = this.small_seadust[int(Math.random() * 9999) % this.small_seadust.length];
var v4 = _root.attachMovie(v6, 'seadust' + v3, this.MAX_DUST_DEPTH + 1, {'_x': -10000, '_y': -10000});
this.setDustDepth(v4, this.MIN_DUST_DEPTH + v9 * (this.MAX_DUST_DEPTH - this.MIN_DUST_DEPTH));
v4._rotation = Math.random() * 360;
v4._alpha = 0;
this.all_seadust.push({'who': v6, 'mc': v4, 'x': v13, 'y': v12, 'dx': v7, 'dy': v5, 'depth': v9});
++v3;
}
};
v2.fishToScreen = function (mc, x, y, scale) {
mc._x = this.XOFFSET + x * (this.fishscale / 100);
mc._y = this.YOFFSET + y * (this.fishscale / 100);
mc._xscale = scale * (this.fishscale / 100);
mc._yscale = scale * (this.fishscale / 100);
};
v2.seadustToScreen = function (d) {
var v3 = this.FRUSTUM * d.depth;
var v6 = d.x / v3;
var v5 = d.y / v3;
d.mc._x = this.SCREENW / 2 + v6 * (this.fishscale / 100);
d.mc._y = this.SCREENH / 2 + v5 * (this.fishscale / 100);
var v4 = 200 * (1 - d.depth);
d.mc._xscale = v4 * (this.fishscale / 100);
d.mc._yscale = v4 * (this.fishscale / 100);
};
v2.ballToScreen = function (mc, x, y, rrad) {
var v3 = Math.sin(rrad);
var v4 = Math.cos(rrad);
mc._x = this.XOFFSET + (x * v4 - y * v3) * (this.fishscale / 100);
mc._y = this.YOFFSET + (x * v3 + y * v4) * (this.fishscale / 100);
mc._xscale = this.fishscale;
mc._yscale = this.fishscale;
};
v2.fishToRadar = function (mc, x, y) {
mc._x = this.RADAR_XOFFSET + x / this.RADAR_SCALE;
mc._y = this.RADAR_YOFFSET + y / this.RADAR_SCALE;
mc._xscale = 100 / this.RADAR_FISH_SCALE;
mc._yscale = 100 / this.RADAR_FISH_SCALE;
};
v2.onLoad = function () {
Key.addListener(this);
for (var v3 in this.all_fishes) {
this.fishnames.push(v3);
}
this.gamemusic = new Sound(this);
this.gamemusic.attachSound('blenny.mp3');
this.gamemusic.setVolume(100);
this.gamemusic.start(0, 99999);
this.ballx = 0;
this.bally = 0;
this.balldx = 0;
this.balldy = 0;
this.ball_mc = _root.attachMovie('pinball', 'pinball', 5000, {'_x': 0, '_y': 0});
this.radar_mc = _root.attachMovie('radar', 'radar', 6000, {'_x': this.SCREENW - Radar.WIDTH, '_y': 0});
this.escaped_mc = _root.attachMovie('escaped', 'escaped', 7000, {'_x': 0, '_y': 0});
this.escaped_mc._visible = false;
this.eaten_mc = _root.attachMovie('eaten', 'eaten', 7001, {'_x': 0, '_y': 0});
this.eaten_mc._visible = false;
this.setFish('purple');
this.initializeOthers();
this.initializeDust();
this.updateFishTower();
this.mode = this.PLAYING;
};
v2.rotateVec = function (dx, dy, rrad) {
var v1 = Math.sin(rrad);
var v2 = Math.cos(rrad);
return {'dx': dx * v2 - dy * v1, 'dy': dx * v1 + dy * v2};
};
v2.distance = function (v1x, v1y, v2x, v2y) {
var v2 = v2x - v1x;
var v1 = v2y - v1y;
var v3 = v2 * v2 + v1 * v1;
return Math.sqrt(v3);
};
v2.closestPoint = function (px, py, v1x, v1y, v2x, v2y) {
var v3 = v2x - v1x;
var v2 = v2y - v1y;
var v9 = v3 * v3 + v2 * v2;
var v4 = ((px - v1x) * v3 + (py - v1y) * v2) / v9;
if (v4 < 0 || v4 > 1) {
var v13 = this.distance(px, py, v1x, v1y);
var v12 = this.distance(px, py, v2x, v2y);
return v13 < v12 ? {'x': v1x, 'y': v1y} : {'x': v2x, 'y': v2y};
} else {
return {'x': v1x + v4 * v3, 'y': v1y + v4 * v2};
}
};
v2.getCollisionsAt = function (x, y, r) {
var v8 = [];
var v2 = 0;
while (v2 < this.borders.length) {
var v3 = this.borders[v2];
var v4 = this.closestPoint(x, y, v3.x0, v3.y0, v3.x1, v3.y1);
var v7 = this.distance(x, y, v4.x, v4.y);
if (v7 < r) {
v8.push({'b': v3, 'n': v4, 'dist': v7});
}
++v2;
}
return v8;
};
v2.moveStaySafe = function (startx, starty, dx, dy) {
if ((this.getCollisionsAt(startx, starty, this.RADIUS)).length > 0) {
return undefined;
}
var v5 = startx + dx;
var v4 = starty + dy;
var v8 = this.getCollisionsAt(v5, v4, this.RADIUS);
if (v8.length > 0) {
while (this.distance(startx, starty, v5, v4) > 0.05) {
var v3 = (startx + v5) * 0.5;
var v2 = (starty + v4) * 0.5;
v8 = this.getCollisionsAt(v3, v2, this.RADIUS);
if (v8.length > 0) {
v5 = v3;
v4 = v2;
} else {
startx = v3;
starty = v2;
}
}
this.ballx = startx;
this.bally = starty;
return v8;
} else {
this.ballx = v5;
this.bally = v4;
return [];
}
};
v2.resolveForce = function (startx, starty, dx, dy) {
var v8 = this.moveStaySafe(startx, starty, dx, dy);
if (v8.length > 0) {
var v10 = 0;
var v9 = 0;
var v2 = 0;
while (v2 < v8.length) {
var v3 = v8[v2].b;
var v4 = this.rotateVec(dx, dy, -v3.rrad);
var v6 = v4.dx;
var v7 = -this.ELASTICITY * v4.dy;
var v5 = this.rotateVec(v6, v7, v3.rrad);
v10 += v5.dx;
v9 += v5.dy;
++v2;
}
this.balldx = v10 / v8.length;
this.balldy = v9 / v8.length;
}
};
v2.updateFishTower = function () {
var v3 = 0;
while (v3 < this.fish_tower.length) {
this.fish_tower[v3].removeMovieClip();
++v3;
}
this.fish_tower = [];
var v7 = 20;
v3 = 0;
for (;;) {
if (!(v3 < this.inside_fishes.length && v3 < 25)) break;
var v5 = this.inside_fishes[v3];
var v6 = this.all_fishes[v5].offset;
var v4 = _root.attachMovie(v5 + '_radar', 'ft' + v3, 5500 + v3, {'_x': v7 + v6, '_y': 20});
v4.gotoAndStop(1);
v4._xscale = 25;
v4._yscale = 25;
v7 += v4._width + 5;
this.fish_tower.push(v4);
++v3;
}
};
v2.maybeSetBackground = function () {
var v2 = 1385307;
if (this.inside_fishes.length > 0) {
v2 = this.all_fishes[this.inside_fishes[0]].bg;
}
if (this.current_background != v2) {
this.current_background = v2;
this.radar_mc.setBackground(v2);
this.setBackground(v2);
}
};
v2.onEnterFrame = function () {
if (this.borders == null) {
this.getFishPieces(this.fish_mc);
}
this.maybeSetBackground();
if (this.mode == this.PLAYING) {
var v29 = this.MAX_FISH_VELOCITY;
if (this.inside_fishes.length < 5) {
v29 += 5 * (5 - this.inside_fishes.length);
}
var v45 = this.XGRAVITY;
var v46 = this.YGRAVITY;
if (this.holdingLeft) {
v45 -= 3;
} else {
if (this.holdingRight) {
v45 += 3;
}
}
var v7 = 0;
while (v7 < this.repulsors) {
var v11 = this.repulsors[v7];
v11.mc._visible = true;
var v10 = this.ballx - v11.x;
var v9 = this.bally - v11.y;
var v8 = Math.sqrt(v10 * v10 + v9 * v9);
if (v8 < 120) {
var v23 = 1 / (v8 / 120);
this.balldx += v23 * v10;
this.balldy += v23 * v9;
}
++v7;
}
var v31 = this.rotateVec(v45, v46, -this.fishr);
var v18 = this.getCollisionsAt(this.ballx, this.bally, this.BOUNCE_RADIUS);
if (v18.length > 0) {
var v41 = 0;
var v40 = 0;
var v39 = 0;
var v43 = 0;
var v42 = 0;
v7 = 0;
while (v7 < v18.length) {
var v19 = v18[v7].b;
var v20 = this.rotateVec(v31.dx, v31.dy, -v19.rrad);
if (v20.dy > 0) {
var v37 = 0;
var v30 = v20.dx;
var v27 = this.rotateVec(v30, v37, v19.rrad);
++v39;
v41 += v27.dx;
v40 += v27.dy;
}
var v22 = this.ballx - v18[v7].n.x;
var v21 = this.bally - v18[v7].n.y;
var v12 = Math.sqrt(v22 * v22 + v21 * v21);
if (v12 > 0) {
v22 /= v12;
v21 /= v12;
} else {
v21 -= 1;
}
v43 += v22;
v42 += v21;
++v7;
}
if (v39 > 0) {
this.balldx += v41 / v39;
this.balldy += v40 / v39;
} else {
this.balldx += v31.dx;
this.balldy += v31.dy;
}
if (this.holdingUp) {
this.jumpx = v22;
this.jumpy = v21;
this.jumpframes = 3;
} else {
this.balldx *= this.FRICTION;
this.balldy *= this.FRICTION;
}
} else {
this.balldx += v31.dx;
this.balldy += v31.dy;
}
if (this.jumpframes > 0) {
if (this.holdingUp) {
this.balldx += 20 * this.jumpx;
this.balldy += 20 * this.jumpy;
}
--this.jumpframes;
}
var v14 = Math.sqrt(this.balldx * this.balldx + this.balldy * this.balldy);
if (v14 > this.RADIUS * 1.2) {
this.balldx /= v14;
this.balldy /= v14;
this.balldx *= this.RADIUS * 1.2;
this.balldy *= this.RADIUS * 1.2;
} else {
if (v14 < 1 && v18.length > 0) {
this.balldx = 0;
this.balldy = 0;
} else {}
}
this.resolveForce(this.ballx, this.bally, this.balldx, this.balldy);
v7 = 0;
while (v7 < this.exits.length) {
var v5 = this.exits[v7];
if (this.ballx > v5.x0 && this.ballx < v5.x1 && this.bally > v5.y0 && this.bally < v5.y1) {
this.old_fish_mc = this.fish_mc;
this.old_fish_mc.swapDepths(4010);
this.fish_mc = null;
var v24 = this.rotateVec(this.ballx, this.bally, this.fishr);
this.ballx = v24.dx;
this.bally = v24.dy;
this.old_fishx = 0;
this.old_fishy = 0;
this.swallower = -1;
this.eaten_mc._visible = false;
v7 = 0;
while (v7 < this.other_fish.length) {
this.other_fish[v7].mc_big._visible = false;
++v7;
}
if (this.inside_fishes.length > 0) {
var v35 = this.inside_fishes[0];
this.inside_fishes = this.inside_fishes.slice(1);
this.updateFishTower();
this.setFish(v35);
this.mode = this.REGURGITATE;
this.framesleft = this.REGURGITATE_FRAMES;
v7 = 0;
while (v7 < this.all_seadust.length) {
var v6 = this.all_seadust[v7];
v6.mc._visible = false;
++v7;
}
this.regurgitate();
return undefined;
} else {
this.mode = this.WINNING;
this.framesleft = this.WINNING_FRAMES;
this.winning();
}
}
++v7;
}
var v44 = this.distance(0, 0, this.fishdestx, this.fishdesty);
++this.fishboredom;
if (v44 < 100 || this.fishboredom > 600) {
this.fishdestx = Math.random() * 20000 - 10000;
this.fishdesty = Math.random() * 10000 - 5000;
this.fishboredom = 0;
v44 = this.distance(0, 0, this.fishdestx, this.fishdesty);
}
this.fishdx += (this.fishdestx / v44) * 2;
this.fishdy += (this.fishdesty / v44) * 2;
v14 = Math.sqrt(this.fishdx * this.fishdx + this.fishdy * this.fishdy);
if (v14 > this.MAX_FISH_VELOCITY) {
this.fishdx /= v14;
this.fishdy /= v14;
this.fishdx *= this.MAX_FISH_VELOCITY;
this.fishdy *= this.MAX_FISH_VELOCITY;
}
var v25 = this.getFishHeading(this.fishdx, this.fishdy, this.fishr, this.fishdr);
this.fishr = v25.r;
this.fishdr = v25.dr;
this.fishdestx -= this.fishdx;
this.fishdesty -= this.fishdy;
v7 = 0;
while (v7 < this.other_fish.length) {
this.other_fish[v7].close = [];
++v7;
}
v7 = 0;
while (v7 < this.other_fish.length) {
var v2 = v7 + 1;
while (v2 < this.other_fish.length) {
v8 = this.distance(this.other_fish[v7].x, this.other_fish[v7].y, this.other_fish[v2].x, this.other_fish[v2].y);
if (v8 < this.TOO_CLOSE_DIST) {
this.other_fish[v7].close.push(v2);
this.other_fish[v2].close.push(v7);
}
++v2;
}
++v7;
}
var v38 = 99999;
v7 = 0;
while (v7 < this.other_fish.length) {
var v3 = this.other_fish[v7];
v3.x -= this.fishdx;
v3.y -= this.fishdy;
v3.destx -= this.fishdx;
v3.desty -= this.fishdy;
var v16 = 10 - this.inside_fishes.length;
if (v16 < 3) {
v16 = 3;
}
var v4 = this.distance(v3.x, v3.y, 0, 0);
if (v3.close.length == 0 && (v7 < v16 || v4 < 3500)) {
v3.hungry = true;
} else {
if (v3.hungry && v4 > 10000) {
v3.hungry = false;
}
}
if (v4 < v38) {
v38 = v4;
}
if (v4 < this.SWALLOW_DISTANCE && this.swallower == -1) {
v3.mc_big.swapDepths(3950);
this.swallower = v7;
this.framesleft = this.SWALLOW_FRAMES;
}
if (this.swallower == v7) {
var v36 = Math.atan2(-v3.y, -v3.x);
v3.r = (v3.r + v36) * 0.5;
var v34 = this.framesleft / this.SWALLOW_FRAMES;
v3.x *= 0.8;
v3.y *= 0.8;
if (this.distance(0, 0, v3.x, v3.y) < 10) {
v3.mc_big.gotoAndStop(1);
v3.mc_big.gotoAndStop(2);
} else {
v3.mc_big.gotoAndStop(2);
v3.mc_radar.gotoAndStop(2);
}
if (this.framesleft > this.SWALLOW_FRAMES / 2) {
var v26 = v34 * 2 - 0.5;
this.eaten_mc._visible = true;
this.eaten_mc._x = this.SCREENW / 2;
this.eaten_mc._y = this.SCREENH - this.eaten_mc._height * (1 - v26);
this.eaten_mc._alpha = 100 * v26;
} else {
this.eaten_mc._visible = false;
}
--this.framesleft;
if (this.framesleft == 0) {
this.inside_fishes.splice(0, 0, v3.who);
this.updateFishTower();
this.maybeSetBackground();
this.initializeOthers();
this.initializeDust();
this.swallower = -1;
this.eaten_mc._visible = false;
return undefined;
}
} else {
if (v3.close.length > 0) {
var v33 = this.other_fish[v3.close[0]].x;
var v32 = this.other_fish[v3.close[0]].y;
var v15 = v33 - v3.x;
var v13 = v32 - v3.y;
var v28 = Math.sqrt(v15 * v15 + v13 * v13);
v3.destx = v3.x + (v15 / v28) * this.COMFORTABLE_DIST;
v3.desty = v3.y + (v13 / v28) * this.COMFORTABLE_DIST;
} else {
if (this.distance(v3.x, v3.y, v3.destx, v3.desty) < 400) {
v3.destx = Math.random() * this.WORLD_WIDTH - this.WORLD_WIDTH / 2;
v3.desty = Math.random() * this.WORLD_HEIGHT - this.WORLD_HEIGHT / 2;
}
}
if (v3.hungry) {
v3.mc_big.gotoAndStop(2);
v3.mc_radar.gotoAndStop(2);
} else {
v3.mc_big.gotoAndStop(1);
v3.mc_radar.gotoAndStop(1);
}
var v22 = v3.hungry ? -v3.x : v3.destx - v3.x;
var v21 = v3.hungry ? -v3.y : v3.desty - v3.y;
var v17 = this.distance(0, 0, v22, v21);
if (v17 > 0) {
v3.dx += (v22 / v17) * 2.2;
v3.dy += (v21 / v17) * 2.2;
}
v14 = Math.sqrt(v3.dx * v3.dx + v3.dy * v3.dy);
if (v14 > v29) {
v3.dx /= v14;
v3.dy /= v14;
v3.dx *= v29;
v3.dy *= v29;
}
v25 = this.getFishHeading(v3.dx, v3.dy, v3.r, v3.dr);
v3.dr = v25.dr;
v3.r = v25.r;
v3.x += v3.dx;
v3.y += v3.dy;
}
++v7;
}
this.updateSeadust(this.fishdx, this.fishdy);
if (this.swallower == -1 && this.fishscale > this.MIN_SCALE && v38 < 2000) {
this.fishscale = this.MIN_SCALE + (this.fishscale - this.MIN_SCALE) * 0.95;
} else {
if (this.fishscale < this.targetscale && (this.swallower != -1 || v38 >= 2000)) {
this.fishscale = this.targetscale - (this.targetscale - this.fishscale) * 0.95;
} else {
if (this.fishscale >= this.targetscale) {
this.fishscale = this.fishscale * 0.9 + this.targetscale * 0.1;
}
}
}
this.fish_mc._rotation = this.fishr * 180 / Math.PI;
this.fishToScreen(this.fish_mc, 0, 0, 100);
this.ballToScreen(this.ball_mc, this.ballx, this.bally, this.fishr);
this.fish_mc_radar._rotation = this.fishr * 180 / Math.PI;
this.fishToRadar(this.fish_mc_radar, 0, 0);
v7 = 0;
while (v7 < this.other_fish.length) {
v3 = this.other_fish[v7];
if (this.swallower != -1 && this.swallower != v7) {
var v34 = 1 - this.framesleft / this.SWALLOW_FRAMES;
}
v3.mc_big._alpha = v34 * 100;
v3.mc_big._rotation = v3.r * 180 / Math.PI;
v3.mc_radar._rotation = v3.r * 180 / Math.PI;
this.fishToScreen(v3.mc_big, v3.x, v3.y, 300);
this.fishToRadar(v3.mc_radar, v3.x, v3.y);
++v7;
}
} else {
if (this.mode == this.REGURGITATE) {
this.regurgitate();
} else {
if (this.mode == this.WINNING) {
this.winning();
}
}
}
};
v2.updateSeadust = function (fdx, fdy) {
var v5 = this.DUSTW / 2;
var v4 = this.DUSTH / 2;
if (this.dustalphaframes < this.DUSTALPHA_FRAMES) {
++this.dustalphaframes;
}
var v3 = 0;
while (v3 < this.all_seadust.length) {
var v2 = this.all_seadust[v3];
var v6 = this.FRUSTUM * v2.depth;
v2.x -= fdx;
v2.y -= fdy;
if (v2.x > v5) {
v2.x -= this.DUSTW;
} else {
if (v2.x < -v5) {
v2.x += this.DUSTW;
}
}
if (v2.y > v4) {
v2.y -= this.DUSTH;
} else {
if (v2.y < -v4) {
v2.y += this.DUSTH;
}
}
v2.mc._alpha = (this.dustalphaframes / this.DUSTALPHA_FRAMES) * (this.MAX_DUST_ALPHA - (this.MAX_DUST_ALPHA - this.MIN_DUST_ALPHA) * v2.depth);
this.seadustToScreen(v2);
++v3;
}
};
v2.winning = function () {
var v5 = this.framesleft / this.WINNING_FRAMES;
--this.framesleft;
if (this.framesleft >= 0) {
this.gamemusic.setVolume(v5 * 100);
var v9 = this.ballx * 0.8;
var v8 = this.bally * 0.8;
var v7 = v9 - this.ballx;
var v6 = v8 - this.bally;
this.ballx = v9;
this.bally = v8;
this.win_dy += 2;
if (this.win_dy > 30) {
this.win_dy = 30;
}
v6 += this.win_dy;
this.old_fishx += v7;
this.old_fishy -= v6;
var v11 = 100 + (300 / (this.fishscale / 100)) * v5;
var v10 = 100 - 75 * (1 - v5);
this.old_fish_mc._alpha = v5 * 100;
this.ballToScreen(this.ball_mc, this.ballx, this.bally, 0);
this.fishToScreen(this.old_fish_mc, this.old_fishx, this.old_fishy, v10);
this.updateSeadust(v7, v6);
var v3 = 0;
while (v3 < this.all_seadust.length) {
var v4 = this.all_seadust[v3];
this.seadustToScreen(v4);
++v3;
}
} else {
this.gamemusic.stop();
this.ball_mc.removeMovieClip();
this.old_fish_mc.removeMovieClip();
this.eaten_mc.removeMovieClip();
this.escaped_mc.removeMovieClip();
var v3 = 0;
while (v3 < this.all_seadust.length) {
this.all_seadust[v3].mc.removeMovieClip();
++v3;
}
this.background_mc.removeMovieClip();
this.radar_mc.removeMovieClip();
_root.gotoAndStop('gameover');
}
};
v2.regurgitate = function () {
var v2 = this.framesleft / this.REGURGITATE_FRAMES;
--this.framesleft;
if (this.framesleft >= 0) {
var v4 = this.ballx * 0.8;
var v3 = this.bally * 0.8;
var v6 = v4 - this.ballx;
var v5 = v3 - this.bally;
this.ballx = v4;
this.bally = v3;
this.old_fishx += v6;
this.old_fishy += v5;
var v7 = 100 + (300 / (this.fishscale / 100)) * v2;
var v8 = 100 - 75 * (1 - v2);
this.old_fish_mc._alpha = v2 * 100;
this.ballToScreen(this.ball_mc, this.ballx, this.bally, 0);
this.fishToScreen(this.old_fish_mc, this.old_fishx, this.old_fishy, v8);
this.fish_mc._rotation = this.fishr * 180 / Math.PI;
this.fishToScreen(this.fish_mc, 0, 0, v7);
this.eaten_mc._visible = false;
this.escaped_mc._visible = true;
this.escaped_mc._x = this.SCREENW / 2;
this.escaped_mc._y = this.SCREENH - this.escaped_mc._height * (1 - v2);
this.escaped_mc._alpha = 100 * v2;
} else {
this.ballx = 0;
this.bally = 0;
this.old_fish_mc.removeMovieClip();
this.old_fish_mc = null;
this.escaped_mc._visible = false;
this.fish_mc._alpha = 100;
this.mode = this.PLAYING;
this.initializeOthers();
this.initializeDust();
}
};
v2.getFishHeading = function (dx, dy, r, dr) {
var v3 = Math.atan2(dy, dx);
var v1 = v3 - r;
if (v1 < -Math.PI) {
v1 += Math.PI;
} else {
if (v1 > Math.PI) {
v1 -= Math.PI;
}
}
dr += v1 * 0.1;
var v2 = 0.05;
if (dr > v2) {
dr = v2;
} else {
if (dr < -v2) {
dr = -v2;
}
}
r += dr;
if (r > 6.283185307179586) {
r -= 6.283185307179586;
}
return {'r': r, 'dr': dr};
};
v2.SCREENW = 900;
v2.SCREENH = 700;
v2.inside_fishes = ['green', 'red', 'purple', 'green', 'red', 'orange', 'green', 'magenta', 'green', 'cyan', 'yellow', 'red', 'purple', 'yellow', 'orange', 'cyan', 'purple', 'magenta', 'yellow'];
v2.current_background = 0;
v2.framesleft = 0;
v2.SWALLOW_DISTANCE = 500;
v2.swallower = -1;
v2.SWALLOW_FRAMES = 24;
v2.eaten_mc = null;
v2.REGURGITATE_FRAMES = 24;
v2.escaped_mc = null;
v2.win_dy = 0;
v2.WINNING_FRAMES = 196;
v2.background_mc = null;
v2.small_seadust = ['seadust1', 'seadust2', 'seadust3', 'seadust4', 'seadust5'];
v2.NUM_SEADUST = 400;
v2.all_seadust = [];
v2.MAX_DUST_ALPHA = 50;
v2.MIN_DUST_ALPHA = 5;
v2.dustalphaframes = 0;
v2.DUSTALPHA_FRAMES = 40;
v2.fishdx = 0;
v2.fishdy = 0;
v2.fishdestx = 100;
v2.fishdesty = 20;
v2.fishboredom = 0;
v2.MAX_FISH_VELOCITY = 40;
v2.TOO_CLOSE_DIST = 1500;
v2.COMFORTABLE_DIST = 2000;
v2.fishscale = 100;
v2.MIN_SCALE = 30;
v2.targetscale = 100;
v2.other_fish = [];
v2.ball_mc = null;
v2.RADIUS = 25;
v2.ELASTICITY = 0.7;
v2.FRICTION = 0.7;
v2.borders = null;
v2.exits = null;
v2.repulsors = null;
v2.XGRAVITY = 0;
v2.YGRAVITY = 4;
v2.all_fishes = {'red': {'bg': 5774364, 'offset': 0, 's': 100}, 'purple': {'bg': 4330584, 'offset': 0, 's': 100}, 'magenta': {'bg': 4919889, 'offset': 0, 's': 80}, 'cyan': {'bg': 413521, 'offset': 0, 's': 90}, 'yellow': {'bg': 5984782, 'offset': 2, 's': 90}, 'orange': {'bg': 7948817, 'offset': 2, 's': 80}, 'green': {'bg': 600594, 'offset': 5, 's': 80}};
v2.fishnames = [];
v2.PLAYING = 0;
v2.REGURGITATE = 1;
v2.WINNING = 2;
v2.mode = Game.prototype.PLAYING;
v2.advance = true;
v2.holdingSpace = false;
v2.holdingEsc = false;
v2.holdingUp = false;
v2.holdingLeft = false;
v2.holdingRight = false;
v2.holdingDown = false;
v2.ctr = 0;
v2.NUM_OTHER = 10;
v2.WORLD_WIDTH = 70000;
v2.WORLD_HEIGHT = 60000;
v2.DUSTW = 2 * (100 / Game.prototype.MIN_SCALE) * Game.prototype.SCREENW * 1.1;
v2.DUSTH = 2 * (100 / Game.prototype.MIN_SCALE) * Game.prototype.SCREENH * 1.1;
v2.FRUSTUM = 2;
v2.MIN_DUST_DEPTH = 2000;
v2.MAX_DUST_DEPTH = 3000;
v2.XOFFSET = 320;
v2.YOFFSET = 420;
v2.RADAR_XOFFSET = Radar.WIDTH / 2;
v2.RADAR_YOFFSET = Radar.HEIGHT / 2;
v2.RADAR_SCALE = 45;
v2.RADAR_FISH_SCALE = 4;
v2.last_collisions = [];
v2.BOUNCE_RADIUS = Game.prototype.RADIUS * 1.05;
v2.fish_tower = [];
v2.jumpx = 0;
v2.jumpy = 0;
v2.jumpframes = 0;
ASSetPropFlags(_global.Game.prototype, null, 1);
}
#endinitclip
}
movieClip 97 __Packages.TitleScreen {
#initclip
if (!_global.TitleScreen) {
var v1 = function () {
super();
};
_global.TitleScreen = v1;
_global.TitleScreen extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
Key.addListener(this);
this.titlemusic = new Sound(this);
this.titlemusic.attachSound('title.mp3');
this.titlemusic.setVolume(100);
this.titlemusic.start(0, 99999);
};
v2.onEnterFrame = function () {
++this.frames;
if (this.frames < this.FADEFRAMES) {
}
var v2 = 100;
if (this.frames < this.FADEFRAMES) {
v2 = this.frames * this.ALPHAMULT;
}
if (this.frames > this.FADEFRAMES) {
if (this.starting > 0) {
this.titlemusic.setVolume(this.starting * this.ALPHAOUTMULT);
--this.starting;
v2 = this.starting * this.ALPHAOUTMULT;
if (!this.starting) {
this.reallyStart();
}
}
}
this._alpha = 100 - v2;
};
v2.triggerStart = function () {
this.starting = this.FADEOUTFRAMES;
};
v2.onKeyDown = function () {
var v2 = Key.getCode();
switch (v2) {
if (v2 !== 38) {
} else {
case 32:
this.triggerStart();
}
}
};
v2.reallyStart = function () {
Key.removeListener(this);
trace('reallystart!');
this.titlemusic.stop();
this.swapDepths(0);
this.removeMovieClip();
_root.gotoAndStop('game');
};
v2.frames = 0;
v2.starting = -1;
v2.FADEFRAMES = 10;
v2.ALPHAMULT = 10;
v2.FADEOUTFRAMES = 20;
v2.ALPHAOUTMULT = 5;
ASSetPropFlags(_global.TitleScreen.prototype, null, 1);
}
#endinitclip
}
movieClip 98 __Packages.Preloader {
#initclip
if (!_global.Preloader) {
var v1 = function () {
super();
};
_global.Preloader = v1;
_global.Preloader extends MovieClip;
var v2 = v1.prototype;
v2.onLoad = function () {
_root.stop();
};
v2.onEnterFrame = function () {
var v3 = Math.round(_root.getBytesTotal());
var v4 = Math.round(_root.getBytesLoaded());
var v5 = (v4 / v3) * 100;
++this.frames;
if (v4 < v3) {
} else {
fscommand('trapallkeys', 'true');
fscommand('showmenu', 'false');
Stage.showMenu = false;
_root.gotoAndStop('menu');
this.swapDepths(0);
this.removeMovieClip();
}
};
v2.frames = 0;
ASSetPropFlags(_global.Preloader.prototype, null, 1);
}
#endinitclip
}