Frame 1
System.security.allowDomain("*");
this.createEmptyMovieClip("rectangle_mc", Camera3D.getNextDepth());
rectangle_mc._x = 0;
rectangle_mc._y = 0;
var xmouse = _xmouse;
var ymouse = _ymouse;
var lastxmouse = _xmouse;
var lastymouse = _ymouse;
var mouseStayTimer = 0;
var frames = 0;
var lastFPSTime = 0;
_root.createTextField("txtFPS", 1000, 5, 5, 300, 100);
txtFPS.multiline = true;
txtFPS.wordWrap = true;
var txtFmt = new TextFormat();
txtFmt.color = 16777215 /* 0xFFFFFF */;
txtFPS.text = "Frame Time: \nFPS: ";
txtFPS.setTextFormat(txtFmt);
txtFPS._visible = false;
var dt = 0;
var prevTime;
var curTime;
var dMouseWheel = 0;
var displayPlayerTarget = false;
var displayTextField = false;
var cheatMode = false;
var lastPressed = 0;
_root.createEmptyMovieClip("background_mc", Camera3D.getNextDepth());
var bgColor = new XColor(16777215);
var curLevel = 0;
var nextLevel = 0;
var switchLevel = 0;
var switchingLevels = false;
var gameLevels = new Array();
var totalLevel = 0;
var camera = new Camera3D();
var sndLoader = new SndLoader();
sndLoader.initialize();
var newLevel;
newLevel = new GameLevel(totalLevel, 200);
newLevel.spawnBillboard("flowing_title", 0, 0);
newLevel.bgColor.curColor = 49151;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnBillboard("credits", 0, 0);
newLevel.spawnFood(15, 1, 15, 10);
newLevel.bgColor.curColor = 40679;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(15, 1, 15, 10);
newLevel.spawnFish(2, 3, 16, 0, 15, 30, 5, 8, 3, true);
newLevel.bgColor.curColor = 36312;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 1, 15, 10);
newLevel.spawnFish(1, 13, 16, 1, 15, 15, 5, 8, 3, true);
newLevel.bgColor.curColor = 31945;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 2, 15, 10);
newLevel.spawnJellyfish(3, 7, 16, 1, 15, 15, 5, 8, 3, true);
newLevel.bgColor.curColor = 28091;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 2, 15, 10);
newLevel.bgColor.curColor = 26285;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 2, 15, 10);
newLevel.spawnJellyfish(1, 20, 20, 4, 25, -150, 5, 8, 3, false);
newLevel.bgColor.curColor = 24990;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 3, 15, 10);
newLevel.bgColor.curColor = 23695;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 3, 15, 10);
newLevel.spawnFish(2, 21, 16, 3, 15, 15, 5, 8, 3, true);
newLevel.bgColor.curColor = 22400;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnManta(3, 4, 30, 20, 20, 5, 0);
newLevel.bgColor.curColor = 20847;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 4, 15, 10);
newLevel.bgColor.curColor = 150623 /* 0x024C5F */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnBoss(1, 10, 100, 30, 10, 5, 0);
newLevel.bgColor.curColor = 279891 /* 0x044553 */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 5, 15, 10);
newLevel.bgColor.curColor = 475207 /* 0x074047 */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 5, 15, 10);
newLevel.spawnFlockfish(3, 6, 16, 2, 15, 15, 5, 8, 3, true);
newLevel.bgColor.curColor = 670271 /* 0x0A3A3F */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 5, 15, 10);
newLevel.bgColor.curColor = 930871 /* 0x0E3437 */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnBoss(1, 10, 100, 30, 10, 5, 0);
newLevel.spawnManta(3, 4, 30, 20, 20, 5, 0);
newLevel.bgColor.curColor = 929327 /* 0x0E2E2F */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 5, 15, 10);
newLevel.bgColor.curColor = 730662 /* 0x0B2626 */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFlockfish(5, 6, 16, 1, 15, 15, 5, 8, 3, true);
newLevel.bgColor.curColor = 466460 /* 0x071E1C */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 5, 15, 10);
newLevel.bgColor.curColor = 333331 /* 0x051613 */;
gameLevels[totalLevel++] = newLevel;
newLevel = new GameLevel(totalLevel, 400);
newLevel.spawnFood(10, 5, 15, 10);
newLevel.spawnFish(1, 40, 12, 4, 15, 20, 5, 8, 3, false);
newLevel.bgColor.curColor = 200974 /* 0x03110E */;
gameLevels[totalLevel++] = newLevel;
gameLevels[0].spawnFood(1, 100, 35, 0);
var i = 1;
while (i < (totalLevel - 1)) {
gameLevels[i].spawnFood(1, 100, 35, 0);
gameLevels[i].spawnFood(1, 101, 35, 0);
i++;
}
gameLevels[totalLevel - 1].spawnFood(1, 101, 35, 0);
var currentObj = _root.createEmptyMovieClip("fish_player", Camera3D.getNextDepth());
currentObj._visible = false;
var player = new Snakefish(0, 0, 3, 20, 0, 15, 200, ((8 + random(3)) / 180) * Math.PI, false, currentObj, -1, gameLevels[curLevel].assetPrefix);
player.color.copy(gameLevels[curLevel].fgColor);
player.color.setBias(1);
camera.focalLength = 600;
camera.posX = (Stage.width / 2) - player.posX;
camera.posY = (Stage.height / 2) - player.posY;
camera.posZ = 0;
curTime = (prevTime = getTimer());
lastFPSTime = curTime;
lastPressed = curTime;
background_mc._x = 0;
background_mc._y = 0;
bgColor.baseColor = gameLevels[curLevel].bgColor.curColor;
bgColor.setBias(1);
_root.onMouseDown = function () {
player.pressed = true;
};
_root.onMouseUp = function () {
player.pressed = false;
};
Frame 3
function switchLevel(newLevel) {
if ((((newLevel < 0) || (newLevel > (gameLevels.length - 1))) || (newLevel == curLevel)) || (nextLevel != curLevel)) {
return(undefined);
}
nextLevel = newLevel;
camera.targetZ = gameLevels[nextLevel].zDepth;
player.color.targetColor = gameLevels[nextLevel].fgColor.curColor;
bgColor.targetColor = gameLevels[nextLevel].bgColor.curColor;
}
function transitionToLevel() {
switchingLevels = true;
if (nextLevel < curLevel) {
camera.posZ = camera.posZ + (((camera.targetZ - camera.posZ) * dt) * 6);
} else {
camera.posZ = camera.posZ + (((camera.targetZ - camera.posZ) * dt) * 2.5);
}
player.color.setBias(Math.abs(camera.targetZ - camera.posZ) / GameLevel.zLevelGap);
bgColor.setBias(Math.abs(camera.targetZ - camera.posZ) / GameLevel.zLevelGap);
if (Math.abs(camera.targetZ - camera.posZ) < 3) {
camera.posZ = camera.targetZ;
curLevel = nextLevel;
player.color.copy(gameLevels[curLevel].fgColor);
bgColor.baseColor = (bgColor.targetColor = gameLevels[curLevel].bgColor.curColor);
player.setBias(1);
bgColor.setBias(1);
player.assetPrefix = gameLevels[curLevel].assetPrefix;
switchingLevels = false;
}
player.posZ = camera.posZ;
}
function redrawBackground() {
background_mc.clear();
Camera3D.drawRectangle(background_mc, Stage.width, Stage.height, bgColor.curColor, 100);
}
clear();
redrawBackground();
prevTime = curTime;
curTime = getTimer();
dt = (curTime - prevTime) / 1000;
frames++;
if (displayTextField) {
txtFPS._visible = true;
if ((curTime - lastFPSTime) > 1000) {
var FPS = ((frames / (curTime - lastFPSTime)) * 1000);
var FrameTime = (1000 / FPS);
FPS = FPS * 10;
FPS = Math.round(FPS);
FPS = FPS / 10;
FrameTime = FrameTime * 10;
FrameTime = Math.round(FrameTime);
FrameTime = FrameTime / 10;
frames = 0;
lastFPSTime = curTime;
txtFPS.text = ((("Frame Time:\t" + FrameTime) + " ms") + "\nFPS:\t\t\t") + FPS;
txtFPS.setTextFormat(txtFmt);
}
} else {
txtFPS._visible = false;
}
if ((lastxmouse == _xmouse) && (lastymouse == _ymouse)) {
mouseStayTimer = mouseStayTimer + dt;
if (mouseStayTimer > 3) {
xmouse = 400;
ymouse = 200;
}
} else {
lastxmouse = _xmouse;
lastymouse = _ymouse;
xmouse = _xmouse;
ymouse = _ymouse;
mouseStayTimer = 0;
}
if (curLevel != -1) {
if (_xmouse < (Stage.width * 0.5)) {
camera.posX = camera.posX + ((player.currentSpeed * dt) * (1 - (xmouse / (Stage.width * 0.5))));
} else if (xmouse > (Stage.width * 0.5)) {
camera.posX = camera.posX - ((player.currentSpeed * dt) * ((xmouse / (Stage.width * 0.5)) - 1));
}
if (_ymouse < (Stage.height * 0.5)) {
camera.posY = camera.posY + ((player.currentSpeed * dt) * (1 - (ymouse / (Stage.height * 0.5))));
} else if (ymouse > (Stage.height * 0.5)) {
camera.posY = camera.posY - ((player.currentSpeed * dt) * ((ymouse / (Stage.height * 0.5)) - 1));
}
}
if (Key.isDown(192)) {
cheatMode = true;
}
if (Key.isDown(39)) {
camera.zOffset = camera.zOffset - 20;
} else if (Key.isDown(37)) {
camera.zOffset = camera.zOffset + 20;
}
if (Key.isDown(40)) {
switchLevel(curLevel - 1);
} else if (Key.isDown(38)) {
switchLevel(curLevel + 1);
}
if (cheatMode) {
if (Key.isDown(84) && ((curTime - lastPressed) > 250)) {
displayPlayerTarget = !displayPlayerTarget;
GameLevel.debugLines = !GameLevel.debugLines;
displayTextField = !displayTextField;
lastPressed = curTime;
}
if (Key.isDown(83)) {
camera.shake(0);
}
if (Key.isDown(82)) {
player.regeneration();
}
if (Key.isDown(71)) {
player.grow();
}
if (Key.isDown(70)) {
gameLevels[curLevel].spawnFoodAtLocation(1, player.posX, player.posY, 15, 10);
}
if (Key.isDown(67)) {
if (player.dieing == false) {
player.die();
}
}
if (Key.isDown(66)) {
var b = gameLevels[curLevel].spawnBulletAtLocation(50, player.posX, player.posY, 25, 60, 5, 8, 3);
b.movementMode = 2;
}
}
player.color.curColor = gameLevels[curLevel].fgColor.curColor;
if (curLevel != nextLevel) {
transitionToLevel();
}
sndLoader.update();
camera.updateShake(dt);
player.mc._visible = true;
player.updateScreenPos(camera);
player.update(dt, camera, this, gameLevels[curLevel].fish, gameLevels[curLevel].food);
if ((displayPlayerTarget && (player.hasTarget)) && (curLevel == nextLevel)) {
background_mc.lineStyle(1, 16777215, 128);
background_mc.moveTo(player.screenX + camera.screenX, player.screenY + camera.screenY);
background_mc.lineTo((player.targetX * (player.mc._xscale / 100)) + camera.screenX, (player.targetY * (player.mc._yscale / 100)) + camera.screenY);
}
var i = 0;
while (i < gameLevels.length) {
if (i == curLevel) {
gameLevels[i].update(dt, camera, player);
} else {
gameLevels[i].update(dt, camera, null);
}
i++;
}
dMouseWheel = 0;
gotoAndPlay (2);
Symbol 12 MovieClip [c1_segbody1] Frame 1
stop();
Symbol 12 MovieClip [c1_segbody1] Frame 2
stop();
Symbol 19 MovieClip Frame 1
stop();
Symbol 24 MovieClip [c1_jellyhead1] Frame 1
stop();
Symbol 24 MovieClip [c1_jellyhead1] Frame 22
gotoAndPlay (20);
Symbol 24 MovieClip [c1_jellyhead1] Frame 29
gotoAndStop (1);
Symbol 32 MovieClip [c4_segbody1] Frame 1
stop();
Symbol 32 MovieClip [c4_segbody1] Frame 2
stop();
Symbol 32 MovieClip [c4_segbody1] Frame 3
stop();
Symbol 32 MovieClip [c4_segbody1] Frame 4
stop();
Symbol 32 MovieClip [c4_segbody1] Frame 5
stop();
Symbol 35 MovieClip [c3_segbody1] Frame 1
stop();
Symbol 35 MovieClip [c3_segbody1] Frame 2
stop();
Symbol 35 MovieClip [c3_segbody1] Frame 3
stop();
Symbol 35 MovieClip [c3_segbody1] Frame 4
stop();
Symbol 37 MovieClip [c2_segbody1] Frame 1
stop();
Symbol 37 MovieClip [c2_segbody1] Frame 2
stop();
Symbol 37 MovieClip [c2_segbody1] Frame 3
stop();
Symbol 146 MovieClip [c1_seghead1] Frame 1
stop();
Symbol 146 MovieClip [c1_seghead1] Frame 22
gotoAndPlay (20);
Symbol 146 MovieClip [c1_seghead1] Frame 29
gotoAndStop (1);
Symbol 170 MovieClip [__Packages.GameLevel] Frame 0
class GameLevel
{
var fish, fishLength, food, foodLength, effect, effectLength, billboard, billboardLength, level, levelSize, zDepth, isVisible, fgColor, bgColor, campaign, assetPrefix, bgMusic, bgMusicStarted, downMarker, upMarker, bgVolume, foodDown, foodUp;
function GameLevel (level, levelSize) {
fish = new Array();
fishLength = 0;
food = new Array();
foodLength = 0;
effect = new Array();
effectLength = 0;
billboard = new Array();
billboardLength = 0;
this.level = level;
this.levelSize = levelSize;
zDepth = level * zLevelGap;
isVisible = false;
fgColor = new XColor(16777215);
bgColor = new XColor(0);
campaign = 1;
if (campaign == 1) {
assetPrefix = "c1_";
} else if (campaign == 2) {
assetPrefix = "c2_";
} else if (campaign == 3) {
assetPrefix = "c3_";
} else if (campaign == 4) {
assetPrefix = "c4_";
}
bgMusic = _root.sndLoader.getSound(((assetPrefix + "Flow-lvl ") + level) + " drone");
trace(bgMusic.getBytesTotal());
bgMusicStarted = false;
downMarker = _root.createEmptyMovieClip(("level_" + level) + "_downMarker", Camera3D.getNextDepth());
downMarker.attachMovie("downMarker", "downMarker", 1);
downMarker._xscale = (downMarker._yscale = 100);
downMarker._visible = false;
upMarker = _root.createEmptyMovieClip(("level_" + level) + "_upMarker", Camera3D.getNextDepth());
upMarker.attachMovie("upMarker", "upMarker", 1);
upMarker._xscale = (upMarker._yscale = 100);
upMarker._visible = false;
}
function update(dt, camera, player) {
var _local7;
var _local6 = zDepth - camera.posZ;
if (Math.abs(_local6) < zLevelGap) {
if ((!bgMusicStarted) && (SndLoader.isLoaded(bgMusic))) {
bgMusicStarted = true;
bgMusic.start(0, 99);
trace("play" + level);
}
bgVolume = ((zLevelGap - Math.abs(_local6)) / zLevelGap) * 100;
bgMusic.setVolume(bgVolume);
} else if (Math.abs(_local6) < (2 * zLevelGap)) {
if (((!bgMusicStarted) && (bgMusic.getBytesTotal() > 0)) && (SndLoader.isLoaded(bgMusic))) {
bgMusicStarted = true;
bgMusic.start(0, 99);
trace("play" + level);
bgMusic.setVolume(0);
}
} else {
bgMusic.setVolume(0);
bgMusic.stop();
bgMusicStarted = false;
}
if ((_local6 < ((-zLevelGap) * 0.3)) || (_local6 > (zLevelGap * 1.3))) {
setVisible(false);
} else {
setVisible(true);
}
_local7 = isVisible;
if (_local7) {
var _local4 = 0;
while (_local4 < fish.length) {
fish[_local4].updateScreenPos(camera);
fish[_local4].update(dt, camera, player, fish, food);
if (((_local6 == 0) && (fish[_local4].hasTarget)) && (debugLines)) {
_root.background_mc.lineStyle(1, 16777215, 128);
_root.background_mc.moveTo(fish[_local4].screenX + camera.screenX, fish[_local4].screenY + camera.screenY);
_root.background_mc.lineTo((fish[_local4].targetX * (fish[_local4].mc._xscale / 100)) + camera.screenX, (fish[_local4].targetY * (fish[_local4].mc._yscale / 100)) + camera.screenY);
}
if (fish[_local4].alive == false) {
fish[_local4] = null;
}
_local4++;
}
_local4 = 0;
while (_local4 < food.length) {
food[_local4].updateScreenPos(camera);
food[_local4].update(dt, camera);
_local4++;
}
_local4 = 0;
while (_local4 < effectLength) {
if (effect[_local4].alive) {
effect[_local4].updateScreenPos(camera);
if (camera.posZ != effect[_local4].posZ) {
effect[_local4].alive = false;
}
if (_local7) {
effect[_local4].update(dt, camera);
}
}
_local4++;
}
_local4 = 0;
while (_local4 < billboard.length) {
billboard[_local4].updateScreenPos(camera);
billboard[_local4].update(camera);
_local4++;
}
if (foodDown != null) {
updateLevelMarker(foodDown, downMarker, player, camera);
}
if (foodUp != null) {
updateLevelMarker(foodUp, upMarker, player, camera);
}
} else {
downMarker._visible = false;
upMarker._visible = false;
}
}
function setVisible(vis) {
if (isVisible == vis) {
return(undefined);
}
isVisible = vis;
var _local2 = 0;
while (_local2 < fish.length) {
fish[_local2].mc._visible = vis;
_local2++;
}
_local2 = 0;
while (_local2 < food.length) {
food[_local2].mc._visible = vis;
_local2++;
}
_local2 = 0;
while (_local2 < effectLength) {
effect[_local2].mc._visible = vis;
_local2++;
}
_local2 = 0;
while (_local2 < billboardLength) {
billboard[_local2].mc._visible = vis;
_local2++;
}
}
function updateLevelMarker(food, marker, player, camera) {
if (player != null) {
if (!Camera3D.inWindow(food.screenX, food.screenY, camera)) {
var _local8 = (food.screenX + camera.screenX) - (Stage.width * 0.5);
var _local7 = (food.screenY + camera.screenY) - (Stage.height * 0.5);
var _local1 = Math.atan2(_local7, _local8);
var _local5 = Math.atan2(Stage.height, Stage.width);
var _local3;
if ((Math.abs(_local1) > _local5) && (Math.abs(_local1) < (Math.PI - _local5))) {
_local3 = Math.abs((Stage.height / 2) / Math.sin(_local1));
} else {
_local3 = Math.abs((Stage.width / 2) / Math.cos(_local1));
}
marker._x = (Stage.width / 2) + (_local3 * Math.cos(_local1));
marker._y = (Stage.height / 2) + (_local3 * Math.sin(_local1));
marker._visible = true;
} else {
marker._visible = false;
}
} else {
marker._visible = false;
}
}
function spawnFish(numFish, numSegs, maxSegs, randEvolve, segLength, speedMin, speedVar, turnSpeedMin, turnSpeedVar, panic) {
var _local4 = 0;
while (_local4 < numFish) {
var _local3;
_local3 = _root.createEmptyMovieClip((("fish_" + level) + "_") + fishLength, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
_local3._visible = false;
fish[fishLength] = new Snakefish(random(levelSize * 2) - levelSize, random(levelSize * 2) - levelSize, numSegs, maxSegs, randEvolve, segLength, speedMin + random(speedVar), ((turnSpeedMin + random(turnSpeedVar)) / 180) * Math.PI, panic, _local3, _local4, assetPrefix);
fish[fishLength].posZ = zDepth;
fish[fishLength].color.copy(fgColor);
fish[fishLength].clipName = new String((("fish_" + level) + "_") + fishLength);
fishLength++;
_local4++;
}
}
function spawnJellyfish(numFish, numSegs, maxSegs, randEvolve, segLength, speedMin, speedVar, turnSpeedMin, turnSpeedVar, panic) {
var _local4 = 0;
while (_local4 < numFish) {
var _local3;
_local3 = _root.createEmptyMovieClip((("jellyfish_" + level) + "_") + fishLength, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
_local3._visible = false;
fish[fishLength] = new Jellyfish(random(levelSize * 2) - levelSize, random(levelSize * 2) - levelSize, numSegs, maxSegs, randEvolve, segLength, speedMin + random(speedVar), ((turnSpeedMin + random(turnSpeedVar)) / 180) * Math.PI, panic, _local3, _local4, assetPrefix);
fish[fishLength].posZ = zDepth;
fish[fishLength].color.copy(fgColor);
fish[fishLength].clipName = new String((("jellyfish_" + level) + "_") + fishLength);
fishLength++;
_local4++;
}
}
function spawnFlockfish(numFish, numSegs, maxSegs, randEvolve, segLength, speedMin, speedVar, turnSpeedMin, turnSpeedVar, panic) {
var _local4 = 0;
while (_local4 < numFish) {
var _local3;
_local3 = _root.createEmptyMovieClip((("flockfish_" + level) + "_") + fishLength, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
_local3._visible = false;
fish[fishLength] = new Flockfish(random(levelSize * 2) - levelSize, random(levelSize * 2) - levelSize, numSegs, maxSegs, randEvolve, segLength, speedMin + random(speedVar), ((turnSpeedMin + random(turnSpeedVar)) / 180) * Math.PI, panic, _local3, _local4, assetPrefix);
fish[fishLength].posZ = zDepth;
fish[fishLength].color.copy(fgColor);
fish[fishLength].clipName = new String((("flockfish_" + level) + "_") + fishLength);
fishLength++;
_local4++;
}
}
function spawnBoss(numFish, numSegs, segLength, speedMin, speedVar, turnSpeedMin, turnSpeedVar) {
var _local4 = 0;
while (_local4 < numFish) {
var _local3;
_local3 = _root.createEmptyMovieClip((("boss_" + level) + "_") + fishLength, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
_local3._visible = false;
fish[fishLength] = new Boss(random(levelSize * 2) - levelSize, random(levelSize * 2) - levelSize, numSegs, segLength, speedMin + random(speedVar), ((turnSpeedMin + random(turnSpeedVar)) / 180) * Math.PI, _local3, _local4, assetPrefix);
fish[fishLength].posZ = zDepth;
fish[fishLength].color.copy(fgColor);
fish[fishLength].clipName = new String((("boss_" + level) + "_") + fishLength);
fishLength++;
_local4++;
}
}
function spawnManta(numFish, numSegs, segLength, speedMin, speedVar, turnSpeedMin, turnSpeedVar) {
var _local4 = 0;
while (_local4 < numFish) {
var _local3;
_local3 = _root.createEmptyMovieClip((("manta_" + level) + "_") + fishLength, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
_local3._visible = false;
fish[fishLength] = new Manta(random(levelSize * 2) - levelSize, random(levelSize * 2) - levelSize, numSegs, segLength, speedMin + random(speedVar), ((turnSpeedMin + random(turnSpeedVar)) / 180) * Math.PI, _local3, _local4, assetPrefix);
fish[fishLength].posZ = zDepth;
fish[fishLength].color.copy(fgColor);
fish[fishLength].clipName = new String((("manta_" + level) + "_") + fishLength);
fishLength++;
_local4++;
}
}
function spawnFood(numFood, foodType, hitPointsMin, hitPointsVar) {
var i = 0;
while (i < numFood) {
var currentObj;
_root.createEmptyMovieClip((("food_" + level) + "_") + foodLength, Camera3D.getNextDepth());
currentObj = eval ((("food_" + level) + "_") + foodLength);
currentObj._x = 0;
currentObj._y = 0;
currentObj._visible = false;
food[foodLength] = new Food(foodType, random(levelSize * 2) - levelSize, random(levelSize * 2) - levelSize, zDepth, hitPointsMin + random(hitPointsVar), currentObj, assetPrefix);
food[foodLength].color.copy(fgColor);
foodLength++;
if (foodType == 100) {
foodDown = food[foodLength - 1];
} else if (foodType == 101) {
foodUp = food[foodLength - 1];
}
i++;
}
}
function spawnBillboard(billName, posX, posY) {
var currentObj;
_root.createEmptyMovieClip((("Billboard_" + level) + "_") + 0, Camera3D.getNextDepth());
currentObj = eval ((("Billboard_" + level) + "_") + 0);
currentObj._x = posX;
currentObj._y = posY;
currentObj._visible = false;
billboard[billboardLength] = new Billboard(billName, zDepth, currentObj);
billboard[billboardLength].color = fgColor;
billboardLength++;
}
function spawnFoodAtLocation(foodType, xPos, yPos, hitPointsMin, hitPointsVar) {
var _local3;
_local3 = _root.createEmptyMovieClip((("food_" + level) + "_") + food.length, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
food[foodLength] = new Food(foodType, xPos, yPos, zDepth, hitPointsMin + random(hitPointsVar), _local3, assetPrefix);
food[foodLength].color.copy(fgColor);
foodLength++;
}
function spawnBulletAtLocation(lifeTime, xPos, yPos, segLength, speedMin, speedVar, turnSpeedMin, turnSpeedVar) {
var _local3;
_local3 = _root.createEmptyMovieClip((("bullet_" + level) + "_") + fishLength, Camera3D.getNextDepth());
_local3._x = 0;
_local3._y = 0;
fish[fishLength] = new Bullet(lifeTime, xPos, yPos, segLength, speedMin + random(speedVar), ((turnSpeedMin + random(turnSpeedVar)) / 180) * Math.PI, _local3, fishLength, assetPrefix);
fish[fishLength].posZ = zDepth;
fish[fishLength].color.copy(fgColor);
fish[fishLength].clipName = new String((("bullet_" + level) + "_") + fishLength);
fishLength++;
return(fish[fishLength - 1]);
}
function killAllBulletFish() {
var _local2 = 0;
while (_local2 < fish.length) {
if (fish[_local2].clipName == ((("bullet_" + level) + "_") + _local2)) {
fish[_local2].die();
}
_local2++;
}
}
function spawnEffect(eType, eSize, eTime, eDelay, posX, posY, camera) {
if (Camera3D.inWindow(posX, posY, camera) && (level == _root.nextLevel)) {
var _local11;
var _local4 = false;
var _local3 = 0;
while (_local3 < effectLength) {
if (!effect[_local3].alive) {
effect[_local3].reset(eType, eSize, eTime, eDelay, posX, posY, zDepth);
_local4 = true;
break;
}
_local3++;
}
if ((!_local4) && (effectLength < 64)) {
_local11 = _root.createEmptyMovieClip((("effect_" + level) + "_") + effectLength, Camera3D.getNextDepth());
effect[effectLength] = new Effect(eType, eSize, eTime, eDelay, posX, posY, zDepth, _local11);
effect[effectLength].color.copy(fgColor);
effectLength++;
}
}
}
static var zLevelGap = 300;
static var debugLines = false;
}
Symbol 171 MovieClip [__Packages.GameObject] Frame 0
class GameObject
{
var posX, posY, posZ, screenX, screenY, maxBlur, useEffect, blurFilter, colorTrans, colorTrans2, glowFilter, color, mc, level, soundVolume;
function GameObject () {
posX = (posY = (posZ = 0));
screenX = (screenY = 0);
maxBlur = 16;
useEffect = true;
blurFilter = new flash.filters.BlurFilter(0, 0, 1);
colorTrans = new flash.geom.ColorTransform();
colorTrans2 = new flash.geom.ColorTransform();
glowFilter = new flash.filters.GlowFilter(16777215, 1, 16, 16, 1.5, 1, false, false);
color = new XColor(16777215);
}
function updateScreenPos(camera) {
if (mc._visible) {
glowFilter.color = color.curColor;
applyCamera(camera);
}
}
function applyCamera(camera) {
level = Math.round(posZ / GameLevel.zLevelGap);
var _local5 = posZ - camera.posZ;
var _local4 = camera.focalLength / (camera.focalLength + _local5);
var _local7 = 100 * _local4;
if (Math.abs(_local5) < GameLevel.zLevelGap) {
soundVolume = ((GameLevel.zLevelGap - Math.abs(_local5)) / GameLevel.zLevelGap) * 100;
var _local6 = dist(posX, posY, _root.player.posX, _root.player.posY);
if (_local6 < soundRange) {
soundVolume = soundVolume * ((soundRange - _local6) / soundRange);
} else {
soundVolume = 0;
}
} else {
soundVolume = 0;
}
if (useEffect) {
shadeImage(_local5);
blurImage(_local7);
}
_local5 = (posZ - camera.posZ) + camera.zOffset;
_local4 = camera.focalLength / (camera.focalLength + _local5);
mc._xscale = (mc._yscale = 100 * _local4);
mc._x = camera.posX * _local4;
mc._y = camera.posY * _local4;
screenX = posX * _local4;
screenY = posY * _local4;
camera.zScaleRatio = _local4;
camera.screenX = camera.posX * _local4;
camera.screenY = camera.posY * _local4;
}
function blurImage(scale) {
var _local2;
if (mc.seg0._xscale <= 100) {
if (scale >= 100) {
_local2 = 0;
mc.filters = [glowFilter];
} else {
_local2 = (100 - scale) / 100;
blurFilter.blurX = _local2 * maxBlur;
blurFilter.blurY = _local2 * maxBlur;
mc.filters = [blurFilter, glowFilter];
}
} else {
mc.filters = [];
}
}
function shadeImage(dz) {
var _local2 = 0.3 + ((0.7 * (GameLevel.zLevelGap - dz)) / GameLevel.zLevelGap);
colorTrans.alphaMultiplier = _local2;
colorTrans2.alphaMultiplier = _local2 * 0.3;
colorTrans.redOffset = (colorTrans2.redOffset = -(255 - color.getRed()));
colorTrans.greenOffset = (colorTrans2.greenOffset = -(255 - color.getGreen()));
colorTrans.blueOffset = (colorTrans2.blueOffset = -(255 - color.getBlue()));
}
function dist(x1, y1, x2, y2) {
var _local1 = Math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
return(_local1);
}
var soundRange = 500;
}
Symbol 172 MovieClip [__Packages.XColor] Frame 0
class XColor
{
var defaultColor, baseColor, targetColor, curColor, bias;
function XColor (base) {
defaultColor = base;
baseColor = base;
targetColor = base;
curColor = base;
bias = 1;
}
function copy(color) {
defaultColor = color.defaultColor;
baseColor = color.baseColor;
targetColor = color.targetColor;
curColor = color.curColor;
}
function setBias(bias) {
var _local3 = (RED(baseColor) * bias) + (RED(targetColor) * (1 - bias));
var _local5 = (GREEN(baseColor) * bias) + (GREEN(targetColor) * (1 - bias));
var _local4 = (BLUE(baseColor) * bias) + (BLUE(targetColor) * (1 - bias));
curColor = RGB(_local3, _local5, _local4);
this.bias = bias;
}
function getRed() {
return(RED(curColor));
}
function getGreen() {
return(GREEN(curColor));
}
function getBlue() {
return(BLUE(curColor));
}
static function RED(rgb) {
return((rgb & 16711680) >> 16);
}
static function GREEN(rgb) {
return((rgb & 65280) >> 8);
}
static function BLUE(rgb) {
return(rgb & 255);
}
static function RGB(r, g, b) {
return(((r << 16) | (g << 8)) | b);
}
}
Symbol 173 MovieClip [__Packages.Camera3D] Frame 0
class Camera3D extends GameObject
{
var targetX, targetY, targetZ, focalLength, zOffset, zScaleRatio, shaking, shakeTimePassed, shakeDelay, shakeMax;
function Camera3D () {
super();
targetX = (targetY = (targetZ = 0));
focalLength = 400;
zOffset = 0;
zScaleRatio = 1;
shaking = false;
shakeTimePassed = 0;
shakeDelay = 0.1;
}
function shake(shakeMagnitude) {
shaking = true;
if (shakeMagnitude <= 0) {
shakeMax = 4;
} else {
shakeMax = shakeMagnitude;
}
shakeMax = 20;
}
function updateShake(dt) {
if (!shaking) {
zOffset = zOffset + ((-zOffset) * dt);
} else {
shakeTimePassed = shakeTimePassed + dt;
zOffset = zOffset - ((shakeMax * dt) / shakeDelay);
if (shakeTimePassed > shakeDelay) {
shakeTimePassed = 0;
shaking = false;
}
}
}
static function inWindow(xx, yy, camera) {
if ((Math.abs((xx + camera.posX) - (Stage.width * 0.5)) > (Stage.width * 0.5)) || (Math.abs((yy + camera.posY) - (Stage.height * 0.5)) > (Stage.height * 0.5))) {
return(false);
}
return(true);
}
static function getNextDepth() {
return(nextDepth++);
}
static function drawRectangle(target_mc, boxWidth, boxHeight, fillColor, fillAlpha) {
with (target_mc) {
beginFill(fillColor, fillAlpha);
moveTo(0, 0);
lineTo(boxWidth, 0);
lineTo(boxWidth, boxHeight);
lineTo(0, boxHeight);
lineTo(0, 0);
endFill();
}
}
static var nextDepth = 0;
}
Symbol 174 MovieClip [__Packages.Food] Frame 0
class Food extends GameObject
{
var posX, posY, posZ, mc, foodType, gfxPrefix, alive, nutrition, timer, respawnTime, trans, headingX, headingY, colorTrans;
function Food (foodType, posX, posY, posZ, fSize, mc, prefix) {
super();
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.fSize = fSize;
this.mc = mc;
speed = fSize;
this.foodType = foodType;
gfxPrefix = prefix;
currentAim = random((Math.PI*2));
alive = true;
var _local3;
nutrition = foodType;
_local3 = mc.attachMovie((gfxPrefix + "food") + foodType, "dot", 0);
timer = 0;
respawnTime = 0;
if (foodType == 0) {
nutrition = 1;
respawnTime = 0;
} else if (foodType == 100) {
nutrition = 0;
respawnTime = 3;
} else if (foodType == 101) {
nutrition = 0;
respawnTime = 3;
}
_local3._xscale = fSize;
_local3._yscale = fSize;
_local3._x = posX;
_local3._y = posY;
trans = new flash.geom.Transform(_local3);
}
function update(dt, camera) {
if (!alive) {
var _local2 = mc.dot;
_local2._xscale = 0;
_local2._yscale = 0;
if (respawnTime > 0) {
timer = timer + dt;
if (timer > respawnTime) {
alive = true;
timer = 0;
_local2._x = posX;
_local2._y = posY;
_local2._xscale = fSize;
_local2._yscale = fSize;
}
}
} else {
var _local3 = (mc.dot._rotation * Math.PI) / 180;
headingX = Math.cos(_local3);
headingY = Math.sin(_local3);
turnRandom();
posX = posX + ((speed * Math.cos(currentAim)) * dt);
posY = posY + ((speed * Math.sin(currentAim)) * dt);
var _local2 = mc.dot;
_local2._rotation = (currentAim * 180) / Math.PI;
_local2._x = posX;
_local2._y = posY;
}
trans.colorTransform = colorTrans;
}
function turnRandom() {
var _local2 = random(3);
if (_local2 > 1.5) {
currentAim = currentAim + turnSpeed;
} else {
currentAim = currentAim - turnSpeed;
}
}
var fSize = 0;
var speed = 0.1;
var turnSpeed = 0.05;
var currentAim = 0;
}
Symbol 175 MovieClip [__Packages.Creature] Frame 0
class Creature extends GameObject
{
var posX, posY, defaultNumSegs, defaultSegLength, segLength, defaultSpeed, speed, currentSpeed, turnSpeed, panic, mc, ID, assetPrefix, maxEvolveStates, maxSegs, mouthSize, aliveTime, lifeTime, alive, dieing, targets, hasChosenTarget, tempMin, tempMinDefault, tempFood, tempFish, tempWeak, hasTarget, headingX, headingY, level, transArray, colorTrans, weakLength, weakPointsHit, colorTrans2, weakPoints, segTag, segSounds, segTimes, numSegs, curNumSegs, glowID, targetX, targetY, tempTargetX, tempTargetY, boss, panicTimer, dieExplosionRate, dieTimer, dieSeg, turnIntoFoodOnDeath, behavior, wounded, panicIntensity, panicIntensityDefault, panicRange, panicTimerDefault, defaultColorTransTime, colorTransTime, curTransTime, coward, color, sounds, soundVolume, screenY, screenX, clipName;
function Creature (posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix) {
super();
this.posX = posX;
this.posY = posY;
defaultNumSegs = numSegs;
defaultSegLength = segLength;
this.segLength = segLength;
defaultSpeed = speed;
this.speed = speed;
currentSpeed = speed * 0.2;
this.turnSpeed = turnSpeed;
this.panic = panic;
this.mc = mc;
this.ID = ID;
assetPrefix = prefix;
maxEvolveStates = 4;
this.maxSegs = maxSegs;
initializeVars();
initialize();
var _local3 = 0;
while (_local3 < randEvolve) {
evolveRandomSeg();
_local3++;
}
}
function update(dt, camera, player, fish, food) {
mouthSize = mc.seg0._yscale;
aliveTime = aliveTime + dt;
if ((((aliveTime >= lifeTime) && (lifeTime >= 0)) && (alive)) && (!dieing)) {
die();
}
while (targets.length > 0) {
targets.pop();
}
if (!hasChosenTarget) {
tempMin = tempMinDefault;
tempFood = -1;
tempFish = -2;
tempWeak = -1;
hasTarget = false;
}
var _local5 = (mc.seg0._rotation * Math.PI) / 180;
headingX = Math.cos(_local5);
headingY = Math.sin(_local5);
if (dieing && (level == _root.nextLevel)) {
dieUpdate(dt);
} else {
chooseTarget(dt, player, fish, food);
collision(food);
eatingUpdate(dt, camera);
movementUpdate(dt, camera);
}
updateColor(dt);
var _local3 = 0;
while (_local3 < transArray.length) {
transArray[_local3].colorTransform = colorTrans;
_local3++;
}
_local3 = 0;
while (_local3 < weakLength) {
if (weakPointsHit[_local3] == 0) {
transArray[weakPoints[_local3]].colorTransform = colorTrans2;
}
_local3++;
}
hasChosenTarget = false;
}
function initializeVars() {
targets = new Array();
transArray = new Array();
segTag = new Array(64);
segSounds = new Array(64);
segTimes = new Array(64);
weakPoints = new Array(64);
weakPointsHit = new Array(64);
speed = defaultSpeed;
currentSpeed = speed * 0.2;
segLength = defaultSegLength;
numSegs = defaultNumSegs;
curNumSegs = 0;
glowID = 1;
targetX = posX;
targetY = posY;
tempTargetX = targetX;
tempTargetY = targetY;
weakLength = 0;
hasTarget = false;
boss = false;
panicTimer = 0;
alive = true;
dieing = false;
dieExplosionRate = 0;
dieTimer = 0;
dieSeg = 0;
turnIntoFoodOnDeath = true;
aliveTime = 0;
lifeTime = -1;
tempMinDefault = 15 * segLength;
behavior = new Behavior();
wounded = false;
panicIntensity = 0;
panicIntensityDefault = 4;
panicRange = Math.min((segLength * 3) + 200, 500);
panicTimerDefault = 3;
panicTimer = 0;
defaultColorTransTime = 0.66;
colorTransTime = defaultColorTransTime;
curTransTime = 0;
hasChosenTarget = false;
coward = false;
}
function initialize() {
}
function chooseTarget(dt, player, fish, food) {
}
function updateColor(dt) {
if (color.curColor != color.targetColor) {
curTransTime = curTransTime + dt;
color.setBias((colorTransTime - curTransTime) / colorTransTime);
if (color.bias <= 0) {
color.baseColor = color.targetColor;
color.setBias(1);
curTransTime = 0;
}
}
}
function createFishMouth() {
var _local2 = mc.attachMovie(assetPrefix + "seghead1", "seg0", 99);
createMouth(_local2);
}
function createJellyMouth() {
var _local2 = mc.attachMovie(assetPrefix + "jellyhead1", "seg0", 99);
createMouth(_local2);
}
function createMouth(seg) {
segSounds[0] = 0;
segTag[0] = 0;
seg._xscale = segLength;
seg._yscale = segLength;
seg.evolveState = 1;
curNumSegs++;
var _local3 = new flash.geom.Transform(seg);
transArray.push(_local3);
}
function collision(food) {
if ((eating == -1) && (tempMin < mouthSize)) {
mc.seg0.gotoAndPlay(2);
if (tempFish != -2) {
targets[tempFish].wound(tempWeak);
eating = 1;
nutrition = 1;
if (targets[tempFish].ID == -1) {
_root.camera.shake(0);
}
} else {
eating = food[tempFood].foodType;
nutrition = food[tempFood].nutrition;
food[tempFood].alive = false;
if (eating == 100) {
_root.switchLevel(_root.curLevel + 1);
eating = 0;
} else if (eating == 101) {
_root.switchLevel(_root.curLevel - 1);
eating = 0;
}
}
var _local3 = int(random(5));
sounds[_local3].setVolume(soundVolume);
sounds[_local3].start(0, 1);
}
}
function movementUpdate(dt, camera) {
var _local8;
if (ID == -1) {
_local8 = Math.atan2((_root.ymouse - camera.screenY) - screenY, (_root.xmouse - camera.screenX) - screenX);
} else {
_local8 = Math.atan2(targetY - posY, targetX - posX);
}
var _local7 = (_local8 - orient) % (Math.PI*2);
if (_local7 <= -3.14159265358979) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local7 > Math.PI) {
orient = orient - ((turnSpeed * dt) * 30);
} else if (_local7 > 0) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local7 < 0) {
orient = orient - ((turnSpeed * dt) * 30);
}
if (ID == -1) {
if (pressed) {
currentSpeed = Math.min(speed, currentSpeed + (dt * 400));
}
currentSpeed = currentSpeed + (((speed * 0.2) - currentSpeed) * 0.05);
} else if (wounded || (coward)) {
currentSpeed = panicIntensity * speed;
} else if (((!wounded) && (!coward)) && (panicIntensity > 1)) {
currentSpeed = panicIntensity * speed;
panicIntensity = panicIntensity * (1 - (dt * 2));
if (panicIntensity <= 1) {
panicIntensity = 0;
}
} else {
currentSpeed = speed;
}
posX = posX + ((currentSpeed * Math.cos(orient)) * dt);
posY = posY + ((currentSpeed * Math.sin(orient)) * dt);
if ((ID == -1) && (_root.switchingLevels)) {
drag(mc.seg0, posX, posY);
var _local3 = 0;
while (_local3 < numSegs) {
var _local4 = mc["seg" + _local3];
var _local5 = mc["seg" + (_local3 + 1)];
drag(_local5, _local4._x, _local4._y);
_local3++;
}
} else {
drag(mc.seg0, posX, posY);
var _local3 = 0;
while (_local3 < numSegs) {
var _local4 = mc["seg" + _local3];
var _local5 = mc["seg" + (_local3 + 1)];
drag(_local5, _local4._x, _local4._y);
_local3++;
}
}
}
function drag(seg, x, y) {
var _local4 = x - seg._x;
var _local3 = y - seg._y;
var _local2 = Math.atan2(_local3, _local4);
seg._rotation = (_local2 * 180) / Math.PI;
if (seg.evolveState < 0) {
seg._x = x - ((Math.cos(_local2) * seg._xscale) * 2);
seg._y = y - ((Math.sin(_local2) * seg._xscale) * 2);
} else {
seg._x = x - (Math.cos(_local2) * seg._xscale);
seg._y = y - (Math.sin(_local2) * seg._xscale);
}
}
function dist(x1, y1, x2, y2) {
var _local1 = Math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
return(_local1);
}
function rebirth() {
lifeCycle++;
numSegs = 3;
weakLength = 0;
var _local2 = 3;
while (_local2 <= 64) {
var _local3 = mc["seg" + _local2];
_local3.removeMovieClip();
_local2++;
}
}
function grow() {
if (curNumSegs <= maxSegs) {
var _local2;
_local2 = mc.attachMovie(assetPrefix + "segbody1", "seg" + curNumSegs, 99 - curNumSegs);
segTimes[curNumSegs] = 0.25;
segSounds[curNumSegs] = int(random(5));
segTag[curNumSegs] = 0;
_local2._rotation = mc["seg" + (curNumSegs - 1)]._rotation;
_local2._x = mc["seg" + (curNumSegs - 1)]._x;
_local2._y = mc["seg" + (curNumSegs - 1)]._y;
_local2._xscale = segLength;
_local2._yscale = segLength;
_local2.evolveState = 1;
speed = speed + (segLength * 0.5);
if (curNumSegs == numSegs) {
numSegs++;
}
curNumSegs++;
var _local3 = new flash.geom.Transform(_local2);
transArray.push(_local3);
if (curNumSegs == 64) {
rebirth();
}
if (curNumSegs == 2) {
evolveSegment(1);
}
regeneration();
} else if (evolveMinSeg() == 0) {
evolveMinSeg();
}
}
function evolveMinSeg() {
var _local4 = 0;
var _local3 = mc.seg0.evolveState;
var _local2 = 1;
while (_local2 < curNumSegs) {
if (mc["seg" + _local2].evolveState < _local3) {
_local3 = mc["seg" + _local2].evolveState;
_local4 = _local2;
}
_local2++;
}
evolveSegment(_local4);
return(_local4);
}
function evolveRandomSeg() {
var _local3 = mc.seg1.evolveState;
var _local2 = 1;
while (_local2 < curNumSegs) {
if (mc["seg" + _local2].evolveState < _local3) {
_local3 = mc["seg" + _local2].evolveState;
}
_local2++;
}
var _local4 = Math.max(random(curNumSegs), 1);
while (mc["seg" + _local4].evolveState > _local3) {
_local4 = random(curNumSegs);
}
evolveSegment(_local4);
}
function regeneration() {
var _local2 = 0;
while (_local2 < weakLength) {
if (weakPointsHit[_local2] < weakPointsHitC) {
weakPointsHit[_local2] = weakPointsHitC;
var _local3 = mc["seg" + weakPoints[_local2]];
_local3._alpha = 100;
speed = speed + ((mc["seg" + weakPoints[_local2]].evolveState - 1) * segLength);
break;
}
_local2++;
}
}
function wound(weakPointID) {
if (level != _root.curLevel) {
return(undefined);
}
if (panic) {
wounded = true;
tempTargetX = targetX;
tempTargetY = targetY;
panicIntensity = panicIntensityDefault;
panicTimer = panicTimerDefault;
}
weakPointsHit[weakPointID] = 0;
speed = speed - ((mc["seg" + weakPoints[weakPointID]].evolveState - 1) * segLength);
var _local6 = mc["seg" + weakPoints[weakPointID]];
_local6._alpha = 0;
var _local4 = true;
var _local3 = 0;
while (_local3 < weakLength) {
if (weakPointsHit[_local3] != 0) {
_local4 = false;
break;
}
_local3++;
}
if (_local4) {
die();
}
}
function die() {
if (ID == -1) {
_root.switchLevel(_root.curLevel - 1);
dieExplosionRate = 1;
dieTimer = dieExplosionRate;
dieing = true;
dieSeg = numSegs - 1;
} else {
dieing = true;
dieExplosionRate = 2 / numSegs;
dieTimer = dieExplosionRate;
}
}
function dieUpdate(dt) {
if (_root.switchingLevels) {
return(undefined);
}
var _local6 = false;
dieTimer = dieTimer + dt;
while ((dieTimer > dieExplosionRate) && (dieSeg < numSegs)) {
dieTimer = dieTimer - dieExplosionRate;
var _local5 = 0;
var _local4 = 0;
var _local3 = dieSeg;
while (_local3 < numSegs) {
dieSeg++;
_local5 = mc["seg" + _local3]._x;
_local4 = mc["seg" + _local3]._y;
trace((_local5 + ",") + _local4);
if (_local3 != 0) {
if (turnIntoFoodOnDeath && (segTag[_local3] > 0)) {
_root.gameLevels[level].spawnFoodAtLocation(segTag[_local3], _local5, _local4, 15, 10);
}
_root.gameLevels[level].spawnEffect(0, segLength / 20, segLength / 20, 0, _local5, _local4);
} else {
if (turnIntoFoodOnDeath) {
_root.gameLevels[level].spawnFoodAtLocation(0, _local5, _local4, 15, 10);
}
_root.gameLevels[level].spawnEffect(0, segLength / 5, segLength / 20, 0, _local5, _local4);
}
speed = speed - (segLength * 0.5);
mc["seg" + _local3].removeMovieClip();
_local6 = true;
if (dieSeg >= numSegs) {
if (ID == -1) {
_root.gameLevels[level].killAllBulletFish();
numSegs--;
curNumSegs = numSegs;
dieing = false;
_root.gameLevels[level].spawnFoodAtLocation(1, _local5, _local4, 15, 10);
_root.gameLevels[level].spawnEffect(0, segLength / 4, segLength / 10, 0, _local5, _local4);
} else {
alive = false;
_root[clipName].removeMovieClip();
}
}
if (_local6) {
break;
}
_local3++;
}
}
}
function eatingUpdate(dt, camera) {
var _local4 = 0;
var _local5 = 0;
while (_local5 < numSegs) {
if (segTag[_local5] == 1) {
_local4 = _local5;
}
_local5++;
}
if (eating > -1) {
if (nutrition <= 0) {
glowID = 0;
eating = -1;
eatingTimer = 0;
tempScaleX = mc.seg0._xscale;
tempScaleY = mc.seg0._yscale;
mc.seg0.gotoAndPlay(23);
} else {
mc["seg" + glowID]._xscale = tempScaleX * (1 + (eatingTimer / eatingTimerC));
mc["seg" + glowID]._yscale = tempScaleY * (1 + (eatingTimer / eatingTimerC));
eatingTimer = eatingTimer - dt;
if (eatingTimer <= 0) {
mc["seg" + glowID]._xscale = tempScaleX;
mc["seg" + glowID]._yscale = tempScaleY;
glowID = Math.min(glowID + 1, numSegs);
tempScaleX = mc["seg" + glowID]._xscale;
tempScaleY = mc["seg" + glowID]._yscale;
if (eating > 0) {
if (nutrition > 0) {
if ((ID == -1) || (!panic)) {
_local5 = 0;
while (_local5 < weakLength) {
if ((weakPoints[_local5] == glowID) && (weakPointsHit[_local5] < weakPointsHitC)) {
weakPointsHit[_local5] = weakPointsHitC;
var _local3 = mc["seg" + weakPoints[_local5]];
_local3._alpha = 100;
speed = speed + ((mc["seg" + weakPoints[_local5]].evolveState - 1) * segLength);
nutrition--;
_root.gameLevels[level].spawnEffect(1, segLength / 20, segLength / 20, 0, mc["seg" + (glowID - 1)]._x, mc["seg" + (glowID - 1)]._y);
break;
}
_local5++;
}
}
while ((segTag[glowID] < mc["seg" + glowID].evolveState) && (nutrition > 0)) {
segTag[glowID]++;
mc["seg" + glowID].gotoAndStop(segTag[glowID] + 1);
nutrition--;
}
if (((glowID == (numSegs - 1)) && (segTag[glowID] == mc["seg" + glowID].evolveState)) && (nutrition > 0)) {
_local5 = 1;
while (_local5 < numSegs) {
segTag[_local5] = 0;
mc["seg" + _local5].gotoAndStop(1);
_local5++;
}
grow();
nutrition--;
_root.gameLevels[level].spawnEffect(0, segLength, segLength / 20, segTimes[glowID], mc["seg" + glowID]._x, mc["seg" + glowID]._y);
if (nutrition > 0) {
var _local7 = mc["seg" + (numSegs - 1)]._x;
var _local6 = mc["seg" + (numSegs - 1)]._y;
_root.gameLevels[level].spawnFoodAtLocation(nutrition, _local7, _local6, 15, 10);
_root.gameLevels[level].spawnEffect(0, segLength / 20, (segLength / 20) + 1, 0, _local7, _local6);
nutrition = 0;
}
}
}
} else if (eating == 0) {
if ((glowID == _local4) || (_local4 <= 1)) {
if (_local4 < 1) {
_local4 = 1;
}
if (mc["seg" + glowID].evolveState < maxEvolveStates) {
nutrition--;
evolveSegment(_local4);
} else {
_local5 = 1;
while (_local5 < numSegs) {
if (mc["seg" + _local5].evolveState < maxEvolveStates) {
evolveSegment(_local5);
break;
}
_local5++;
}
nutrition--;
}
}
}
eatingTimer = segTimes[glowID];
_root.gameLevels[level].spawnEffect(0, segLength / 20, segLength / 20, 0, mc["seg" + (glowID - 1)]._x, mc["seg" + (glowID - 1)]._y);
_local5 = int(random(5));
sounds[_local5].setVolume(soundVolume);
sounds[_local5].start(0, 1);
}
}
}
}
function evolveSegment(segNum) {
if (segNum == 0) {
mc["seg" + segNum].evolveState++;
return(undefined);
}
var _local4 = mc["seg" + segNum].evolveState;
_local4++;
if (_local4 <= maxEvolveStates) {
if (_local4 == 2) {
weakPoints[weakLength] = segNum;
weakPointsHit[weakLength] = weakPointsHitC;
weakLength++;
}
var _local10 = mc["seg" + segNum]._x;
var _local9 = mc["seg" + segNum]._y;
var _local7 = mc["seg" + segNum].vx;
var _local6 = mc["seg" + segNum].vy;
var _local5 = ("c" + _local4) + "_";
mc["seg" + segNum].removeMovieClip();
var _local3 = mc.attachMovie(_local5 + "segbody1", "seg" + segNum, 99 - segNum);
_local3.evolveState = _local4;
speed = speed + (0.5 * segLength);
_local3._xscale = segLength;
_local3._yscale = segLength;
segTimes[curNumSegs] = 0.25 * _local4;
_local3._x = _local10;
_local3._y = _local9;
_local3.vx = _local7;
_local3.vy = _local6;
_local3.gotoAndStop(segTag[segNum] + 1);
segSounds[curNumSegs] = 0;
var _local8 = new flash.geom.Transform(_local3);
transArray[segNum] = _local8;
}
}
var pressed = false;
var orient = 0;
var lifeCycle = 0;
var tempScaleX = 1;
var tempScaleY = 1;
var eatingTimerC = 0.333333333333333;
var eatingTimer = Creature.prototype.eatingTimerC;
var eating = -1;
var nutrition = 0;
var weakPointsHitC = 3;
}
Symbol 176 MovieClip [__Packages.Behavior] Frame 0
class Behavior
{
var panicColor, targetPlayerColor, targetFoodColor, targetFishColor, defaultColor;
function Behavior () {
panicColor = new XColor(4386);
targetPlayerColor = new XColor(16746564);
targetFoodColor = new XColor(16777215);
targetFishColor = new XColor(16746564);
defaultColor = new XColor(16777215);
}
function goToRandomLocation(subj) {
subj.targetX = random(_root.gameLevels[subj.level].levelSize * 2) - _root.gameLevels[subj.level].levelSize;
subj.targetY = random(_root.gameLevels[subj.level].levelSize * 2) - _root.gameLevels[subj.level].levelSize;
switchColor(subj, defaultColor);
return(true);
}
function panicMovement(dt, subj, player, panicRange, panicIntensity) {
if (player != null) {
subj.targets[0] = player;
}
var _local4 = (subj.mc.seg0._rotation * Math.PI) / 180;
if (dist(subj.posX, subj.posY, player.posX, player.posY) <= panicRange) {
subj.targetX = subj.targetX + (subj.currentSpeed * Math.cos(_local4));
subj.targetY = subj.targetY + (subj.currentSpeed * Math.sin(_local4));
}
subj.colorTransTime = 0.1;
switchColor(subj, panicColor);
subj.panicTimer = subj.panicTimer - dt;
if ((dist(subj.posX, subj.posY, player.posX, player.posY) >= panicRange) || ((subj.wounded && (!subj.coward)) && (subj.panicTimer < 0))) {
endPanic(subj);
return(false);
}
return(true);
}
function endPanic(subj) {
subj.targetX = subj.tempTargetX;
subj.targetY = subj.tempTargetY;
subj.panicTimer = 0;
subj.colorTransTime = subj.defaultColorTransTime;
switchColor(subj, defaultColor);
}
function endCoward(subj) {
if (subj.coward && (!subj.wounded)) {
endPanic(subj);
}
subj.coward = false;
}
function hordeMovement(subj, player, fish, food, inFront, attackDist, hordeDist, cowardDist, hordeNum) {
var _local4 = new Array();
var _local2 = 0;
while (_local2 < fish.length) {
if ((fish[_local2].ID != subj.ID) && (fish[_local2].type == subj.type)) {
if ((!fish[_local2].wounded) && (dist(subj.posX, subj.posY, fish[_local2].posX, fish[_local2].posY) <= hordeDist)) {
_local4.push(fish[_local2]);
}
}
_local2++;
}
if (!subj.wounded) {
if (_local4.length >= hordeNum) {
endCoward(subj);
if ((player != null) && (dist(player.posX, player.posY, subj.posX, subj.posY) <= attackDist)) {
subj.tempMin = attackDist;
eatPlayerOnly(subj, player, inFront);
_local2 = 0;
while (_local2 < _local4.length) {
endCoward(_local4[_local2]);
if (!_local4[_local2].wounded) {
_local4[_local2].tempMin = 99999 /* 0x01869F */;
_local4[_local2].hasTarget = false;
eatPlayerOnly(_local4[_local2], player, inFront);
_local4[_local2].hasChosenTarget = true;
}
_local2++;
}
} else {
eatFoodOnly(subj, food, inFront);
}
} else if ((player != null) && (dist(player.posX, player.posY, subj.posX, subj.posY) <= cowardDist)) {
if (!subj.coward) {
subj.coward = true;
subj.tempTargetX = subj.targetX;
subj.tempTargetY = subj.targetY;
subj.panicIntensity = subj.panicIntensityDefault;
subj.panicTimer = 0;
}
} else {
endCoward(subj);
eatFoodOnly(subj, food, inFront);
}
if ((!subj.hasTarget) && (!subj.coward)) {
switchColor(subj, defaultColor);
if (dist(subj.posX, subj.posY, subj.targetX, subj.targetY) < subj.mouthSize) {
goToRandomLocation(subj);
}
}
}
return(subj.hasTarget);
}
function eatAnything(subj, player, fish, food, inFront) {
findClosestFood(subj, food);
var _local2 = 0;
while (_local2 < fish.length) {
subj.targets[_local2] = fish[_local2];
_local2++;
}
if (player != null) {
subj.targets[fish.length] = player;
}
findClosestWeakpoint(subj, inFront);
if ((subj.tempFood != -1) || (subj.tempFish != -2)) {
subj.hasTarget = true;
}
if (subj.tempFood != -1) {
switchColor(subj, targetFoodColor);
}
if (subj.tempFish != -2) {
switchColor(subj, targetFishColor);
}
if (subj.targets[subj.tempFish].ID == -1) {
switchColor(subj, targetPlayerColor);
}
if ((subj.tempFood == -1) && (subj.tempFish == -2)) {
switchColor(subj, defaultColor);
}
return(subj.hasTarget);
}
function eatFoodOnly(subj, food, inFront) {
findClosestFood(subj, food);
if (subj.tempFood != -1) {
subj.hasTarget = true;
switchColor(subj, targetFoodColor);
}
return(subj.hasTarget);
}
function eatPlayerOnly(subj, player, inFront) {
if (player != null) {
subj.targets[0] = player;
}
findClosestWeakpoint(subj, inFront);
if (subj.tempFish != -2) {
subj.hasTarget = true;
switchColor(subj, targetPlayerColor);
}
return(subj.hasTarget);
}
function eatPlayerAndFood(subj, player, food, inFront) {
findClosestFood(subj, food);
if (player != null) {
subj.targets[0] = player;
}
findClosestWeakpoint(subj, inFront);
if (subj.tempFood != -1) {
subj.hasTarget = true;
switchColor(subj, targetFoodColor);
}
if (subj.tempFish != -2) {
subj.hasTarget = true;
switchColor(subj, targetPlayerColor);
}
return(subj.hasTarget);
}
function findClosestFood(subj, food) {
var _local3 = 0;
while (_local3 < food.length) {
var _local6 = dist(food[_local3].posX, food[_local3].posY, subj.posX, subj.posY);
if ((subj == _root.player) || (food[_local3].foodType < 100)) {
if ((_local6 < subj.tempMin) && (food[_local3].alive)) {
subj.tempMin = _local6;
subj.tempFood = _local3;
subj.targetX = food[_local3].posX;
subj.targetY = food[_local3].posY;
}
}
_local3++;
}
}
function findClosestWeakpoint(subj, inFront) {
var _local3 = 0;
while (_local3 < subj.targets.length) {
if (subj.targets[_local3].ID != subj.ID) {
var _local4 = 0;
while (_local4 < subj.targets[_local3].weakLength) {
if (subj.targets[_local3].weakPointsHit[_local4] == subj.targets[_local3].weakPointsHitC) {
var _local6;
var _local5;
if (subj.targets[_local3].boss == false) {
_local6 = subj.targets[_local3].mc["seg" + subj.targets[_local3].weakPoints[_local4]]._x;
_local5 = subj.targets[_local3].mc["seg" + subj.targets[_local3].weakPoints[_local4]]._y;
} else {
_local6 = getBossWeakpointX(subj.targets[_local3], subj.targets[_local3].mc.seg0["weakPoint" + _local4]);
_local5 = getBossWeakpointY(subj.targets[_local3], subj.targets[_local3].mc.seg0["weakPoint" + _local4]);
}
if (inFront && (DotProd2D(subj.headingX, subj.headingY, _local6 - subj.posX, _local5 - subj.posY) <= 0)) {
} else {
var _local7 = dist(_local6, _local5, subj.posX, subj.posY);
if ((_local7 < subj.tempMin) && (subj.targets[_local3].weakPointsHit[_local4] == subj.targets[_local3].weakPointsHitC)) {
subj.tempMin = _local7;
subj.tempFish = _local3;
subj.tempWeak = _local4;
subj.targetX = _local6;
subj.targetY = _local5;
}
}
}
_local4++;
}
}
_local3++;
}
}
function getBossWeakpointX(boss, wp) {
var _local2 = (boss.mc.seg0._rotation * Math.PI) / 180;
var _local1 = (Math.cos(_local2) * wp._x) - (Math.sin(_local2) * wp._y);
_local1 = _local1 * (boss.mc.seg0._xscale * 0.01);
return(boss.mc.seg0._x + _local1);
}
function getBossWeakpointY(boss, wp) {
var _local2 = (boss.mc.seg0._rotation * Math.PI) / 180;
var _local1 = (Math.cos(_local2) * wp._y) + (Math.sin(_local2) * wp._x);
_local1 = _local1 * (boss.mc.seg0._yscale * 0.01);
return(boss.mc.seg0._y + _local1);
}
function dist(x1, y1, x2, y2) {
var _local1 = Math.sqrt(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
return(_local1);
}
function DotProd2D(x1, y1, x2, y2) {
return((x1 * x2) + (y1 * y2));
}
function switchColor(subj, dest) {
if (subj.ID != -1) {
if (subj.color.targetColor != dest.baseColor) {
subj.color.baseColor = subj.color.curColor;
subj.color.targetColor = dest.baseColor;
subj.curTransTime = 0;
}
}
}
}
Symbol 177 MovieClip [__Packages.SndLoader] Frame 0
class SndLoader
{
var curSndIndex, sounds, filenames;
function SndLoader () {
initialize();
}
function initialize() {
curSndIndex = 0;
sounds = new Array();
filenames = ["c1_Flow-lvl 0 drone.mp3", "c1_Flow-lvl 1 drone.mp3", "c1_Flow-lvl 2 drone.mp3", "c1_Flow-lvl 3 drone.mp3", "c1_Flow-lvl 4 drone.mp3", "c1_Flow-lvl 5 drone.mp3", "c1_Flow-lvl 6 drone.mp3", "c1_Flow-lvl 7 drone.mp3", "c1_Flow-lvl 8 drone.mp3", "c1_Flow-lvl 9 drone.mp3", "c1_Flow-lvl 10 drone.mp3", "c1_Flow-lvl 11 drone.mp3", "c1_Flow-lvl 12 drone.mp3", "c1_Flow-lvl 13 drone.mp3", "c1_Flow-lvl 14 drone.mp3", "c1_Flow-lvl 15 drone.mp3", "c1_Flow-lvl 16 drone.mp3", "c1_Flow-lvl 17 drone.mp3", "c1_Flow-lvl 18 drone.mp3", "c1_Flow-lvl 19 drone.mp3"];
sounds = new Array(filenames.length);
var _local3 = 0;
while (_local3 < sounds.length) {
sounds[_local3] = new Sound(_root);
_local3++;
}
loadNext();
}
function update() {
if (sounds[curSndIndex - 1].getBytesTotal() == sounds[curSndIndex - 1].getBytesLoaded()) {
loadNext();
}
}
function loadNext() {
if (curSndIndex < filenames.length) {
trace("loading: " + filenames[curSndIndex]);
sounds[curSndIndex].loadSound(filenames[curSndIndex], false);
sounds[curSndIndex].stop();
sounds[curSndIndex].setVolume(0);
curSndIndex++;
}
}
function getSound(filename) {
filename = ("" + filename) + ".mp3";
var _local3 = -1;
var _local2 = 0;
while (_local2 < filenames.length) {
if (filename == filenames[_local2]) {
_local3 = _local2;
break;
}
_local2++;
}
if (_local3 == -1) {
return(null);
}
return(sounds[_local3]);
}
static function isLoaded(snd) {
return(snd.getBytesTotal() == snd.getBytesLoaded());
}
}
Symbol 178 MovieClip [__Packages.Snakefish] Frame 0
class Snakefish extends Creature
{
var type, panicIntensityDefault, createFishMouth, numSegs, grow, tempScaleX, mc, tempScaleY, sounds, assetPrefix, panicRange, segLength, wounded, behavior, panicIntensity, ID, panic, hasTarget, speed, mouthSize, dist, posX, posY, targetX, targetY;
function Snakefish (posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix) {
super(posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix);
type = 1;
}
function initialize() {
panicIntensityDefault = 0.5;
createFishMouth();
var _local3 = 1;
while (_local3 < numSegs) {
grow();
_local3++;
}
tempScaleX = mc.seg0._xscale;
tempScaleY = mc.seg0._yscale;
sounds = new Array();
_local3 = 0;
while (_local3 < 5) {
sounds[_local3] = new Sound(_root);
sounds[_local3].loadSound(((assetPrefix + "Food-samples-") + (_local3 + 1)) + "a.mp3", false);
sounds[_local3].setVolume(0);
_local3++;
}
panicRange = Math.min(((segLength * 3) + 150) + (numSegs * segLength), 500);
}
function chooseTarget(dt, player, fish, food) {
if (wounded) {
wounded = behavior.panicMovement(dt, this, player, panicRange, panicIntensity);
} else {
if ((ID == -1) || (!panic)) {
behavior.eatAnything(this, player, fish, food, false);
} else {
behavior.eatFoodOnly(this, food, false);
}
if (!hasTarget) {
if (dist(posX, posY, targetX, targetY) < (mouthSize + speed)) {
behavior.goToRandomLocation(this);
}
}
}
}
}
Symbol 179 MovieClip [__Packages.Jellyfish] Frame 0
class Jellyfish extends Creature
{
var type, createJellyMouth, numSegs, grow, tempScaleX, mc, tempScaleY, sounds, assetPrefix, wounded, behavior, panicRange, panicIntensity, hasTarget, dist, posX, posY, targetX, targetY, ID, screenY, screenX, orient, turnSpeed, pressed, currentSpeed, speed, coward, drag, radius, segLength;
function Jellyfish (posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix) {
super(posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix);
type = 2;
}
function initialize() {
createJellyMouth();
var _local3 = 1;
while (_local3 < numSegs) {
grow();
_local3++;
}
tempScaleX = mc.seg1._xscale;
tempScaleY = mc.seg1._yscale;
sounds = new Array();
_local3 = 0;
while (_local3 < 5) {
sounds[_local3] = new Sound(_root);
sounds[_local3].loadSound(((assetPrefix + "Food-samples-") + (_local3 + 1)) + "b.mp3", false);
sounds[_local3].setVolume(0);
_local3++;
}
}
function chooseTarget(dt, player, fish, food) {
if (wounded) {
wounded = behavior.panicMovement(dt, this, player, panicRange, panicIntensity);
} else {
behavior.eatAnything(this, player, fish, food, false);
if (!hasTarget) {
if (dist(posX, posY, targetX, targetY) < mc.seg0._yscale) {
behavior.goToRandomLocation(this);
}
}
}
}
function movementUpdate(dt, camera) {
var _local8;
if (ID == -1) {
_local8 = Math.atan2((_ymouse - camera.screenY) - screenY, (_xmouse - camera.screenX) - screenX);
} else {
_local8 = Math.atan2(targetY - posY, targetX - posX);
}
var _local7 = (_local8 - orient) % (Math.PI*2);
if (_local7 <= -3.14159265358979) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local7 > Math.PI) {
orient = orient - ((turnSpeed * dt) * 30);
} else if (_local7 > 0) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local7 < 0) {
orient = orient - ((turnSpeed * dt) * 30);
}
if (ID == -1) {
if (pressed) {
currentSpeed = Math.min(speed, currentSpeed + (dt * 500));
}
currentSpeed = currentSpeed + (((speed * 0.2) - currentSpeed) * 0.05);
} else if (wounded || (coward)) {
currentSpeed = panicIntensity * speed;
} else if (((!wounded) && (!coward)) && (panicIntensity > 1)) {
currentSpeed = panicIntensity * speed;
panicIntensity = panicIntensity * (1 - (dt * 2));
if (panicIntensity <= 1) {
panicIntensity = 0;
}
} else {
currentSpeed = speed;
}
posX = posX + ((currentSpeed * Math.cos(orient)) * dt);
posY = posY + ((currentSpeed * Math.sin(orient)) * dt);
drag(mc.seg0, posX, posY);
var _local3 = 1;
while (_local3 < numSegs) {
var _local5 = mc["seg" + _local3];
var _local4 = ((-orient) / 10) + (((_local3 / (numSegs - 1)) * 2) * Math.PI);
radius = (3 + Math.sin((_root.curTime / 1000) * Math.PI)) * segLength;
drag(_local5, posX + (radius * Math.cos(_local4)), posY + (radius * Math.sin(_local4)));
_local3++;
}
}
}
Symbol 180 MovieClip [__Packages.Flockfish] Frame 0
class Flockfish extends Creature
{
var type, panicIntensityDefault, attackDist, hordeDist, cowardDist, hordeNum, panicRange, segLength, numSegs, flockDist, createJellyMouth, tempScaleX, mc, tempScaleY, sounds, assetPrefix, hasChosenTarget, wounded, behavior, panicIntensity, coward, ID, screenY, screenX, posY, targetY, posX, targetX, orient, turnSpeed, pressed, currentSpeed, speed, drag, maxSegs, curNumSegs, segTimes, segSounds, segTag, transArray, rebirth, evolveSegment, regeneration;
function Flockfish (posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix) {
super(posX, posY, numSegs, maxSegs, randEvolve, segLength, speed, turnSpeed, panic, mc, ID, prefix);
type = 3;
}
function initialize() {
panicIntensityDefault = 2.5;
attackDist = 250;
hordeDist = 200;
cowardDist = 250;
hordeNum = 1;
panicRange = Math.min(((segLength * 4) + 150) + (numSegs * segLength), 500);
flockDist = segLength * 4;
createJellyMouth();
var _local3 = 1;
while (_local3 < numSegs) {
grow();
_local3++;
}
tempScaleX = mc.seg1._xscale;
tempScaleY = mc.seg1._yscale;
sounds = new Array();
_local3 = 0;
while (_local3 < 5) {
sounds[_local3] = new Sound(_root);
sounds[_local3].loadSound(((assetPrefix + "Food-samples-") + (_local3 + 1)) + "b.mp3", false);
sounds[_local3].setVolume(0);
_local3++;
}
}
function chooseTarget(dt, player, fish, food) {
if (!hasChosenTarget) {
if (wounded) {
wounded = behavior.panicMovement(dt, this, player, panicRange, panicIntensity);
} else if (coward) {
behavior.panicMovement(dt, this, player, panicRange, panicIntensity);
}
behavior.hordeMovement(this, player, fish, food, false, attackDist, hordeDist, cowardDist, hordeNum);
}
}
function movementUpdate(dt, camera) {
var _local4;
if (ID == -1) {
_local4 = Math.atan2((_ymouse - camera.screenY) - screenY, (_xmouse - camera.screenX) - screenX);
} else {
_local4 = Math.atan2(targetY - posY, targetX - posX);
}
var _local3 = (_local4 - orient) % (Math.PI*2);
if (_local3 <= -3.14159265358979) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local3 > Math.PI) {
orient = orient - ((turnSpeed * dt) * 30);
} else if (_local3 > 0) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local3 < 0) {
orient = orient - ((turnSpeed * dt) * 30);
}
if (ID == -1) {
if (pressed) {
currentSpeed = Math.min(speed, currentSpeed + (dt * 500));
}
currentSpeed = currentSpeed + (((speed * 0.2) - currentSpeed) * 0.05);
} else if (wounded || (coward)) {
currentSpeed = panicIntensity * speed;
} else if (((!wounded) && (!coward)) && (panicIntensity > 1)) {
currentSpeed = panicIntensity * speed;
panicIntensity = panicIntensity * (1 - (dt * 2));
if (panicIntensity <= 1) {
panicIntensity = 0;
}
} else {
currentSpeed = speed;
}
posX = posX + ((currentSpeed * Math.cos(orient)) * dt);
posY = posY + ((currentSpeed * Math.sin(orient)) * dt);
drag(mc.seg0, posX, posY);
flockUpdate(dt);
}
function flockUpdate(dt) {
var _local3 = 1;
while (_local3 < numSegs) {
var _local4 = mc["seg" + _local3];
_local4.vx = _local4.vx * decay;
_local4.vy = _local4.vy * decay;
_local4._x = _local4._x + (_local4.vx * dt);
_local4._y = _local4._y + (_local4.vy * dt);
_local3++;
}
_local3 = 0;
while (_local3 < (numSegs - 1)) {
if ((_local3 == 0) || (mc["seg" + _local3].evolveState > 1)) {
var _local7 = mc["seg" + _local3];
var _local2 = 1;
while (_local2 < numSegs) {
if (mc["seg" + _local2].evolveState > 1) {
var _local6 = mc["seg" + _local2];
spring(_local7, _local6, dt);
}
_local2++;
}
}
_local3++;
}
_local3 = 0;
while (_local3 < (numSegs - 1)) {
if ((_local3 == 0) || (mc["seg" + _local3].evolveState > 1)) {
var _local7 = mc["seg" + _local3];
var _local2 = _local3 + 1;
while (_local2 < numSegs) {
if (mc["seg" + _local2].evolveState == 1) {
var _local6 = mc["seg" + _local2];
spring(_local7, _local6, dt);
} else {
_local3 = _local2 - 1;
break;
}
_local2++;
}
}
_local3++;
}
_local3 = 1;
while (_local3 < (numSegs - 1)) {
if (mc["seg" + _local3].evolveState == 1) {
var _local7 = mc["seg" + _local3];
var _local2 = _local3 + 1;
while (_local2 < numSegs) {
if (mc["seg" + _local2].evolveState == 1) {
var _local6 = mc["seg" + _local2];
spring(_local7, _local6, dt);
} else {
_local3 = _local2 - 1;
break;
}
_local2++;
}
}
_local3++;
}
}
function spring(partA, partB, dt) {
var _local3 = partB._x - partA._x;
var _local2 = partB._y - partA._y;
var _local9 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (_local9 > flockDist) {
var _local7 = ((2 * _local3) * springAmount) * dt;
var _local6 = ((2 * _local2) * springAmount) * dt;
partA.vx = partA.vx + _local7;
partA.vy = partA.vy + _local6;
partB.vx = partB.vx - _local7;
partB.vy = partB.vy - _local6;
} else if (_local9 < flockDist) {
if (_local3 >= 0) {
_local3 = flockDist - _local3;
} else {
_local3 = (-flockDist) - _local3;
}
if (_local2 >= 0) {
_local2 = flockDist - _local2;
} else {
_local2 = (-flockDist) - _local2;
}
var _local7 = (_local3 * springAmount) * dt;
var _local6 = (_local2 * springAmount) * dt;
partA.vx = partA.vx - _local7;
partA.vy = partA.vy - _local6;
partB.vx = partB.vx + _local7;
partB.vy = partB.vy + _local6;
}
}
function grow() {
if (curNumSegs <= maxSegs) {
var _local4;
_local4 = mc.attachMovie(assetPrefix + "segbody1", "seg" + curNumSegs, 99 - curNumSegs);
segTimes[curNumSegs] = 0.25;
segSounds[curNumSegs] = int(random(5));
segTag[curNumSegs] = 0;
_local4._rotation = mc["seg" + (curNumSegs - 1)]._rotation;
_local4._x = mc["seg" + (curNumSegs - 1)]._x;
_local4._y = mc["seg" + (curNumSegs - 1)]._y;
_local4.vx = 0;
_local4.vy = 0;
_local4._xscale = segLength;
_local4._yscale = segLength;
_local4.evolveState = 1;
speed = speed + (segLength * 0.5);
if (curNumSegs == numSegs) {
numSegs++;
}
curNumSegs++;
var _local6 = new flash.geom.Transform(_local4);
transArray.push(_local6);
if (curNumSegs == 64) {
rebirth();
}
if ((curNumSegs % 4) == 2) {
evolveSegment(curNumSegs - 1);
}
regeneration();
} else {
var _local5 = 0;
var _local3 = mc.seg0.evolveState;
var _local2 = 1;
while (_local2 < curNumSegs) {
if (mc["seg" + _local2].evolveState < _local3) {
_local3 = mc["seg" + _local2].evolveState;
_local5 = _local2;
}
_local2++;
}
evolveSegment(_local5);
if (_local5 == 0) {
evolveSegment(1);
}
}
}
var springAmount = 3;
var decay = 0.9;
}
Symbol 181 MovieClip [__Packages.Boss] Frame 0
class Boss extends Creature
{
var type, chargeDifficulty, boss, panicIntensityDefault, charging, updateChargeTarg, mc, segLength, posX, posY, weakLength, weakPoints, weakPointsHitC, weakPointsHit, transArray, mouthSize, wounded, behavior, panicRange, panicIntensity, tempTempMinDefault, tempMinDefault, tempMin, targetX, targetY, tempTargetX, tempTargetY, dist, hasTarget, ID, screenY, screenX, orient, turnSpeed, currentSpeed, speed, drag, numSegs, eating, tempFish, targets, tempWeak, nutrition, tempFood, panicTimer, die, dieExplosionRate, dieTimer, dieSeg, turnIntoFoodOnDeath, level, alive, clipName, eatingTimer;
function Boss (posX, posY, numSegs, segLength, speed, turnSpeed, mc, ID, prefix) {
super(posX, posY, numSegs, 1, 0, segLength, speed, turnSpeed, true, mc, ID, prefix);
type = 6;
}
function initialize() {
chargeDifficulty = 3;
boss = true;
panicIntensityDefault = 10;
charging = false;
updateChargeTarg = false;
var _local4;
_local4 = mc.attachMovie("boss1", "seg0", 99);
_local4._xscale = segLength;
_local4._yscale = segLength;
_local4._x = posX;
_local4._y = posY;
_local4.evolveState = 1;
var _local3;
weakLength = 3;
var _local2 = 0;
while (_local2 < weakLength) {
weakPoints[_local2] = _local2;
weakPointsHit[_local2] = weakPointsHitC;
_local3 = new flash.geom.Transform(mc.seg0["weakPoint" + _local2]);
transArray.push(_local3);
_local2++;
}
_local3 = new flash.geom.Transform(mc.seg0.mouth);
transArray.push(_local3);
_local3 = new flash.geom.Transform(mc.seg0.body);
transArray.push(_local3);
}
function chooseTarget(dt, player, fish, food) {
mouthSize = (mc.seg0._xscale * mc.seg0.mouth._xscale) * 0.0125;
if (wounded) {
wounded = behavior.panicMovement(dt, this, player, panicRange, panicIntensity);
if (!wounded) {
charging = true;
updateChargeTarg = true;
panicIntensity = panicIntensity * 1.5;
tempTempMinDefault = tempMinDefault;
tempMinDefault = 99999 /* 0x01869F */;
}
} else if (charging && (updateChargeTarg)) {
behavior.eatPlayerOnly(this, player, false);
if (tempMin <= (mouthSize * chargeDifficulty)) {
updateChargeTarg = false;
var _local2 = (mc.seg0._rotation * Math.PI) / 180;
targetX = targetX + ((3 * segLength) * Math.cos(_local2));
targetY = targetY + ((3 * segLength) * Math.sin(_local2));
tempTargetX = targetX;
tempTargetY = targetY;
tempMinDefault = tempTempMinDefault;
}
} else if (charging && (!updateChargeTarg)) {
behavior.eatPlayerOnly(this, player, false);
targetX = tempTargetX;
targetY = tempTargetY;
if (dist(posX, posY, targetX, targetY) <= (mouthSize * 5)) {
charging = false;
}
} else {
behavior.eatPlayerOnly(this, player, true);
if (!hasTarget) {
if (dist(posX, posY, targetX, targetY) < mouthSize) {
behavior.goToRandomLocation(this);
}
}
}
}
function movementUpdate(dt, camera) {
hasTarget = true;
var _local7;
if (ID == -1) {
_local7 = Math.atan2((_ymouse - camera.screenY) - screenY, (_xmouse - camera.screenX) - screenX);
} else {
_local7 = Math.atan2(targetY - posY, targetX - posX);
}
var _local6 = (_local7 - orient) % (Math.PI*2);
if (_local6 <= -3.14159265358979) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local6 > Math.PI) {
orient = orient - ((turnSpeed * dt) * 30);
} else if (_local6 > 0) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local6 < 0) {
orient = orient - ((turnSpeed * dt) * 30);
}
if (charging || (wounded)) {
currentSpeed = panicIntensity * speed;
} else if ((!charging) && (panicIntensity > 1)) {
currentSpeed = panicIntensity * speed;
panicIntensity = panicIntensity * (1 - dt);
} else if (hasTarget) {
currentSpeed = speed * 3;
} else {
currentSpeed = speed;
}
posX = posX + ((currentSpeed * Math.cos(orient)) * dt);
posY = posY + ((currentSpeed * Math.sin(orient)) * dt);
drag(mc.seg0, posX, posY);
var _local2 = 0;
while (_local2 < numSegs) {
var _local3 = mc["seg" + _local2];
var _local4 = mc["seg" + (_local2 + 1)];
drag(_local4, _local3._x, _local3._y);
_local2++;
}
}
function collision(food) {
if ((eating == -1) && (tempMin < mouthSize)) {
mc.seg0.mouth.gotoAndPlay(2);
if (tempFish != -2) {
targets[tempFish].wound(tempWeak);
eating = 1;
nutrition = 0.5 * (mc["seg" + tempWeak]._xscale + mc["seg" + tempWeak]._yscale);
if (targets[tempFish].ID == -1) {
_root.camera.shake(8);
}
} else {
nutrition = food[tempFood].energy;
food[tempFood].energy = 0;
eating = food[tempFood].foodType;
}
}
}
function wound(weakPointID) {
weakPointsHit[weakPointID] = 0;
var _local4 = mc.seg0["weakPoint" + weakPoints[weakPointID]];
_local4._alpha = 0;
wounded = true;
panicIntensity = panicIntensityDefault;
panicTimer = 100;
spawnBullets();
var _local3 = true;
var _local2 = 0;
while (_local2 < weakLength) {
if (weakPointsHit[_local2] != 0) {
_local3 = false;
break;
}
_local2++;
}
if (_local3) {
die();
}
}
function dieUpdate(dt) {
var _local7 = false;
dieExplosionRate = 0.1;
dieTimer = dieTimer + dt;
while ((dieTimer > dieExplosionRate) && (dieSeg < numSegs)) {
dieTimer = dieTimer - dieExplosionRate;
var _local4 = 0;
var _local3 = 0;
var _local5 = dieSeg;
while (_local5 < numSegs) {
dieSeg++;
var _local6 = mc.seg0.body["seg" + _local5];
_local4 = behavior.getBossWeakpointX(this, _local6);
_local3 = behavior.getBossWeakpointY(this, _local6);
if (_local5 != 0) {
if (turnIntoFoodOnDeath) {
_root.gameLevels[level].spawnFoodAtLocation(2, _local4, _local3, 15, 10);
}
_root.gameLevels[level].spawnEffect(0, segLength / 20, segLength / 20, 0, _local4, _local3);
} else {
if (turnIntoFoodOnDeath) {
_root.gameLevels[level].spawnFoodAtLocation(0, mc.seg0._x, mc.seg0._y, 15, 10);
}
_root.gameLevels[level].spawnEffect(0, segLength / 5, segLength / 20, 0, mc.seg0._x, mc.seg0._y);
}
_local7 = true;
_local6.removeMovieClip();
if (dieSeg >= numSegs) {
_local5 = 0;
while (_local5 < weakLength) {
_local6 = mc.seg0["weakPoint" + _local5];
_local4 = behavior.getBossWeakpointX(this, _local6);
_local3 = behavior.getBossWeakpointY(this, _local6);
_root.gameLevels[level].spawnFoodAtLocation(0, _local4, _local3, 15, 10);
_root.gameLevels[level].spawnEffect(0, segLength / 20, segLength / 20, 0, _local4, _local3);
_local5++;
}
mc.seg0.removeMovieClip();
alive = false;
_root[clipName].removeMovieClip();
}
if (_local7) {
break;
}
_local5++;
}
}
}
function spawnBullets() {
var _local7 = 0;
var _local6 = 0;
var _local5 = 1;
while (_local5 < numSegs) {
var _local3 = mc.seg0.body["seg" + _local5];
_local7 = behavior.getBossWeakpointX(this, _local3);
_local6 = behavior.getBossWeakpointY(this, _local3);
var _local4 = _root.gameLevels[level].spawnBulletAtLocation(random(4) + 2, _local7, _local6, _local3._xscale, 100, 5, 4, 0);
_local4.targetX = -targetX;
_local4.targetY = -targetY;
_local4.orient = random((Math.PI*2));
_local4.movementMode = 2;
_root.gameLevels[level].spawnEffect(0, _local3._xscale / 20, _local3._xscale / 20, 0, _local7, _local6);
_local5++;
}
}
function eatingUpdate(dt, camera) {
if (eating > -1) {
eatingTimer = eatingTimer - dt;
if (eatingTimer <= 0) {
mc.seg0.mouth.gotoAndPlay(23);
eating = -1;
eatingTimer = 1;
}
}
}
}
Symbol 182 MovieClip [__Packages.Bullet] Frame 0
class Bullet extends Creature
{
var lifeTime, turnIntoFoodOnDeath, movementMode, type, defaultColorTransTime, colorTransTime, mc, assetPrefix, segSounds, segTimes, segTag, segLength, transArray, tempScaleX, tempScaleY, sounds, soundLoops, behavior, eating, die;
function Bullet (lifeTime, posX, posY, segLength, speed, turnSpeed, mc, ID, prefix) {
super(posX, posY, 1, 1, 0, segLength, speed, turnSpeed, false, mc, ID, prefix);
this.lifeTime = lifeTime;
turnIntoFoodOnDeath = false;
movementMode = 1;
type = 5;
}
function initialize() {
defaultColorTransTime = 0.1;
colorTransTime = defaultColorTransTime;
var _local4;
_local4 = mc.attachMovie(assetPrefix + "bullet1", "seg0", 99);
segSounds[0] = int(random(6));
segTimes[0] = 0.25;
segTag[0] = 0;
_local4._xscale = segLength;
_local4._yscale = segLength;
_local4.evolveState = 1;
var _local5 = new flash.geom.Transform(_local4);
transArray.push(_local5);
tempScaleX = mc.seg0._xscale;
tempScaleY = mc.seg0._yscale;
sounds = new Array();
soundLoops = new Array();
var _local3 = 0;
while (_local3 < 5) {
sounds[_local3] = _root.sndLoader.getSound(((assetPrefix + "Food-samples-") + (_local3 + 1)) + "a");
soundLoops[_local3] = _root.sndLoader.getSound(((assetPrefix + "Food-loop-") + (_local3 + 1)) + "a");
_local3++;
}
}
function chooseTarget(dt, player, fish, food) {
if (movementMode == 1) {
} else if (movementMode == 2) {
behavior.eatPlayerOnly(this, player, false);
}
}
function grow() {
}
function eatingUpdate(dt, camera) {
if (eating > -1) {
die();
}
}
}
Symbol 183 MovieClip [__Packages.Manta] Frame 0
class Manta extends Creature
{
var type, chargeDifficulty, boss, panicIntensityDefault, charging, updateChargeTarg, mc, segLength, posX, posY, weakLength, weakPoints, weakPointsHitC, weakPointsHit, transArray, mouthSize, wounded, behavior, panicRange, panicIntensity, tempTempMinDefault, tempMinDefault, tempMin, targetX, targetY, tempTargetX, tempTargetY, dist, hasTarget, ID, screenY, screenX, orient, turnSpeed, currentSpeed, speed, drag, numSegs, eating, tempFish, targets, tempWeak, nutrition, tempFood, panicTimer, die, level, eatingTimer, dieExplosionRate, dieTimer, dieSeg, turnIntoFoodOnDeath, initializeVars, alive, clipName;
function Manta (posX, posY, numSegs, segLength, speed, turnSpeed, mc, ID, prefix) {
super(posX, posY, numSegs, 1, 0, segLength, speed, turnSpeed, true, mc, ID, prefix);
type = 4;
}
function initialize() {
chargeDifficulty = 3;
boss = true;
panicIntensityDefault = 7;
charging = false;
updateChargeTarg = false;
var _local4;
_local4 = mc.attachMovie("manta1", "seg0", 99);
trace("OK");
_local4._xscale = segLength;
_local4._yscale = segLength;
_local4._x = posX;
_local4._y = posY;
_local4.evolveState = 1;
var _local3;
weakLength = 2;
var _local2 = 0;
while (_local2 < weakLength) {
weakPoints[_local2] = _local2;
weakPointsHit[_local2] = weakPointsHitC;
_local3 = new flash.geom.Transform(mc.seg0["weakPoint" + _local2]);
transArray.push(_local3);
_local2++;
}
_local3 = new flash.geom.Transform(mc.seg0.mouth);
transArray.push(_local3);
_local3 = new flash.geom.Transform(mc.seg0.body);
transArray.push(_local3);
}
function chooseTarget(dt, player, fish, food) {
mouthSize = (mc.seg0._xscale * mc.seg0.mouth._xscale) * 0.0125;
if (wounded) {
wounded = behavior.panicMovement(dt, this, player, panicRange, panicIntensity);
if (!wounded) {
charging = true;
updateChargeTarg = true;
panicIntensity = panicIntensity * 1.5;
tempTempMinDefault = tempMinDefault;
tempMinDefault = 99999 /* 0x01869F */;
}
} else if (charging && (updateChargeTarg)) {
behavior.eatPlayerOnly(this, player, false);
if (tempMin <= (mouthSize * chargeDifficulty)) {
updateChargeTarg = false;
var _local2 = (mc.seg0._rotation * Math.PI) / 180;
targetX = targetX + ((3 * segLength) * Math.cos(_local2));
targetY = targetY + ((3 * segLength) * Math.sin(_local2));
tempTargetX = targetX;
tempTargetY = targetY;
tempMinDefault = tempTempMinDefault;
}
} else if (charging && (!updateChargeTarg)) {
behavior.eatPlayerOnly(this, player, false);
targetX = tempTargetX;
targetY = tempTargetY;
if (dist(posX, posY, targetX, targetY) <= (mouthSize * 7.5)) {
charging = false;
}
} else {
behavior.eatPlayerAndFood(this, player, food, true);
if (!hasTarget) {
if (dist(posX, posY, targetX, targetY) < mouthSize) {
behavior.goToRandomLocation(this);
}
}
}
}
function movementUpdate(dt, camera) {
hasTarget = true;
var _local7;
if (ID == -1) {
_local7 = Math.atan2((_ymouse - camera.screenY) - screenY, (_xmouse - camera.screenX) - screenX);
} else {
_local7 = Math.atan2(targetY - posY, targetX - posX);
}
var _local6 = (_local7 - orient) % (Math.PI*2);
if (_local6 <= -3.14159265358979) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local6 > Math.PI) {
orient = orient - ((turnSpeed * dt) * 30);
} else if (_local6 > 0) {
orient = orient + ((turnSpeed * dt) * 30);
} else if (_local6 < 0) {
orient = orient - ((turnSpeed * dt) * 30);
}
if (charging || (wounded)) {
currentSpeed = panicIntensity * speed;
} else if ((!charging) && (panicIntensity > 1)) {
currentSpeed = panicIntensity * speed;
panicIntensity = panicIntensity * (1 - dt);
} else if (hasTarget) {
currentSpeed = speed * 3;
} else {
currentSpeed = speed;
}
posX = posX + ((currentSpeed * Math.cos(orient)) * dt);
posY = posY + ((currentSpeed * Math.sin(orient)) * dt);
drag(mc.seg0, posX, posY);
var _local2 = 0;
while (_local2 < numSegs) {
var _local3 = mc["seg" + _local2];
var _local4 = mc["seg" + (_local2 + 1)];
drag(_local4, _local3._x, _local3._y);
_local2++;
}
}
function collision(food) {
if ((eating == -1) && (tempMin < mouthSize)) {
mc.seg0.mouth.gotoAndPlay(2);
if (tempFish != -2) {
targets[tempFish].wound(tempWeak);
eating = 1;
nutrition = 1;
if (targets[tempFish].ID == -1) {
_root.camera.shake(8);
}
} else {
nutrition = food[tempFood].nutrition;
food[tempFood].energy = 0;
food[tempFood].alive = false;
eating = food[tempFood].foodType;
}
}
}
function wound(weakPointID) {
weakPointsHit[weakPointID] = 0;
var _local4 = mc.seg0["weakPoint" + weakPoints[weakPointID]];
_local4._alpha = 0;
wounded = true;
panicIntensity = panicIntensityDefault;
panicTimer = 100;
var _local3 = true;
var _local2 = 0;
while (_local2 < weakLength) {
if (weakPointsHit[_local2] != 0) {
_local3 = false;
break;
}
_local2++;
}
if (_local3) {
die();
}
}
function spawnBullets() {
var _local7 = 0;
var _local6 = 0;
var _local5 = 0;
while (_local5 < numSegs) {
var _local3 = mc.seg0.body["seg" + (_local5 + 1)];
_local7 = behavior.getBossWeakpointX(this, _local3);
_local6 = behavior.getBossWeakpointY(this, _local3);
var _local4 = _root.gameLevels[level].spawnBulletAtLocation(random(4) + 2, _local7, _local6, _local3._xscale / 2, 75, 5, 8, 0);
_local4.targetX = -targetX;
_local4.targetY = -targetY;
_local4.orient = random((Math.PI*2));
_local4.movementMode = 2;
_root.gameLevels[level].spawnEffect(0, _local3._xscale / 40, _local3._xscale / 40, 0, _local7, _local6);
_local5++;
}
}
function eatingUpdate(dt, camera) {
if (eating > -1) {
eatingTimer = eatingTimer - dt;
if (eatingTimer <= 0) {
mc.seg0.mouth.gotoAndPlay(23);
eating = -1;
eatingTimer = 1;
}
}
}
function dieUpdate(dt) {
var _local7 = false;
dieExplosionRate = 0.1;
dieTimer = dieTimer + dt;
while ((dieTimer > dieExplosionRate) && (dieSeg < numSegs)) {
dieTimer = dieTimer - dieExplosionRate;
var _local6 = 0;
var _local5 = 0;
var _local3 = dieSeg;
while (_local3 < numSegs) {
dieSeg++;
var _local4 = mc.seg0.body["seg" + _local3];
_local6 = behavior.getBossWeakpointX(this, _local4);
_local5 = behavior.getBossWeakpointY(this, _local4);
if (_local3 != 0) {
if (turnIntoFoodOnDeath) {
_root.gameLevels[level].spawnFoodAtLocation(1, _local6, _local5, 15, 10);
}
_root.gameLevels[level].spawnEffect(0, segLength / 20, segLength / 20, 0, _local6, _local5);
} else {
if (turnIntoFoodOnDeath) {
_root.gameLevels[level].spawnFoodAtLocation(0, mc.seg0._x, mc.seg0._y, 15, 10);
}
_root.gameLevels[level].spawnEffect(0, segLength / 5, segLength / 20, 0, mc.seg0._x, mc.seg0._y);
}
_local7 = true;
_local4.removeMovieClip();
if (dieSeg >= numSegs) {
if (ID == -1) {
_root.gameLevels[level].killAllBulletFish();
initializeVars();
initialize();
} else {
mc.seg0.removeMovieClip();
alive = false;
_root[clipName].removeMovieClip();
}
}
if (_local7) {
break;
}
_local3++;
}
}
}
}
Symbol 184 MovieClip [__Packages.Billboard] Frame 0
class Billboard extends GameObject
{
var posX, posY, posZ, mc, trans, colorTrans;
function Billboard (billName, zDepth, mc) {
super();
posX = (posY = 0);
posZ = zDepth;
this.mc = mc;
var _local3;
_local3 = mc.attachMovie(billName, "seg", 0);
_local3._xscale = 100;
_local3._yscale = 100;
_local3._x = posX;
_local3._y = posY;
trans = new flash.geom.Transform(_local3);
}
function update(camera) {
posX = 0;
posY = 0;
var _local2 = mc.seg;
_local2._x = 0;
_local2._y = 0;
trans.colorTransform = colorTrans;
}
}
Symbol 185 MovieClip [__Packages.Effect] Frame 0
class Effect extends GameObject
{
var mc, posX, posY, posZ, eType, eSize, eTime, eDelay, alive, timer;
function Effect (eType, eSize, eTime, eDelay, posX, posY, posZ, mc) {
super();
this.mc = mc;
reset(eType, eSize, eTime, posX, posY, posZ);
}
function reset(eType, eSize, eTime, eDelay, posX, posY, posZ) {
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.eType = eType;
this.eSize = eSize;
this.eTime = eTime;
this.eDelay = eDelay;
alive = true;
timer = 0;
if (eType == 0) {
var _local2 = mc.attachMovie("ping", "eff", 0);
_local2._x = posX;
_local2._y = posY;
_local2._xscale = eSize * 10;
_local2._yscale = eSize * 10;
} else if (eType == 1) {
var _local2 = mc.attachMovie("pong", "eff", 0);
_local2._x = posX;
_local2._y = posY;
_local2._xscale = eSize * 10;
_local2._yscale = eSize * 10;
}
}
function update(dt, camera) {
timer = timer + dt;
if (timer > eDelay) {
if ((timer < eTime) && (alive)) {
mc.eff.gotoAndStop(int((timer / eTime) * 100));
} else {
timer = 0;
alive = false;
mc.eff.removeMovieClip();
}
}
}
}