Frame 1
if (false) {
}
Frame 2
stop();
introScreen.PlayBtn.onRollOver = function () {
if (!introScreen.PlayBtn.clicked) {
this.gotoAndPlay("Over");
introScreen.PlayBtn.clicked = false;
}
};
introScreen.PlayBtn.onRollOut = function () {
if (!introScreen.PlayBtn.clicked) {
this.gotoAndPlay("Out");
}
};
introScreen.PlayBtn.onPress = function () {
introScreen.PlayBtn.clicked = true;
this.gotoAndPlay("Click");
};
var difficulty = 1;
var firstRun = true;
_root.createEmptyMovieClip("sound", 1000);
sound.createEmptyMovieClip("death1_mc", sound.getNextHighestDepth());
sound.createEmptyMovieClip("eat1_mc", sound.getNextHighestDepth());
sound.createEmptyMovieClip("eat2_mc", sound.getNextHighestDepth());
sound.createEmptyMovieClip("spawn1_mc", sound.getNextHighestDepth());
sound.createEmptyMovieClip("spawn2_mc", sound.getNextHighestDepth());
sound.createEmptyMovieClip("wormSplit_mc", sound.getNextHighestDepth());
var snd_death1 = new Sound(sound.death1_mc);
var snd_eat1 = new Sound(sound.eat1_mc);
var snd_eat2 = new Sound(sound.eat2_mc);
var snd_spawn1 = new Sound(sound.spawn1_mc);
var snd_spawn2 = new Sound(sound.spawn2_mc);
var snd_wormSplit = new Sound(sound.wormSplit_mc);
snd_death1.attachSound("death1");
snd_eat1.attachSound("eat1");
snd_eat2.attachSound("eat2");
snd_spawn1.attachSound("spawn1");
snd_spawn2.attachSound("spawn2");
snd_wormSplit.attachSound("wormSplit");
var record = SharedObject.getLocal("record");
if (isNaN(record.data.score)) {
record.data.score = new Number();
record.data.score = 0;
record.data.eaten = new Number();
record.data.eaten = 0;
record.data.level = new Number();
record.data.level = 1;
record.data.difficulty = new Number();
record.data.difficulty = 1;
record.data.Time = new Number();
record.data.Time = 0;
record.data.Name = new String();
record.data.Name = "Munch";
record.flush();
}
Frame 11
function firstSpawn() {
if (!Paused) {
clearInterval(firstSpawn);
stage.point4.play();
}
}
function Update() {
if (!alive) {
Paused = true;
if (mDown && (!ui.diffbuttons.dragging)) {
stage._x = stage._x + (stage._xmouse - mPos.__get__X());
stage._y = stage._y + (stage._ymouse - mPos.__get__Y());
if (stage._x > 0) {
stage._x = 0;
} else if (stage._x < -640) {
stage._x = -640;
}
if (stage._y > 0) {
stage._y = 0;
} else if (stage._y < -480) {
stage._y = -480;
}
}
}
pPX = player.X;
pPY = player.Y;
mPos.__set__X(stage._xmouse);
mPos.__set__Y(stage._ymouse);
var _local1 = new Date();
nowTime = _local1.getTime();
elapsed = nowTime - lastUpdateTime;
lastUpdateTime = nowTime;
if (isNaN(elapsed)) {
return(undefined);
}
if (alive && (!Paused)) {
totalGameTime = totalGameTime + elapsed;
levelTime = levelTime + elapsed;
if (levelTime >= timePerLevel) {
levelTime = 0;
levelUp();
timePerLevel = timePerLevel + timePerLevelIncrease;
}
if (level >= redCellLevel) {
redCellTimer = redCellTimer + elapsed;
if (redCellTimer > redCellSpawnTime) {
spawnQueue.push("RedCell");
redCellTimer = 0;
resetRedCellSpawnTimer();
}
}
munchAngBase = munchAngBase + munchAngBaseRate;
}
updateHelpText();
updateMobs(elapsed);
if (!Paused) {
collide();
if (openPoints.length > 0) {
spawnNext();
}
if (munchInUse < 1) {
alive = false;
}
}
}
function updateMobs(elapsed) {
var _local3 = mobs.length;
var _local2 = 0;
while (_local2 < _local3) {
var _local1 = mobs[_local2];
if (_local1 == undefined) {
mobs.splice(_local2--, 1);
_local3--;
} else {
if ((!_local1.PC) && (_local1 instanceof Munch)) {
_local1._followAngle = (((munchAngBase + _local2) * Math.PI) * 2) / (maxMunchCount - 1);
}
_local1.Update(elapsed);
}
_local2++;
}
}
function collideEnemies() {
var _local7 = enemies.length;
var _local5 = 0;
for ( ; _local5 < _local7 ; _local5++) {
var _local1 = enemies[_local5];
if (_local1.Eating || (!_local1.Alive)) {
} else if (player.__get__Alive()) {
var _local4 = _local1.Position.Distance(player.__get__Position());
if (_local4 <= player.__get__Radius()) {
if (_local1 instanceof WormBit) {
_local1.Food = player;
_local1.EatingTime = 0;
player.StartEat();
} else {
_local1.AddMunch(player);
}
continue;
}
} else {
var _local6 = miniMunchs.length;
var _local3 = 0;
while (_local3 < _local6) {
var _local2 = miniMunchs[_local3];
if (!_local2.Alive) {
} else {
var _local4 = _local1.Position.Distance(_local2.Position);
if (_local4 <= _local2.Radius) {
if (_local1 instanceof WormBit) {
_local1.Food = _local2;
_local1.EatingTime = 0;
_local2.StartEat();
} else {
_local1.AddMunch(_local2);
}
break;
}
}
_local3++;
}
}
}
}
function collideEdibles() {
if ((!player.__get__Alive()) || (player.__get__Eating())) {
return(undefined);
}
var _local4 = edibles.length;
var _local1 = 0;
while (_local1 < _local4) {
var _local2 = edibles[_local1];
var _local3 = _local2.Position.Distance(player.__get__Position());
if (_local3 <= player.__get__Radius()) {
_local2.StartEat();
break;
}
_local1++;
}
}
function collide() {
if (!alive) {
return(undefined);
}
collideEnemies();
collideEdibles();
}
function spawnMobs() {
var _local4 = enemies.length;
var _local1 = spawnQueue.length;
if ((wormInUse <= 0) && (level >= wormLevel)) {
if (_local1 > 0) {
spawnQueue.unshift("WormBit");
} else {
spawnQueue.push("WormBit");
}
} else if (((_local4 + _local1) < mobsThisLevel) && ((_local4 + _local1) < maxEnemyCount)) {
var _local2 = Math.random();
var _local5 = false;
var _local3 = false;
_local5 = ((_local2 < wormSpawnChance) && (level >= wormLevel)) || (level < whiteCellLevel);
_local3 = ((_local2 < whiteCellSpawnChance) && (level >= whiteCellLevel)) || (level < wormLevel);
if (_local3) {
spawnQueue.push("WhiteCell");
} else if (_local5) {
spawnQueue.push("WormBit");
}
}
}
function resetRedCellSpawnTimer() {
redCellSpawnTime = (Math.random() * (maxRedCellSpawnTime - minRedCellSpawnTime)) + minRedCellSpawnTime;
}
function updateMiniTargets() {
var _local2 = miniMunchs.length;
var _local1 = 0;
while (_local1 < _local2) {
miniMunchs[_local1].TargetPos = player.Position;
_local1++;
}
}
function updateEnemyTargets() {
var _local2 = enemies.length;
var _local1 = 0;
while (_local1 < _local2) {
if (enemies[_local1] instanceof WormBit) {
enemies[_local1].TargetPos = player.Position;
}
_local1++;
}
}
function ConsumedUp(val) {
if (isNaN(val)) {
val = 1;
}
consumed = consumed + val;
ui.eaten_txt.text = commaSplit(consumed);
if (alive) {
player.Consumed = player.Consumed + val;
}
}
function PointUp(val) {
if (isNaN(val)) {
val = 1;
}
val = val + (Math.floor(level / 10) * 2);
val = Math.round(val * munchInUse);
var _local4 = points;
points = points + val;
ui.points_txt.text = commaSplit(points);
var _local2 = stage.ui.getNextHighestDepth();
var _local3 = stage.ui.attachMovie("PointUpText", "p" + _local2, _local2, {_x:player.__get__X(), _y:player.__get__Y() - 22});
_local3.value1_txt.text = (_local3.value2_txt.text = "+" + val);
if (Math.round(_local4 / pointsPerLevel) < Math.round(points / pointsPerLevel)) {
levelUp();
var _local7 = 1.5;
if ((difficulty > 2) && (level > 6)) {
mult = mult + ((difficulty - 3) / 10);
}
pointsPerLevel = pointsPerLevel + Math.round(pointsPerLevel * mult);
}
}
function levelUp() {
level++;
if ((level > 2) || (difficulty > 1)) {
var _local3 = mobsThisLevel;
mobsThisLevel = mobsThisLevel + mobsPrevLevel;
mobsPrevLevel = _local3;
}
ui.level_txt.text = commaSplit(level);
if (difficulty <= 1) {
mobsThisLevel = Math.min(mobsThisLevel, 5);
} else if (difficulty == 2) {
mobsThisLevel = Math.min(mobsThisLevel, 7);
}
var _local1 = stage.ui.getNextHighestDepth();
var _local2 = stage.ui.attachMovie("LevelUpText", "l" + _local1, _local1, {_x:player.__get__X(), _y:player.__get__Y() + 22, _xscale:130, _yscale:130});
_local2.value1_txt.text = (_local2.value2_txt.text = ("Level " + level) + "!");
spawnMobs();
}
function spawnMunch(X, Y) {
if (munchInUse >= maxMunchCount) {
return(Void);
}
if (isNaN(X)) {
if (alive) {
X = player.X;
} else {
X = mPos.X;
}
}
if (isNaN(Y)) {
if (alive) {
Y = player.Y;
} else {
Y = mPos.Y;
}
}
stage.munchs.attachMovie("MunchClip", "munch" + munchCount, stage.munchs.getNextHighestDepth(), {_x:X, _y:Y});
if (!player.__get__Alive()) {
player.__set__PC(false);
}
return(stage.munchs["munch" + (munchCount++)]);
}
function spawnMob(id, X, Y) {
if (mobInUse >= maxMobCount) {
return(Void);
}
if (isNaN(X) || (isNaN(Y))) {
var _local3 = 0;
do {
X = Math.random() * stageSize.__get__X();
Y = Math.random() * stageSize.__get__Y();
_local3++;
} while ((_local3 < 5) && (player.__get__Position().Distance(new Vector2(X, Y)) < 100));
}
var _local4 = stage.mobs.getNextHighestDepth();
var _local5 = stage.mobs.attachMovie(id + "Clip", "mob" + _local4, _local4, {_x:X, _y:Y});
mobCount++;
return(_local5);
}
function spawnWorm(bits, X, Y) {
if (isNaN(bits)) {
bits = Math.ceil(Math.random() * maxWormLength);
}
if (difficulty <= 1) {
bits = Math.max(bits, 6);
}
bits = Math.max(2, Math.min(bits, Math.min(maxMobCount - mobInUse, maxWormLength)));
if ((mobInUse + bits) >= maxMobCount) {
return(Void);
}
var _local2 = spawnMob("WormBit", X, Y);
bits--;
_local2.AddBits(bits);
_local2.Type = 0;
snd_eat2.start();
return(_local2);
}
function spawnWhiteCell(X, Y) {
if (mobInUse >= maxMobCount) {
return(Void);
}
var _local1 = spawnMob("WhiteCell", X, Y);
snd_eat2.start();
return(_local1);
}
function spawnRedCell(X, Y) {
if (redCellInUse > 0) {
return(Void);
}
var _local1 = spawnMob("RedCell", X, Y);
snd_eat2.start();
RedCell = _local1;
return(_local1);
}
function pointClosed(point) {
var _local2 = openPoints.length;
var _local1 = 0;
while (_local1 < _local2) {
if (openPoints[_local1]._name == point._name) {
openPoints.splice(_local1, 1);
break;
}
_local1++;
}
}
function pointOpen(point) {
openPoints.push(point);
}
function spawnNext() {
if (Paused) {
return(undefined);
}
if (spawnQueue.length > 0) {
var _local1 = openPoints[0];
openPoints.splice(0, 1);
switch (spawnQueue[0]) {
case "RedCell" :
spawnRedCell(_local1._x, _local1._y);
break;
case "WhiteCell" :
spawnWhiteCell(_local1._x, _local1._y);
break;
case "WormBit" :
spawnWorm(undefined, _local1._x, _local1._y);
}
spawnQueue.splice(0, 1);
}
}
function getPointWait() {
return(Math.round((Math.random() * (maxPointWait - minPointWait)) + minPointWait));
}
function updateHelpText() {
if (difficulty > 1) {
return(undefined);
}
if (Paused && (!pauseType)) {
return(undefined);
}
helpTime = helpTime + elapsed;
if (helpNum != -1) {
if (helpOn) {
if (helpTime >= helpTimes[helpNum][1]) {
hideHelp(helpNum);
}
} else if (helpTime >= helpTimes[helpNum][0]) {
showHelp(helpNum);
}
}
}
function showHelp(id) {
if (!alive) {
return(undefined);
}
if (isNaN(id)) {
id = helpNum;
}
var _local2 = ui.getNextHighestDepth();
ui.attachMovie("HelpInfo" + id, "HelpInfo" + id, _local2, {_x:0, _y:0});
helpTime = 0;
helpOn = true;
if (!Paused) {
pauseType = true;
}
Paused = true;
}
function hideHelp(id) {
ui["HelpInfo" + id].removeMovieClip();
helpTime = 0;
helpOn = false;
if ((++helpNum) > maxAutoHelpNum) {
helpNum = -1;
}
if (pauseType) {
Paused = false;
}
}
function onBlueWorm(wormClip) {
if ((blueWormHelpShown || (difficulty > 1)) || (helpNum != -1)) {
return(undefined);
}
helpTime = 0;
helpNum = 5;
blueWormHelpShown = true;
}
function onShortWorm(wormClip) {
if ((shortWormHelpShown || (difficulty > 1)) || (helpNum != -1)) {
return(undefined);
}
helpTime = 0;
helpNum = 3;
shortWormHelpShown = true;
}
function onWhiteCell(eClip) {
if ((whiteCellHelpShown || (difficulty > 1)) || (helpNum != -1)) {
return(undefined);
}
helpTime = 0;
helpNum = 6;
whiteCellHelpShown = true;
}
function onRedCell(eClip) {
if ((redCellHelpShown || (difficulty > 1)) || (helpNum != -1)) {
return(undefined);
}
helpTime = 0;
helpNum = 7;
redCellHelpShown = true;
}
function drawCircle(targetClip, X, Y, radius, color, thick) {
if (targetClip == undefined) {
targetClip = _root;
}
if (isNaN(X)) {
X = 0;
}
if (isNaN(Y)) {
Y = 0;
}
if (isNaN(radius)) {
radius = 32;
}
if (isNaN(color)) {
color = 16711935 /* 0xFF00FF */;
}
if (isNaN(thick)) {
thick = 3;
}
targetClip.lineStyle(thick, color, 100);
targetClip.moveTo(X + radius, Y);
var _local7 = 0.261799387799149;
var _local2 = 0;
while (_local2 < (Math.PI*2)) {
targetClip.lineTo(X + (Math.cos(_local2) * radius), Y + (Math.sin(_local2) * radius));
_local2 = _local2 + _local7;
}
targetClip.lineTo(X + radius, Y);
}
function createUICircle(parentClip, X, Y, radius, color, thick) {
if (targetClip == undefined) {
targetClip = _root;
}
if (isNaN(X)) {
X = 0;
}
if (isNaN(Y)) {
Y = 0;
}
if (isNaN(radius)) {
radius = 32;
}
if (isNaN(color)) {
color = 16711935 /* 0xFF00FF */;
}
if (isNaN(thick)) {
thick = 3;
}
var _local7 = parentClip.getNextHighestDepth();
var _local3 = parentClip.createEmptyMovieClip("uiCircle" + _local7, _local7);
_local3.createEmptyMovieClip("lines", 0);
_local3._x = X;
_local3._y = Y;
_root.drawCircle(_local3, 0, 0, radius, color, thick);
_local3.Radius = radius;
_local3.Clear = function () {
this.lines.clear();
};
_local3.DrawLine = function (X, Y, color, thick) {
var _local2 = Math.atan2(Y, X);
var _local4 = Math.cos(_local2) * this.Radius;
var _local3 = Math.sin(_local2) * this.Radius;
this.lines.lineStyle(thick, color, 100);
this.lines.moveTo(_local4, _local3);
this.lines.lineTo(X, Y);
};
return(_local3);
}
function checkHighScore() {
var _local1 = (points > record.data.score) || (record.data.Time == 0);
if (_local1) {
enterNewHighScore();
}
return(_local1);
}
function enterNewHighScore() {
ui.attachMovie("NameEntry", "nameEntry", ui.getNextHighestDepth(), {_x:320, _y:240});
}
function onEnterFrame() {
Update();
AlexUpdate();
}
function onAliveChanged(prop, oldVal, newVal) {
if (oldVal && (!newVal)) {
checkHighScore();
}
return(newVal);
}
function onMobInUseChanged(prop, oldVal, newVal) {
if (newVal < oldVal) {
spawnMobs();
}
return(newVal);
}
function dotProd(x1, y1, x2, y2) {
return((x1 * x2) + (y1 * y2));
}
function commaSplit(str) {
str = str.toString();
var _local2 = str.split("");
var _local1 = _local2.length - 3;
while (_local1 > 0) {
if (_local2[_local1 - 1] != "-") {
_local2.splice(_local1, 0, ",");
}
_local1 = _local1 - 3;
}
return(_local2.join(""));
}
function timeFormat(t) {
var _local1 = Math.round(t / 1000);
var _local2 = Math.floor(_local1 / 60);
_local1 = _local1 - (_local2 * 60);
return(((_local2 + " min ") + _local1) + " sec");
}
_root.attachMovie("Body", "stage", 0);
stage.createEmptyMovieClip("munchs", 1);
stage.createEmptyMovieClip("food", 2);
stage.createEmptyMovieClip("mobs", 3);
stage.createEmptyMovieClip("ui", 100);
_root.attachMovie("UI", "ui", 100);
var Paused = false;
var player;
var RedCell;
var munchCount = 0;
var munchInUse = 0;
var mobCount = 0;
var mobInUse = 0;
var wormInUse = 0;
var whiteCellInUse = 0;
var redCellInUse = 0;
var maxMunchCount = 20;
var maxEnemyCount = 10;
var maxMobCount = 40;
var maxRedCellCount = 1;
var maxWormLength = 17;
var munchAngBase = 0;
var munchAngBaseRate = 0.392699081698724;
var lastUpdateTime;
var elapsed;
var nowTime;
var mPos = new Vector2(0, 0);
var stageSize = new Vector2(1280, 960);
var alive = false;
var prevAlive = false;
var consumed = 0;
var points = 0;
var pPX = 0;
var pPY = 0;
var mDown = false;
var enemies = new Array();
var miniMunchs = new Array();
var edibles = new Array();
var mobs = new Array();
var totalGameTime = 0;
var levelTime = 0;
var timePerLevel = 60000;
var timePerLevelIncrease = 30000;
var pointsPerLevel = 250;
var consumedPerLevel = 50;
var level = 1;
var mobsThisLevel = 1;
var mobsPrevLevel = 1;
var wormLevel = 0;
var whiteCellLevel = 4;
var redCellLevel = 5;
var wormSpawnChance = 0.6;
var whiteCellSpawnChance = 0.25;
var redCellTimer = 0;
var redCellSpawnTime;
var minRedCellSpawnTime = ((30 - (difficulty * 3)) * 1000);
var maxRedCellSpawnTime = ((60 - (difficulty * 8)) * 1000);
resetRedCellSpawnTimer();
var openPoints = new Array();
var minPointWait = ((7 - difficulty) * 1000);
var maxPointWait = ((17 - difficulty) * 1000);
var spawnQueue = new Array();
var helpTime = 0;
var helpNum = 0;
var helpOn = false;
var pauseType = false;
var maxAutoHelpNum = 2;
var helpTimes = new Array();
helpTimes.push(new Array(2));
helpTimes[0][0] = 100;
helpTimes[0][1] = 8000;
helpTimes.push(new Array(2));
helpTimes[1][0] = 1000;
helpTimes[1][1] = 8000;
helpTimes.push(new Array(2));
helpTimes[2][0] = 1000;
helpTimes[2][1] = 8000;
helpTimes.push(new Array(2));
helpTimes[3][0] = 1500;
helpTimes[3][1] = 10000;
helpTimes.push(new Array(2));
helpTimes.push(new Array(2));
helpTimes[5][0] = 5000;
helpTimes[5][1] = 10000;
helpTimes.push(new Array(2));
helpTimes[6][0] = 1000;
helpTimes[6][1] = 10000;
helpTimes.push(new Array(2));
helpTimes[7][0] = 500;
helpTimes[7][1] = 10000;
var helpListener = new Object();
var blueWormHelpShown = false;
var shortWormHelpShown = false;
var whiteCellHelpShown = false;
var redCellHelpShown = false;
var enteringNewHighScore = false;
var difficultyText = new Array(6);
difficultyText[0] = "Invalid";
difficultyText[1] = "Easy";
difficultyText[2] = "Medium";
difficultyText[3] = "Hard";
difficultyText[4] = "Insane";
difficultyText[5] = "Psycho";
difficulty = Math.max(1, Math.min(difficulty, 5));
if (difficulty == 1) {
whiteCellLevel++;
redCellLevel++;
}
ui.points_txt.text = 0;
ui.eaten_txt.text = 0;
ui.level_txt.text = level;
ui.difficulty_txt.text = difficultyText[difficulty].toUpperCase();
spawnMunch(320, 240);
spawnMobs();
var firstSpawn;
firstSpawn = setInterval(firstSpawn, 400);
var mListener = new Object();
mListener.onMouseDown = function () {
mDown = true;
if (alive) {
Paused = !Paused;
pauseType = false;
}
};
mListener.onMouseUp = function () {
mDown = false;
};
if (firstRun) {
Mouse.addListener(mListener);
}
_root.watch("alive", onAliveChanged);
_root.watch("mobInUse", onMobInUseChanged);
firstRun = false;
Frame 12
function AlexUpdate() {
var _local2 = player.X - pPX;
var _local1 = player.Y - pPY;
if (_local2 > 0) {
if (((640 - player.X) - stage._x) < xScrollDist) {
var _local3 = stage._x;
stage._x = stage._x - _local2;
if (stage._x < ((stageSize.X / 2) * -1)) {
stage._x = (stageSize.X / 2) * -1;
}
_local3 = stage._x - _local3;
}
} else if (_local2 < 0) {
if ((player.X + stage._x) < xScrollDist) {
var _local3 = stage._x;
stage._x = stage._x - _local2;
if (stage._x > 0) {
stage._x = 0;
}
_local3 = stage._x - _local3;
}
}
if (_local1 > 0) {
if (((480 - player.Y) - stage._y) < yScrollDist) {
var _local3 = stage._y;
stage._y = stage._y - _local1;
if (stage._y < ((stageSize.Y / 2) * -1)) {
stage._y = (stageSize.Y / 2) * -1;
}
_local3 = stage._y - _local3;
}
} else if (_local1 < 0) {
if ((player.Y + stage._y) < yScrollDist) {
var _local3 = stage._y;
stage._y = stage._y - _local1;
if (stage._y > 0) {
stage._y = 0;
}
_local3 = stage._y - _local3;
}
}
}
var xScrollDist = 150;
var yScrollDist = 100;
Frame 13
stop();
Symbol 17 MovieClip [DifficultyBar] Frame 101
stop();
diff = 1;
Symbol 17 MovieClip [DifficultyBar] Frame 120
stop();
diff = 2;
Symbol 17 MovieClip [DifficultyBar] Frame 140
stop();
diff = 3;
Symbol 17 MovieClip [DifficultyBar] Frame 160
stop();
diff = 4;
Symbol 17 MovieClip [DifficultyBar] Frame 180
stop();
diff = 5;
Symbol 19 MovieClip [MunchDeath] Frame 1
function onEnterFrame() {
scale = scale + scaleRate;
alpha = alpha + alphaRate;
if ((scale <= 1) || (alpha <= 0)) {
this.removeMovieClip();
}
_yscale = scale;
_xscale = scale;
_alpha = alpha;
}
stop();
if (isNaN(scale)) {
var scale = 80;
}
if (isNaN(alpha)) {
var alpha = 60;
}
if (isNaN(scaleRate)) {
var scaleRate = 2;
}
if (isNaN(alphaRate)) {
var alphaRate = -8;
}
Symbol 25 MovieClip [RedCellClip] Frame 1
#initclip 10
Object.registerClass("RedCellClip", RedCell);
#endinitclip
Symbol 29 MovieClip [Border] Frame 1
stop();
Symbol 29 MovieClip [Border] Frame 5
stop();
Symbol 59 MovieClip [WhiteCellClip] Frame 1
#initclip 7
Object.registerClass("WhiteCellClip", WhiteCell);
#endinitclip
function onEnterFrame() {
tint_mc._alpha = tint;
if (_currentframe < 10) {
var _local1 = _currentframe / 10;
tint_mc._xscale = (tint_mc._yscale = s1 + ((s2 - s1) * _local1));
} else {
var _local1 = (_currentframe - 10) / 8;
tint_mc._xscale = (tint_mc._yscale = s2 + ((s3 - s2) * _local1));
}
}
var s1 = 100;
var s2 = 109.9;
var s3 = 101.4;
Symbol 59 MovieClip [WhiteCellClip] Frame 18
gotoAndPlay (1);
Symbol 59 MovieClip [WhiteCellClip] Frame 35
Remove();
Symbol 83 MovieClip [PlayTxt] Frame 40
stop();
Symbol 83 MovieClip [PlayTxt] Frame 80
this.gotoAndStop();
Symbol 101 MovieClip [BreathingBody] Frame 17
this.gotoAndPlay(0);
Symbol 194 MovieClip [PlayBtn] Frame 1
stop();
MunchPlayBtn.gotoAndStop("breathing");
Symbol 194 MovieClip [PlayBtn] Frame 10
stop();
this.PlayTxt._visible = false;
this.MunchPlayBtn.gotoAndPlay(1);
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe == 24) {
this.MunchPlayBtn.stop();
this.PlayTxt._visible = true;
if ((this.PlayTxt._currentframe == 1) || (this.PlayTxt._currentframe == 80)) {
this.PlayTxt.gotoAndPlay(2);
delete this.onEnterFrame;
}
}
};
Symbol 194 MovieClip [PlayBtn] Frame 20
stop();
this.onEnterFrame = function () {
if (this.PlayTxt._currentframe == 40) {
this.PlayTxt.gotoAndPlay("Close");
}
if (this.PlayTxt._currentframe == 80) {
if (this.MunchPlayBtn._currentframe == 24) {
this.MunchPlayBtn.gotoAndPlay(25);
this.PlayTxt._visible = false;
this.PlayTxt.stop();
}
if (this.MunchPlayBtn._currentframe == 50) {
this.MunchPlayBtn.gotoAndStop("Start");
PlayBtn.gotoAndStop("Wait");
delete this.onEnterFrame;
}
}
};
Symbol 194 MovieClip [PlayBtn] Frame 30
stop();
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe == 15) {
this.MunchPlayBtn.stop();
_root.gotoAndPlay("game");
}
};
Symbol 227 MovieClip Frame 1
function onEnterFrame() {
if (_root.Paused) {
Stopped = true;
stop();
return(undefined);
}
if (Stopped) {
Stopped = false;
if (_currentframe > 1) {
play();
}
}
if (!isNaN(_root.elapsed)) {
closedTime = closedTime + _root.elapsed;
}
if ((closedTime > nextOpenTime) && (_currentframe == 1)) {
play();
}
}
stop();
_root.pointClosed(this);
var nextOpenTime = _root.getPointWait();
var closedTime = 0;
var Stopped = false;
Symbol 227 MovieClip Frame 19
_root.pointOpen(this);
Symbol 227 MovieClip Frame 33
_root.pointClosed(this);
Symbol 256 MovieClip [MunchClip] Frame 1
#initclip 8
Object.registerClass("MunchClip", Munch);
#endinitclip
stop();
Symbol 256 MovieClip [MunchClip] Frame 52
stop();
Symbol 256 MovieClip [MunchClip] Frame 80
stop();
function onEnterFrame() {
if (_root.player._name == this._name) {
miniShadow._visible = false;
} else {
miniShadow._visible = true;
}
}
miniShadow._alpha = 50;
Symbol 263 MovieClip [WormBitClip] Frame 1
#initclip 9
Object.registerClass("WormBitClip", WormBit);
#endinitclip
Symbol 267 MovieClip [LevelUpText] Frame 1
function onEnterFrame() {
if (!_root.Paused) {
scale = scale + scaleRate;
alpha = alpha + alphaRate;
}
if ((scale <= 1) || (alpha <= 0)) {
this.removeMovieClip();
}
_yscale = scale;
_xscale = scale;
_alpha = alpha;
}
var scale = 120;
var alpha = 100;
var scaleRate = 0;
var alphaRate = -4;
Symbol 270 MovieClip [PointUpText] Frame 1
function onEnterFrame() {
if (!_root.Paused) {
scale = scale + scaleRate;
alpha = alpha + alphaRate;
}
if ((scale <= 1) || (alpha <= 0)) {
this.removeMovieClip();
}
_yscale = scale;
_xscale = scale;
_alpha = alpha;
}
var scale = 80;
var alpha = 100;
var scaleRate = 0;
var alphaRate = -4;
Symbol 275 MovieClip [HelpInfo0] Frame 1
function onEnterFrame() {
lines.clear();
playerX = _root.player.X + _root.stage._x;
playerY = _root.player.Y + _root.stage._y;
if (Math.abs(playerY - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
var _local3 = helpmc._y;
if (helpmc._y < 240) {
_local3 = _local3 + helpmc._height;
}
munchCircle._x = playerX;
munchCircle._y = playerY;
munchCircle.Clear();
munchCircle.DrawLine(munchTextX - playerX, _local3 - playerY, munchColor, 3);
cursorX = _root._xmouse + 5;
cursorY = _root._ymouse + 7;
var _local2 = helpmc._y;
if (cursorY > _local2) {
_local2 = _local2 + helpmc._height;
if (cursorY < _local2) {
_local2 = cursorY;
}
}
cursorCircle._x = cursorX;
cursorCircle._y = cursorY;
cursorCircle.Clear();
cursorCircle.DrawLine(cursorTextX - cursorX, _local2 - cursorY, cursorColor, 3);
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
var munchTextX = 46;
var cursorTextX = 259;
var wormsTextX = 464;
var munchColor = 3781992;
var cursorColor = 2236962;
var wormColor = 7372289;
var playerX = (_root.player.X + _root.stage._x);
var playerY = (_root.player.Y + _root.stage._y);
var cursorX = (_root._xmouse + 5);
var cursorY = (_root._ymouse + 7);
var munchCircle = _root.createUICircle(this, playerX, playerY, 40, munchColor, 3);
var cursorCircle = _root.createUICircle(this, cursorX, cursorY, 25, cursorColor, 3);
Symbol 279 MovieClip [HelpInfo3] Frame 1
function onEnterFrame() {
var _local2 = _root.player.Y + _root.stage._y;
if (Math.abs(_local2 - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
Symbol 283 MovieClip [HelpInfo7] Frame 1
function onEnterFrame() {
var _local3 = _root.player.Y + _root.stage._y;
if (Math.abs(_local3 - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
if (cell == undefined) {
cellCircle.removeMovieClip();
} else {
cellX = cell.X + _root.stage._x;
cellY = cell.Y + _root.stage._y;
var _local2 = helpmc._y;
if (cellY > _local2) {
_local2 = _local2 + helpmc._height;
if (cellY < _local2) {
_local2 = cellY;
}
}
cellCircle._x = cellX;
cellCircle._y = cellY;
cellCircle.Clear();
cellCircle.DrawLine(cellTextX - cellX, _local2 - cellY, cellColor, 3);
}
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
var cellTextX = 79;
var cellColor = 6561208;
var cRadius = 34;
var cell = _root.RedCell;
var cellX = (cell.X + _root.stage._x);
var cellY = (cell.Y + _root.stage._y);
var cellCircle = _root.createUICircle(this, cellX, cellY, cRadius, cellColor, 3);
Symbol 287 MovieClip [HelpInfo6] Frame 1
function onEnterFrame() {
var _local3 = _root.player.Y + _root.stage._y;
if (Math.abs(_local3 - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
if (cell == undefined) {
cellCircle.removeMovieClip();
} else {
cellX = cell.X + _root.stage._x;
cellY = cell.Y + _root.stage._y;
var _local2 = helpmc._y;
if (cellY > _local2) {
_local2 = _local2 + helpmc._height;
if (cellY < _local2) {
_local2 = cellY;
}
}
cellCircle._x = cellX;
cellCircle._y = cellY;
cellCircle.Clear();
cellCircle.DrawLine(cellTextX - cellX, _local2 - cellY, cellColor, 3);
}
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
var cellTextX = 79;
var cellColor = 12171705;
var cRadius = 34;
var cell;
var i = 0;
while (i < _root.enemies.length) {
if (_root.enemies[i] instanceof WhiteCell) {
cell = _root.enemies[i];
break;
}
i++;
}
var cellX = (cell.X + _root.stage._x);
var cellY = (cell.Y + _root.stage._y);
var cellCircle = _root.createUICircle(this, cellX, cellY, cRadius, cellColor, 3);
Symbol 290 MovieClip [HelpInfo5] Frame 1
function onEnterFrame() {
var _local3 = _root.player.Y + _root.stage._y;
if (Math.abs(_local3 - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
if (worm == undefined) {
wormCircle.removeMovieClip();
} else {
wormX = worm.X + _root.stage._x;
wormY = worm.Y + _root.stage._y;
var _local2 = helpmc._y;
if (wormY > _local2) {
_local2 = _local2 + helpmc._height;
if (wormY < _local2) {
_local2 = wormY;
}
}
wormCircle._x = wormX;
wormCircle._y = wormY;
wormCircle.Clear();
wormCircle.DrawLine(wormTextX - wormX, _local2 - wormY, wormColor, 3);
}
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
var wormTextX = 184;
var wormColor = 1597182;
var worm;
var i = 0;
while (i < _root.enemies.length) {
if ((_root.enemies[i].Fed && (_root.enemies[i].Type == 0)) && (_root.enemies[i] instanceof WormBit)) {
worm = _root.enemies[i];
break;
}
i++;
}
var wormX = (worm.X + _root.stage._x);
var wormY = (worm.Y + _root.stage._y);
var wormCircle = _root.createUICircle(this, wormX, wormY, 20, wormColor, 3);
Symbol 294 MovieClip [HelpInfo2] Frame 1
function onEnterFrame() {
playerX = _root.player.X + _root.stage._x;
playerY = _root.player.Y + _root.stage._y;
if (Math.abs(playerY - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
var _local12 = helpmc._y;
if (helpmc._y < 240) {
_local12 = _local12 + helpmc._height;
}
eTargX = 0;
eTargY = 0;
var _local10 = _root.edibles.length;
var _local9;
var _local7;
var _local8;
var _local6;
var _local4 = 0;
while (_local4 < _local10) {
var _local5 = _root.edibles[_local4];
var _local3 = _local5._x + _root.stage._x;
var _local2 = _local5._y + _root.stage._y;
eTargX = eTargX + _local3;
eTargY = eTargY + _local2;
if ((_local3 < _local9) || (_local9 == undefined)) {
_local9 = _local3;
}
if ((_local3 > _local7) || (_local7 == undefined)) {
_local7 = _local3;
}
if ((_local2 < _local8) || (_local8 == undefined)) {
_local8 = _local2;
}
if ((_local2 > _local6) || (_local6 == undefined)) {
_local6 = _local2;
}
_local4++;
}
eTargX = eTargX / _local10;
eTargY = eTargY / _local10;
var _local15 = Math.max(15, Math.round(Math.max(Math.abs(_local7 - _local9), Math.abs(_local6 - _local8)) / 2));
var _local11 = helpmc._y;
if (eTargY > _local11) {
_local11 = _local11 + helpmc._height;
if (eTargY < _local11) {
_local11 = eTargY;
}
}
wormCircles[0].removeMovieClip();
wormCircles = new Array();
wormCircles.push(_root.createUICircle(uicircles, eTargX, eTargY, _local15, wormColor, 3));
wormCircles[0].DrawLine(wormsTextX - eTargX, _local11 - eTargY, wormColor, 3);
var _local14 = _root.player.X + _root.stage._x;
var _local13 = _root.player.Y + _root.stage._y;
playerCircle._x = _local14;
playerCircle._y = _local13;
playerCircle.Clear();
playerCircle.DrawLine(munchTextX - _local14, _local12 - _local13, munchColor, 3);
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
var munchTextX = 37;
var wormsTextX = 280;
var munchColor = 3781992;
var wormColor = 7372289;
var playerX = (_root.player.X + _root.stage._x);
var playerY = (_root.player.Y + _root.stage._y);
this.createEmptyMovieClip("uicircles", 0);
var playerCircle = _root.createUICircle(uicircles, targX, targY, 40, munchColor, 3);
var wormCircles = new Array();
Symbol 298 MovieClip [HelpInfo1] Frame 1
function onEnterFrame() {
var _local13 = _root.player.X + _root.stage._x;
var _local12 = _root.player.Y + _root.stage._y;
if (Math.abs(_local12 - targY) < 50) {
if (targY == textY1) {
targY = textY2;
} else {
targY = textY1;
}
}
helpmc._y = helpmc._y + ((targY - helpmc._y) * 0.2);
if (Math.abs(targY - helpmc._y) < 1) {
helpmc._y = targY;
}
var _local11 = helpmc._y;
if (helpmc._y < 240) {
_local11 = _local11 + helpmc._height;
}
var _local8 = _root.enemies.length;
var _local7 = 0;
while (_local7 < _local8) {
var _local10 = _root.enemies[_local7];
var _local4 = _local10.X + _root.stage._x;
var _local2 = _local10.Y + _root.stage._y;
var _local3 = helpmc._y;
if (_local2 > _local3) {
_local3 = _local3 + helpmc._height;
if (_local2 < _local3) {
_local3 = _local2;
}
}
if (wormCircles[_local7] != undefined) {
wormCircles[_local7]._x = _local4;
wormCircles[_local7]._y = _local2;
wormCircles[_local7].Clear();
wormCircles[_local7].DrawLine(wormsTextX - _local4, _local3 - _local2, wormColor, 3);
} else {
wormCircles.push(_root.createUICircle(UICircles, _local4, _local2, 20, wormColor, 3));
wormCircles[wormCircles.length - 1].DrawLine(wormsTextX - _local4, _local3 - _local2, wormColor, 3);
}
_local7++;
}
_local7 = _local8;
while (_local7 < wormCircles.length) {
wormCircles[_local7].removeMovieClip();
wormCircles.splice(_local7, 1);
_local7++;
}
_local8 = _root.miniMunchs.length;
_local7 = 0;
while (_local7 < _local8) {
var _local9 = _root.miniMunchs[_local7];
var _local6 = _local9.X + _root.stage._x;
var _local5 = _local9.Y + _root.stage._y;
if (munchCircles[_local7] != undefined) {
munchCircles[_local7]._x = _local6;
munchCircles[_local7]._y = _local5;
munchCircles[_local7].Clear();
munchCircles[_local7].DrawLine(munchTextX - _local6, _local11 - _local5, munchColor, 3);
} else {
munchCircles.push(_root.createUICircle(UICircles, _local6, _local5, 30, munchColor, 3));
munchCircles[munchCircles.length - 1].DrawLine(munchTextX - _local6, _local11 - _local5, munchColor, 3);
}
_local7++;
}
_local7 = _local8;
while (_local7 < munchCircles.length) {
munchCircles[_local7].removeMovieClip();
munchCircles.splice(_local7, 1);
_local7++;
}
if (playerCircle != undefined) {
playerCircle._x = _local13;
playerCircle._y = _local12;
playerCircle.Clear();
playerCircle.DrawLine(munchTextX - _local13, _local11 - _local12, munchColor, 3);
} else {
playerCircle = _root.createUICircle(UICircles, _local13, _local12, 40, munchColor, 3);
playerCircle.DrawLine(munchTextX - _local13, _local11 - _local12, munchColor, 3);
}
}
stop();
var textY1 = 170;
var textY2 = 340;
var targY = textY1;
var wormsTextX = 39;
var munchTextX = 200;
var wormColor = 7372289;
var munchColor = 3781992;
var wormCircles = new Array();
var munchCircles = new Array();
var playerCircle;
this.createEmptyMovieClip("UICircles", 0);
Symbol 316 MovieClip [BreathingBody] Frame 17
this.gotoAndPlay(0);
Symbol 372 MovieClip [PlayTxt] Frame 40
stop();
Symbol 372 MovieClip [PlayTxt] Frame 80
stop();
Symbol 402 MovieClip [PlayBtn] Frame 1
stop();
MunchPlayBtn.gotoAndStop("breathing");
Symbol 402 MovieClip [PlayBtn] Frame 10
stop();
increment = 3;
this.PlayTxt._visible = false;
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe < 24) {
this.MunchPlayBtn.gotoAndStop(this.MunchPlayBtn._currentframe + increment);
this.PlayTxt.gotoAndStop(1);
}
if (this.MunchPlayBtn._currentframe >= 24) {
this.MunchPlayBtn.gotoAndStop(24);
this.PlayTxt._visible = true;
if (this.PlayTxt._currentframe >= 1) {
if (this.PlayTxt._currentframe == 40) {
this.PlayTxt.gotoAndStop(40);
delete this.onEnterFrame;
}
if (this.PlayTxt._currentframe < 40) {
this.PlayTxt.gotoAndStop(this.PlayTxt._currentframe + increment);
}
if (this.PlayTxt._currentframe > 40) {
this.PlayTxt.gotoAndStop(this.PlayTxt._currentframe - increment);
}
}
}
};
Symbol 402 MovieClip [PlayBtn] Frame 20
stop();
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe < 24) {
this.MunchPlayBtn.gotoAndStop(this.MunchPlayBtn._currentframe + increment);
}
if ((this.PlayTxt._currentframe >= 80) || (this.PlayTxt._visible == false)) {
if (this.MunchPlayBtn._currentframe >= 24) {
if (this.MunchPlayBtn._currentframe < 50) {
this.MunchPlayBtn.gotoAndStop(this.MunchPlayBtn._currentframe + increment);
this.PlayTxt._visible = false;
this.PlayTxt.stop();
} else {
this.MunchPlayBtn.gotoAndStop("Start");
delete this.onEnterFrame;
}
}
} else {
this.PlayTxt.gotoAndStop(this.PlayTxt._currentframe + increment);
}
};
Symbol 402 MovieClip [PlayBtn] Frame 30
stop();
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe == 15) {
this.MunchPlayBtn.stop();
_root.gotoAndPlay("game");
}
};
Symbol 407 MovieClip Frame 1
function onEnterFrame() {
points1_txt.text = (points2_txt.text = val);
}
stop();
var val = "";
Symbol 424 MovieClip Frame 1
gotoAndStop(_root.difficulty);
Symbol 425 MovieClip Frame 1
function onEnterFrame() {
if (dragging) {
handle_mc._x = Math.max(minX, Math.min(this._xmouse, maxX));
var _local3 = 0;
while (_local3 < 5) {
if (handle_mc._x > (xvals[_local3] - (xPer / 2))) {
_root.difficulty = _local3 + 1;
}
_local3++;
}
handle_mc.gotoAndStop(_root.difficulty);
} else {
handle_mc._x = handle_mc._x + ((xvals[_root.difficulty - 1] - handle_mc._x) * 0.35);
}
}
stop();
var xvals = new Array(5);
var minX = -271;
var maxX = 271;
var xPer = ((maxX - minX) / 4);
var dragging = false;
var i = 0;
while (i < 5) {
xvals[i] = minX + (xPer * i);
i++;
}
handle_mc.handle_mc.onPress = function () {
if (!_root.alive) {
dragging = true;
}
};
handle_mc.handle_mc.onMouseUp = function () {
dragging = false;
};
Symbol 436 MovieClip Frame 1
function onEnterFrame() {
points1_txt.text = (points2_txt.text = val);
}
stop();
var val = "";
Symbol 440 MovieClip [HighScoreDisplay] Frame 1
function update() {
line0.val = ((_root.record.data.Name + " scored ") + _root.commaSplit(_root.record.data.score)) + " Points";
line1.val = (_root.record.data.eaten + " Eaten, over ") + _root.timeFormat(_root.record.data.Time);
line2.val = (("Level " + _root.record.data.level) + " reached on ") + _root.difficultyText[_root.record.data.difficulty];
}
function Open() {
hold = true;
}
function onEnterFrame() {
if (hold && (!isNaN(_root.elapsed))) {
timer = timer + _root.elapsed;
if (timer > holdTime) {
hold = false;
}
}
if (Show || (hold)) {
if (_root.record.data.score > points) {
update();
points = _root.record.data.score;
}
mask_mc._y = mask_mc._y + ((showY - mask_mc._y) * 0.3);
_parent.paused_mc._alpha = 30;
} else {
mask_mc._y = mask_mc._y + ((hideY - mask_mc._y) * 0.4);
_parent.paused_mc._alpha = 100;
}
}
stop();
var timer = 0;
var holdTime = 3000;
var hold = false;
var hideY = -192;
var showY = 1;
var points = -1;
var Show = false;
label.onRollOver = function () {
Show = true;
};
label.onRollOut = function () {
Show = false;
};
label.onPress = function () {
Show = false;
};
Symbol 441 MovieClip [UI] Frame 1
function onEnterFrame() {
paused_mc._visible = _root.Paused;
diffbuttons._visible = !_root.alive;
diffbuttons.useHandCursor = !_root.alive;
highscore_mc._visible = (_root.Paused && (!_root.pauseType)) || (!_root.alive);
if (!highscore_mc._visible) {
highscore_mc.mask_mc._y = highscore_mc.hideY;
}
rePlayBtn._visible = (!_root.alive) && (!_root.enteringNewHighScore);
if (_root.Paused) {
alpha = alpha + ((100 - alpha) * alphaInRate);
} else {
alpha = alpha + ((fadedAlpha - alpha) * alphaOutRate);
}
alpha = Math.max(fadedAlpha, Math.min(alpha, 100));
border_mc._alpha = alpha;
}
stop();
paused_mc._visible = false;
rePlayBtn._visible = false;
rePlayBtn.clicked = false;
var fadedAlpha = 37;
var alpha = fadedAlpha;
var alphaInRate = 0.5;
var alphaOutRate = 0.15;
border_mc._alpha = fadedAlpha;
paused_mc.onRelease = function () {
if (_root.alive) {
_root.Paused = false;
}
};
paused_mc.onEnterFrame = function () {
this.useHandCursor = _root.alive;
};
rePlayBtn.onRollOver = function () {
if (!clicked) {
this.gotoAndPlay("Over");
clicked = false;
}
};
rePlayBtn.onRollOut = function () {
if (!clicked) {
this.gotoAndPlay("Out");
}
};
rePlayBtn.onPress = function () {
clicked = true;
this.gotoAndPlay("Click");
};
Symbol 449 MovieClip [NameEntry] Frame 1
function confirm() {
_root.record.data.score = _root.points;
_root.record.data.eaten = _root.consumed;
_root.record.data.level = _root.level;
_root.record.data.difficulty = _root.difficulty;
_root.record.data.Name = name_txt.text;
_root.record.data.Time = _root.totalGameTime;
_root.record.flush();
_root.enteringNewHighScore = false;
_root.ui.highscore_mc.Open();
this.removeMovieClip();
}
function onEnterFrame() {
if (Key.isDown(13)) {
confirm();
}
if (!_root.enteringNewHighScore) {
this.removeMovieClip();
}
}
stop();
_root.enteringNewHighScore = true;
confirm_btn.onRelease = confirm;
Symbol 487 Button
on (release) {
getURL ("http://www.newgrounds.com", "_blank");
}
Symbol 496 Button
on (release) {
_root.play();
}
Symbol 498 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
bar._xscale = PercentLoaded;
} else {
gotoAndStop ("loaded");
}
Symbol 498 MovieClip Frame 2
gotoAndPlay (1);
Symbol 505 MovieClip [__Packages.Mob] Frame 0
class Mob extends MovieClip
{
var _position, _x, _y, _velocity, TargetPos, _name, removeMovieClip;
function Mob () {
super();
_position = new Vector2(_x, _y);
if (_position == undefined) {
trace("Mob() _position is undefined");
}
_velocity = new Vector2(0, 0);
TargetPos = new Vector2(0, 0);
AddToMobs();
}
function get PC() {
return(_pc);
}
function get Speed() {
return(_speed);
}
function get Position() {
return(_position);
}
function get X() {
return(_position.__get__X());
}
function get Y() {
return(_position.__get__Y());
}
function get Radius() {
return(_radius);
}
function get Velocity() {
return(_velocity);
}
function get VX() {
return(_velocity.__get__X());
}
function get VY() {
return(_velocity.__get__Y());
}
function get Edible() {
return(_edible);
}
function get Hurtful() {
return(_hurtful);
}
function get Alive() {
return(_alive);
}
function set PC(val) {
_pc = val;
//return(PC);
}
function set Speed(val) {
_speed = val;
//return(Speed);
}
function set X(val) {
_position.__set__X(val);
//return(X);
}
function set Y(val) {
_position.__set__Y(val);
//return(Y);
}
function set Radius(val) {
_radius = val;
//return(Radius);
}
function set VX(val) {
_velocity.__set__X(val);
//return(VX);
}
function set VY(val) {
_velocity.__set__Y(val);
//return(VY);
}
function set Edible(val) {
if (_edible && (!val)) {
RemoveFromEdibles();
} else if ((!_edible) && (val)) {
AddToEdibles();
}
_edible = val;
if (_edible) {
Hurtful = (false);
}
//return(Edible);
}
function set Hurtful(val) {
if (_hurtful && (!val)) {
RemoveFromEnemies();
} else if ((!_hurtful) && (val)) {
AddToEnemies();
}
_hurtful = val;
if (_hurtful) {
Edible = (false);
}
//return(Hurtful);
}
function set Alive(val) {
_alive = val;
//return(Alive);
}
function Init(X, Y) {
if (!isNaN(X)) {
this.X = (X);
this.Y = (Y);
} else {
X = 0;
Y = 0;
}
}
function Update(elapsed) {
if (_root.Paused) {
return(undefined);
}
if (_pc && (_alive)) {
if ((X + _radius) > _root.stageSize.X) {
X = (_root.stageSize.X - _radius);
} else if ((X - _radius) < 0) {
X = (_radius);
}
if ((Y + _radius) > _root.stageSize.Y) {
Y = (_root.stageSize.Y - _radius);
} else if ((Y - _radius) < 0) {
Y = (_radius);
}
}
_x = X;
_y = Y;
}
function AddToMobs() {
_root.mobs.push(this);
}
function AddToEdibles() {
_root.edibles.push(this);
}
function AddToEnemies() {
_root.enemies.push(this);
}
function AddToMiniMunchs() {
_root.miniMunchs.push(this);
}
function RemoveFromMobs() {
var _local4 = _root.mobs.length;
var _local3 = 0;
while (_local3 < _local4) {
if (_root.mobs[_local3]._name == _name) {
_root.mobs.splice(_local3, 1);
break;
}
_local3++;
}
}
function RemoveFromEdibles() {
var _local4 = _root.edibles.length;
var _local3 = 0;
while (_local3 < _local4) {
if (_root.edibles[_local3]._name == _name) {
_root.edibles.splice(_local3, 1);
break;
}
_local3++;
}
}
function RemoveFromEnemies() {
var _local4 = _root.enemies.length;
var _local3 = 0;
while (_local3 < _local4) {
if (_root.enemies[_local3]._name == _name) {
_root.enemies.splice(_local3, 1);
break;
}
_local3++;
}
}
function RemoveFromMiniMunchs() {
var _local4 = _root.miniMunchs.length;
var _local3 = 0;
while (_local3 < _local4) {
if (_root.miniMunchs[_local3]._name == _name) {
_root.miniMunchs.splice(_local3, 1);
break;
}
_local3++;
}
}
function Remove() {
if (_edible) {
RemoveFromEdibles();
}
if (_hurtful) {
RemoveFromEnemies();
}
if (this instanceof Munch) {
RemoveFromMiniMunchs();
}
RemoveFromMobs();
removeMovieClip();
}
function Kill() {
Remove();
}
var _pc = false;
var _speed = 5;
var _radius = 16;
var _edible = false;
var _hurtful = false;
var _alive = true;
var Points = 1;
var History = "";
}
Symbol 506 MovieClip [__Packages.Vector2] Frame 0
class Vector2 extends Object
{
function Vector2 (InitX, InitY) {
super();
if ((InitX == null) || (InitX == undefined)) {
InitX = 0;
}
if ((InitY == null) || (InitY == undefined)) {
InitY = 0;
}
m_x = InitX;
m_y = InitY;
}
function get X() {
return(m_x);
}
function get Y() {
return(m_y);
}
function get Length() {
return(Math.sqrt(Math.pow(m_x, 2) + Math.pow(m_y, 2)));
}
function set X(val) {
m_x = val;
//return(X);
}
function set Y(val) {
m_y = val;
//return(Y);
}
function Distance(V) {
return(Math.sqrt(Math.pow(V.__get__X() - X, 2) + Math.pow(V.__get__Y() - Y, 2)));
}
var m_x = new Number();
var m_y = new Number();
}
Symbol 507 MovieClip [__Packages.Munch] Frame 0
class Munch extends Mob
{
var __set__Speed, AddToMiniMunchs, TargetPos, getDepth, swapDepths, __get__PC, RemoveFromMiniMunchs, _parent, _xscale, _yscale, __set__VX, __get__X, __set__VY, __get__Y, __get__VY, __get__VX, __get__Velocity, X, VX, Y, VY, __set__X, __set__Y, _rotation, __get__Position, gotoAndStop;
function Munch () {
super();
__set__Speed(25);
_root.munchInUse++;
if (_root.alive) {
AddToMiniMunchs();
TargetPos = _root.player.Position;
if (getDepth() > _root.player.getDepth()) {
swapDepths(_root.player);
}
_root.snd_spawn1.start(0.4);
} else {
PC = (true);
TargetPos = _root.mPos;
}
}
function get Eating() {
return(_eating);
}
function get Consumed() {
return(_consumed);
}
function get Alive() {
return(super.__get__Alive());
}
function set PC(val) {
if (__get__PC() == val) {
return;
}
if ((!__get__PC()) && (val)) {
RemoveFromMiniMunchs();
_root.player = this;
TargetPos = _root.mPos;
_root.updateMiniTargets();
_root.updateEnemyTargets();
swapDepths(_parent.getNextHighestDepth());
} else if (__get__PC() && (!val)) {
if (!setNewPC()) {
val = true;
}
}
if (val) {
_root.alive = true;
}
miniShadow._visible = val;
super.__set__PC(val);
//return(__get__PC());
}
function set Eating(val) {
if ((!_eating) && (val)) {
_root.snd_eat1.start(0, 30);
} else {
_root.snd_eat1.stop();
}
_eating = val;
//return(Eating);
}
function set Consumed(val) {
_consumed = Math.min(val, _bitsToSpawn);
spawnMiniCheck();
//return(Consumed);
}
function set Alive(val) {
super.__set__Alive(val);
if (!val) {
Eating = (false);
PC = (false);
miniShadow._visible = false;
} else if (!__get__PC()) {
miniShadow._visible = true;
}
if ((Alive && (!val)) && (!__get__PC())) {
RemoveFromMiniMunchs();
} else if (((!Alive) && (val)) && (!__get__PC())) {
AddToMiniMunchs();
}
if ((!_root.player.Alive) && (val)) {
_root.player.PC = false;
}
//return(Alive);
}
function Init(X, Y) {
super.Init(X, Y);
}
function Update(elapsed) {
if (_root.Paused) {
return(undefined);
}
if (__get__PC() && (Alive)) {
var _local7 = _playerScale + (_scalePerConsumed * Math.min(_consumed, _bitsToSpawn));
if (Math.abs(_local7 - _xscale) < 1) {
_xscale = (_yscale = _local7);
} else {
_xscale = (_yscale = _xscale + ((_local7 - _xscale) * _scaleRate));
}
} else if (Math.abs(_nonPlayerScale - _xscale) < 1) {
_xscale = (_yscale = _nonPlayerScale);
} else {
_xscale = (_yscale = _xscale + ((_nonPlayerScale - _xscale) * _scaleRate));
}
if (Alive == false) {
super.Update();
return(undefined);
}
if (__get__PC()) {
if (TargetPos == undefined) {
TargetPos = _root.mPos;
}
__set__VX((TargetPos.__get__X() - __get__X()) * 0.3);
__set__VY((TargetPos.__get__Y() - __get__Y()) * 0.3);
var _local9 = Math.atan2(__get__VY(), __get__VX());
var _local14 = __get__Velocity().__get__Length();
if (_local14 > _maxPlayerSpeed) {
__set__VX(Math.cos(_local9) * _maxPlayerSpeed);
__set__VY(Math.sin(_local9) * _maxPlayerSpeed);
}
X = X + VX;
Y = Y + VY;
if (Math.abs(TargetPos.__get__X() - __get__X()) < _snapDistance) {
__set__X(TargetPos.X);
}
if (Math.abs(TargetPos.__get__Y() - __get__Y()) < _snapDistance) {
__set__Y(TargetPos.Y);
}
spawnMiniCheck();
if (_shouldRotate) {
var _local12 = Math.abs(__get__VX()) / _maxSpeed;
_rot = _rot + ((((_maxRot * _local12) * ((__get__VX() > 0) ? 1 : -1)) - _rot) * 0.1);
_rot = Math.max(_maxRot * -1, Math.min(_rot, _maxRot));
_rotation = (_rot * 180) / Math.PI;
}
} else {
if (TargetPos == undefined) {
TargetPos = _root.player.Position;
}
_phase = _phase + _phaseRate;
_phase = _phase % (Math.PI*2);
var _local4 = new Vector2(TargetPos.__get__X(), TargetPos.__get__Y());
_local4.X = _local4.X + (Math.cos(_phase) * _followRadius);
_local4.Y = _local4.Y + (Math.sin(_phase) * (_followRadius / 5));
_local4.X = _local4.X + (Math.cos(_followAngle) * _followRadius);
_local4.Y = _local4.Y + (Math.sin(_followAngle) * _followRadius);
VX = VX + ((_local4.__get__X() - __get__X()) * _spring);
VY = VY + ((_local4.__get__Y() - __get__Y()) * _spring);
var _local8 = _local4.Distance(__get__Position());
var _local5 = _maxSpeed;
var _local6 = _minSpeed;
if (_local8 > _hasteDistance) {
var _local10 = _root.stageSize.Length;
_local6 = _local6 * (((_local8 / _local10) * _hasteMultiplier) + 0.005);
_local5 = _local5 * (((_local8 / _local10) * _hasteMultiplier) + 0.005);
}
if (__get__Velocity().__get__Length() > _local5) {
var _local11 = Math.atan2(__get__VY(), __get__VX());
__set__VX(Math.cos(_local11) * _local5);
__set__VY(Math.sin(_local11) * _local5);
} else if (__get__Velocity().__get__Length() < _local6) {
var _local11 = Math.atan2(__get__VY(), __get__VX());
__set__VX(Math.cos(_local11) * _local6);
__set__VY(Math.sin(_local11) * _local6);
}
X = X + VX;
Y = Y + VY;
if (_shouldRotate) {
var _local13 = Math.atan2(__get__VY(), __get__VX());
_rot = _rot + ((_local13 - _rot) * 0.6);
_rotation = ((_rot * 180) / Math.PI) + 90;
}
}
if (__get__PC()) {
if (_eating) {
(gotoAndStop(_eatingState));// not popped
} else {
(gotoAndStop(_normalState));// not popped
}
} else {
(gotoAndStop(_extraState));// not popped
}
super.Update();
}
function StartEat() {
Alive = (false);
}
function spawnMiniCheck() {
while ((_consumed >= _bitsToSpawn) && (_root.munchInUse < _root.maxMunchCount)) {
_consumed = _consumed % _bitsToSpawn;
_root.spawnMunch();
}
}
function setNewPC(force) {
if (!super.__get__PC()) {
return(undefined);
}
var _local6 = _root.miniMunchs.length;
var _local5 = false;
var _local4 = 0;
while (_local4 < _local6) {
if (miniMunchs[_local4].Alive) {
_root.miniMunchs[_local4].PC = true;
_local5 = true;
break;
}
_local4++;
}
if ((force && (!_local5)) && (_local6 > 0)) {
_root.miniMunchs[0].PC = true;
_local5 = true;
}
if (_local5) {
AddToMiniMunchs();
_root.player.TargetPos = _root.mPos;
_root.updateMiniTargets();
_root.updateEnemyTargets();
}
return(_local5);
}
function Remove() {
_root.munchInUse--;
Eating = (false);
setNewPC(true);
_consumed = 0;
if (_root.munchInUse <= 0) {
_root.alive = false;
}
super.Remove();
}
function Kill() {
var _local3 = _root.stage.getNextHighestDepth();
var _local5 = _root.stage.ui.attachMovie("MunchDeath", "skull" + _local3, _local3, {_x:__get__X(), _y:__get__Y(), _xscale:80, _yscale:80, _alpha:60});
_root.snd_death1.start();
Remove();
}
var _snapDistance = 2;
var _followAngle = 0;
var _followRadius = 32;
var _minSpeed = 5;
var _maxSpeed = 15;
var _maxPlayerSpeed = 30;
var _radius = 16;
var _spring = 0.2;
var _phase = 0;
var _phaseRate = 0.392699081698724;
var _hasteDistance = 150;
var _hasteMultiplier = 8;
var _playerScale = 72;
var _nonPlayerScale = 50;
var _scaleRate = 0.07;
var _normalState = "slow";
var _extraState = "fast";
var _eatingState = "fast";
var _shouldRotate = true;
var _maxRot = 0.349065850398866;
var _rot = 0;
var _eating = false;
var _consumed = 0;
var _bitsToSpawn = 4;
var _scalePerConsumed = 4;
}
Symbol 508 MovieClip [__Packages.WhiteCell] Frame 0
class WhiteCell extends Mob
{
var _munchs, _lastPos, _x, _y, TargetPos, __set__Speed, __set__Radius, Points, __set__Hurtful, __get__Alive, __get__X, __get__Y, __get__Radius, __get__Position, X, Y, VX, VY, __set__X, __set__Y, __set__Alive, gotoAndPlay;
function WhiteCell () {
super();
_munchToOverload = (3 + _root.difficulty) + Math.floor(_root.level / 10);
_munchToOverload = Math.min(_munchToOverload, _maxMunchCount - 1);
_lifeRegenFactor = _root.difficulty;
_munchs = new Array();
_lastPos = new Vector2(_x, _y);
TargetPos = new Vector2(_x, _y);
__set__Speed(0.2);
__set__Radius(40);
Points = 2;
__set__Hurtful(true);
_root.mobInUse++;
_root.whiteCellInUse++;
_root.onWhiteCell(this);
}
function get MunchCount() {
return(_munchCount);
}
function get Eating() {
return(_munchCount >= _maxMunchCount);
}
function get MunchDiff() {
return(_munchCount - _munchToOverload);
}
function get RotRate() {
return(_rotRateBase + (RotRatePerMunch * (_munchCount - 1)));
}
function get RotRatePerMunch() {
return((_rotRateBase / (_munchToOverload - 1)) * -1.1);
}
function get AngPerMunch() {
return((Math.PI*2) / _munchCount);
}
function get MoveDist() {
return(Math.floor(Math.random() * (_maxMoveDist - _minMoveDist)) + _minMoveDist);
}
function Init(X, Y) {
super.Init(X, Y);
}
function Update(elapsed) {
if (_root.Paused || (!__get__Alive())) {
return(undefined);
}
var _local8 = new Vector2(__get__X(), __get__Y());
_timeSinceMove = _timeSinceMove + elapsed;
if (_timeSinceMove > _timeToMove) {
moveRandom();
} else {
moveTowards();
}
if (MunchDiff >= 0) {
_life = _life + (elapsed * MunchDiff);
} else {
_life = _life - (elapsed * _lifeRegenFactor);
_life = Math.max(0, _life);
}
var _local10 = Math.max(0, Math.min(_life / _lifeSpan, 1));
tint = Math.round(_local10 * 100);
if (_munchCount > 0) {
_timeEating = _timeEating + elapsed;
if (_life > _lifeSpan) {
Eat();
return(undefined);
}
_rot = _rot + RotRate;
_munchDistToCenter = (1 - (_timeEating / _timeToEat)) * __get__Radius();
var _local6 = AngPerMunch;
var _local7 = _munchs.length;
var _local5 = 0;
while (_local5 < _local7) {
var _local4 = _munchs[_local5];
_local4.X = _local4.X + (__get__X() - _local8.__get__X());
_local4.Y = _local4.Y + (__get__Y() - _local8.__get__Y());
if (_local5 < (_local7 - 1)) {
_local4.X = _local4.X + (((__get__X() + (Math.cos(_rot + (_local6 * _local5)) * (__get__Radius() - 1))) - _local4.X) * _munchMoveRate);
_local4.Y = _local4.Y + (((__get__Y() + (Math.sin(_rot + (_local6 * _local5)) * (__get__Radius() - 1))) - _local4.Y) * _munchMoveRate);
} else {
_local4.X = _local4.X + (((__get__X() + (Math.cos(_rot + (_local6 * _local5)) * _munchDistToCenter)) - _local4.X) * _munchMoveRate);
_local4.Y = _local4.Y + (((__get__Y() + (Math.sin(_rot + (_local6 * _local5)) * _munchDistToCenter)) - _local4.Y) * _munchMoveRate);
}
_local4._rotation = _local4._rotation + ((RotRate * 180) / Math.PI);
_local5++;
}
chewMunch();
} else {
_timeSinceMove = _timeSinceMove + elapsed;
}
super.Update(elapsed);
}
function moveRandom() {
var _local3 = MoveDist;
TargetPos.__set__X(Math.random() * _root.stageSize.X);
TargetPos.__set__Y(Math.random() * _root.stageSize.Y);
TargetPos.__set__X(Math.max(__get__Radius(), Math.min(TargetPos.__get__X(), _root.stageSize.X - __get__Radius())));
TargetPos.__set__Y(Math.max(__get__Radius(), Math.min(TargetPos.__get__Y(), _root.stageSize.Y - __get__Radius())));
if (__get__Position().Distance(TargetPos) > _local3) {
var _local4 = Math.atan2(TargetPos.__get__Y() - __get__Y(), TargetPos.__get__X() - __get__X());
TargetPos.__set__X(__get__X() + (Math.cos(_local4) * _local3));
TargetPos.__set__Y(__get__Y() + (Math.sin(_local4) * _local3));
}
_lastPos.__set__X(X);
_lastPos.__set__Y(Y);
_lastMoveLength = _lastPos.Distance(TargetPos);
_lastMoveAngle = Math.atan2(TargetPos.__get__Y() - __get__Y(), TargetPos.__get__X() - __get__X());
_timeSinceMove = 0;
}
function moveTowards() {
var _local3 = Math.atan2(TargetPos.__get__Y() - __get__Y(), TargetPos.__get__X() - __get__X());
VX = VX + (Math.cos(_local3) * _moveRate);
VY = VY + (Math.sin(_local3) * _moveRate);
X = X + VX;
Y = Y + VY;
__set__X(Math.max(__get__Radius(), Math.min(__get__X(), _root.stageSize.X - __get__Radius())));
__set__Y(Math.max(__get__Radius(), Math.min(__get__Y(), _root.stageSize.Y - __get__Radius())));
}
function startEatingNext() {
if (_munchCount <= 0) {
return(undefined);
}
_timeEating = 0;
}
function chewMunch() {
if (_timeEating >= _timeToEat) {
eatMunch();
}
}
function eatMunch() {
_munchToOverload = Math.min(++_munchToOverload, _maxMunchCount - 1);
_munchCount--;
_munchs[0].Kill();
_munchs.splice(0, 1);
_timeEating = 0;
}
function GetMunch(ind) {
return(_munchs[ind]);
}
function AddMunch(mClip) {
if (_munchCount >= _maxMunchCount) {
return(false);
}
_munchs.push(mClip);
mClip.StartEat();
_munchCount++;
if (_munchCount == 1) {
startEatingNext();
}
return(true);
}
function Eat() {
var _local4 = _munchs.length;
var _local3 = 0;
while (_local3 < _local4) {
_munchs[_local3].Alive = true;
_local3++;
}
_local4 = Math.round(_local4 / 2);
_local3 = 0;
while (_local3 < _local4) {
if (_root.munchInUse >= _root.maxMunchCount) {
break;
}
_root.spawnMunch(__get__X(), __get__Y());
_local3++;
}
_root.mobInUse--;
_root.whiteCellInUse--;
_root.ConsumedUp(1);
_root.PointUp(Points / _munchCount);
__set__Alive(false);
(gotoAndPlay("dead"));// not popped
}
var _state = 0;
var _munchCount = 0;
var _munchToOverload = 3;
var _maxMunchCount = 10;
var _timeToEat = 10000;
var _timeEating = 0;
var _lifeSpan = 20000;
var _life = 0;
var _lifeRegenFactor = 2;
var _munchDistToCenter = 0;
var _munchAng = 0;
var _rot = 0.1;
var _rotRateBase = -0.196349540849362;
var _munchMoveRate = 0.2;
var _timeToMove = 5000;
var _timeSinceMove = 2000;
var _minMoveDist = 50;
var _maxMoveDist = 300;
var _lastMoveLength = 0;
var _lastMoveAngle = 0;
var _moveCone = 1.0471975511966;
var _moveRate = 0.2;
var tint = 0;
}
Symbol 509 MovieClip [__Packages.WormBit] Frame 0
class WormBit extends Mob
{
var _nextSnakeTime, __set__VX, __set__VY, TargetPos, _xscale, _yscale, Food, __set__Edible, __set__Hurtful, Post, gotoAndStop, Points, __get__X, __get__Y, _rotation, __get__VX, __get__VY, X, VX, Y, VY, __set__X, __set__Y, Pre, __get__Edible, _alpha, __get__Position;
function WormBit () {
super();
_type = 2;
_minTurn = 0;
if (_root.difficulty <= 2) {
_maxTurn = 0.10471975511966;
} else {
_maxTurn = ((6 + _root.difficulty) * Math.PI) / 180;
}
if ((_root.difficulty > 1) && (_root.level > _root.redCellLevel)) {
_maxTurn = _maxTurn + ((_root.level * Math.PI) / 180);
}
_maxTurn = Math.min(_maxTurn, ABSMAXTURN);
if (_root.difficulty > 2) {
_timeToEat = _timeToEat - (_root.difficulty - 2);
}
_nextSnakeTime = getNewSnakeWait();
super.__set__Speed(7);
var _local4 = Math.random() * (Math.PI*2);
__set__VX(Math.cos(_local4) * Speed);
__set__VY(Math.sin(_local4) * Speed);
ShouldSnake = (Math.random() < 0.5);
TargetPos = _root.player.Position;
_xscale = (_yscale = _scale);
_root.mobInUse++;
}
function get Type() {
return(_type);
}
function get Eating() {
return(Food != undefined);
}
function get Fed() {
return(_fed);
}
function get Speed() {
var _local4 = super.__get__Speed();
var _local5 = GetHead();
if (_root.difficulty > 1) {
if (_local5.Eating) {
_local4 = _local4 * _eatingSpeedMultiplier;
} else if (_local5.Fed) {
_local4 = _local4 * _fedSpeedMultiplier;
}
}
return(_local4);
}
function get maxTurn() {
var _local3 = _maxTurn;
var _local4 = GetHead();
if (_local4.Eating) {
_local3 = _local3 * (_eatingSpeedMultiplier / 1.2);
}
if (_local4.Fed) {
_local3 = _local3 * (_fedSpeedMultiplier / 2);
}
if (_root.difficulty > 1) {
_local3 = Math.min(_local3, ABSMAXTURN);
} else {
_local3 = Math.min(_local3, ABSMAXTURN * 0.7);
}
return(_local3);
}
function get Alive() {
return(super.__get__Alive());
}
function get EatingTime() {
return(_eatingTime);
}
function get ShouldSnake() {
return(_shouldSnake);
}
function set Alive(val) {
if (Alive && (!val)) {
__set__Edible(false);
__set__Hurtful(false);
if ((_type == 0) && (_inUse)) {
_root.wormInUse--;
_inUse = false;
}
} else if ((!Alive) && (val)) {
if (Type == 0) {
__set__Edible(false);
__set__Hurtful(true);
if (!_inUse) {
_root.wormInUse++;
_inUse = true;
}
} else {
__set__Edible(true);
__set__Hurtful(false);
}
}
super.__set__Alive(val);
Post.__set__Alive(val);
//return(Alive);
}
function set Type(val) {
var _local4 = _type;
_type = Math.max(0, Math.min(val, 2));
var _local3 = _type + 1;
if (_fed) {
_local3 = _local3 + 3;
}
(gotoAndStop(_local3));// not popped
switch (_type) {
case 0 :
__set__Edible(false);
__set__Hurtful(true);
if (!_inUse) {
_root.wormInUse++;
_inUse = true;
}
break;
case 2 :
Post = undefined;
case 1 :
__set__Edible(true);
__set__Hurtful(false);
if (!_inUse) {
break;
}
_root.wormInUse--;
_inUse = false;
}
//return(Type);
}
function set Fed(val) {
if (_fed != val) {
var _local3 = _type + 1;
if (val) {
_local3 = _local3 + 3;
}
(gotoAndStop(_local3));// not popped
Post.__set__Fed(val);
}
_fed = val;
if (_fed) {
Points = 1.5;
}
//return(Fed);
}
function set EatingTime(val) {
_eatingTime = val;
//return(EatingTime);
}
function set ShouldSnake(val) {
if (_shouldSnake != val) {
_phase = ((Math.random() < 0.5) ? 0 : Math.PI);
}
_shouldSnake = val;
//return(ShouldSnake);
}
function Init(X, Y) {
super.Init(X, Y);
}
function Update(elapsed) {
if (_root.Paused || (!_root.alive)) {
return(undefined);
}
if (Alive) {
if (_type == 0) {
updateAlive(elapsed);
}
} else {
updateDead(elapsed);
}
super.Update(elapsed);
}
function updateAlive(elapsed) {
var _local19 = new Vector2(__get__X(), __get__Y());
_snakeWaitTime = _snakeWaitTime + _root.elapsed;
if (_snakeWaitTime > _nextSnakeTime) {
ShouldSnake = (!_shouldSnake);
_snakeWaitTime = 0;
_nextSnakeTime = getNewSnakeWait();
}
if (_shouldSnake) {
_phase = _phase + _phaseRate;
}
var _local4 = new Vector2(TargetPos.__get__X(), TargetPos.__get__Y());
if ((_root.RedCell != undefined) && (_root.RedCell.Edible)) {
if (GetLength() > 3) {
_local4.__set__X(_root.RedCell.X);
_local4.__set__Y(_root.RedCell.Y);
}
}
if (Eating) {
if (Food.__get__PC()) {
_local4.__set__X(_root.stageSize.X / 2);
_local4.__set__Y(_root.stageSize.Y / 2);
} else if (Food instanceof Munch) {
var _local9 = Math.atan2(_local4.__get__Y() - __get__Y(), _local4.__get__X() - __get__X());
_local9 = _local9 + Math.PI;
var _local14 = _local4.__get__Length();
_local4.__set__X(__get__X() + (Math.cos(_local9) * _local14));
_local4.__set__Y(__get__Y() + (Math.sin(_local9) * _local14));
} else {
_local4.__set__X(_root.stageSize.X / 2);
_local4.__set__Y(_root.stageSize.Y / 2);
}
}
var _local20 = _rotation;
var _local7 = new Vector2(__get__VX(), __get__VY());
var _local5 = new Vector2(_local4.__get__X() - __get__X(), _local4.__get__Y() - __get__Y());
var _local13 = Math.atan2(_local5.__get__Y(), _local5.__get__X());
var _local10 = new Vector2(_local5.__get__Length() * Math.cos(_local13 + 0.5), _local5.__get__Length() * Math.sin(_local13 + 0.5));
var _local15 = _root.dotProd(_local7.__get__X(), _local7.__get__Y(), _local5.__get__X(), _local5.__get__Y());
var _local3 = Math.acos(_local15 / (_local7.__get__Length() * _local5.__get__Length()));
var _local16 = _root.dotProd(_local7.__get__X(), _local7.__get__Y(), _local10.__get__X(), _local10.__get__Y());
var _local8 = Math.acos(_local16 / (_local7.__get__Length() * _local10.__get__Length()));
if (isNaN(_local3)) {
_local3 = 0;
}
if (isNaN(_local8)) {
_local8 = 0;
}
var _local6 = Math.atan2(__get__VY(), __get__VX());
var _local11 = Speed;
if (Math.abs(Math.PI - _local3) < 0.0523598775598299) {
if (_local3 <= Math.PI) {
_local3 = _local3 - 0.0523598775598299;
} else if (_local3 > Math.PI) {
_local3 = _local3 + 0.0523598775598299;
}
}
var _local18 = ((_local3 < _local8) ? 1 : -1);
var _local17 = _local3;
_local3 = Math.max(_minTurn, Math.min(_local3, maxTurn));
_local3 = Math.round(_local3 * 100) / 100;
if (_local3 < (Math.PI/90)) {
_local3 = 0;
}
if ((Eating && (!Food.__get__PC())) && (_local17 > (Math.PI/2))) {
if (_root.difficulty > 1) {
_local3 = _local3 + 0.314159265358979;
}
} else if (_shouldSnake) {
_local6 = _local6 + (Math.sin(_phase) * _phaseStrength);
}
_local6 = _local6 + (_local3 * _local18);
__set__VX(Math.cos(_local6) * _local11);
__set__VY(Math.sin(_local6) * _local11);
X = X + VX;
Y = Y + VY;
_rotation = (_local6 * 180) / Math.PI;
if (Eating) {
_eatingTime = _eatingTime + elapsed;
if (_eatingTime < _timeToEat) {
var _local12 = Math.atan2(__get__VY(), __get__VX());
Food._rotation = Food._rotation + (((_local6 - _local12) * 180) / Math.PI);
Food.__set__X(__get__X() + (Math.cos(_local12) * 14));
Food.__set__Y(__get__Y() + (Math.sin(_local12) * 14));
} else {
if (Food instanceof Munch) {
Food.Kill();
} else {
Food.Eat();
}
Food = undefined;
_eatingTime = 0;
Fed = (true);
_root.onBlueWorm(this);
if (!_root.alive) {
__set__X(PreUpdatePosition.X);
__set__Y(PreUpdatePosition.Y);
}
}
}
Post.crawl(_local11);
if (!_prepared) {
Prepared = true;
}
}
function updateDead(elapsed) {
if (Pre instanceof Munch) {
if (!Pre.__get__Alive()) {
Pre = undefined;
return(undefined);
}
_eatingTime = _eatingTime + _root.elapsed;
if (_eatingTime >= _timeToBeEaten) {
Post.__set__X(X);
Post.__set__Y(Y);
Post._rotation = _rotation;
Post.Pre = _root.player;
Post.Update();
Eat();
} else {
var _local4 = __get__X();
var _local3 = __get__Y();
__set__X(Pre.X);
__set__Y(Pre.Y);
if ((_local4 != __get__X()) || (_local3 != __get__Y())) {
_rotation = (Math.atan2(__get__Y() - _local3, __get__X() - _local4) * 180) / Math.PI;
}
drag();
}
} else if (Pre == undefined) {
_deadTime = _deadTime + elapsed;
if (!__get__Edible()) {
__set__Edible(true);
}
if ((_type == 1) && (Post != undefined)) {
if (_deadTime >= _reviveTime) {
GetHead().__set__Type(0);
GetHead().__set__Alive(true);
GetHead().TargetPos = _root.player.Position;
}
} else if (_deadTime >= _fadeDeadTime) {
_alpha = _alpha - _fadeRate;
if (_alpha <= 0) {
if (!((Food == undefined) || (Food == null))) {
if (Food instanceof Munch) {
Food.__set__Alive(true);
} else {
Food.__set__Edible(true);
}
Food = undefined;
}
Remove();
return(undefined);
}
}
}
}
function drag() {
if ((Post == undefined) || (Post == null)) {
return(undefined);
}
var _local4 = __get__X() - Post.__get__X();
var _local3 = __get__Y() - Post.__get__Y();
var _local2 = Math.atan2(_local3, _local4);
Post._rotation = (_local2 * 180) / Math.PI;
Post.__set__X(__get__X() - (Math.cos(_local2) * SEGLEN));
Post.__set__Y(__get__Y() - (Math.sin(_local2) * SEGLEN));
Post.drag();
}
function crawl(speed) {
if (isNaN(speed)) {
speed = Speed;
}
var _local3 = Math.atan2(Pre.__get__VY(), Pre.__get__VX());
_local3 = _local3 + Math.PI;
var _local2 = new Vector2(Pre.__get__X() + (_followDist * Math.cos(_local3)), Pre.__get__Y() + (_followDist * Math.sin(_local3)));
var _local5 = _local2.Distance(__get__Position());
__set__VX(((_local2.__get__X() - __get__X()) / _local5) * speed);
__set__VY(((_local2.__get__Y() - __get__Y()) / _local5) * speed);
X = X + VX;
Y = Y + VY;
var _local6 = Math.atan2(Pre.__get__Y() - __get__Y(), Pre.__get__X() - __get__X());
_rotation = (_local6 * 180) / Math.PI;
Post.crawl(tempSpeed);
}
function getNewSnakeWait() {
return(Math.floor(Math.random() * (_maxSnakeWait - _minSnakeWait)) + _minSnakeWait);
}
function AddBits(count) {
if (count <= 0) {
Type = (2);
return(undefined);
}
if (_type != 2) {
Post.AddBits(count);
} else {
Type = (1);
Post = _root.spawnMob("WormBit", __get__X(), __get__Y());
Post.Pre = this;
count--;
Post.AddBits(count);
}
}
function Split(minLength) {
minLength = Math.max(2, minLength);
var _local6 = 0;
while (GetLength() >= (minLength * 2)) {
var _local3 = GetTail();
var _local4 = 1;
do {
_local3 = _local3.Pre;
_local4++;
} while (_local4 < minLength);
_local3.Pre.Post = undefined;
_local3.Pre.Type = 2;
_local3.Pre = undefined;
_local3.Type = 0;
_local3.TargetPos = _root.player.Position;
_local6++;
if ((_local6 % 2) == 0) {
_local3.Fed = true;
}
}
Fed = (true);
if (_local6 > 0) {
_root.snd_wormSplit.start();
}
}
function StartEat() {
if (_root.player.Eating || (!_root.alive)) {
return(undefined);
}
if (_deadTime >= _fadeDeadTime) {
return(undefined);
}
if (_type != 0) {
if (Pre.__get__Type() == 0) {
Pre.__set__Alive(false);
Pre.__set__Edible(true);
} else {
Pre.__set__Type(2);
}
Pre.Post = undefined;
if (Pre.GetHead().GetLength() < 6) {
_root.onShortWorm(Pre.GetHead());
}
} else if (!((Food == undefined) || (Food == null))) {
if (Food instanceof Munch) {
Food.__set__Alive(true);
} else {
Food.__set__Edible(true);
}
Food = undefined;
}
Alive = (false);
Pre = _root.player;
_root.player.Eating = true;
_eatingTime = 0;
}
function Eat() {
if (!_root.alive) {
return(undefined);
}
if ((Pre == undefined) || (Pre == null)) {
if (Post instanceof WormBit) {
Type = (0);
Alive = (true);
} else {
Alive = (false);
__set__Edible(true);
}
return(undefined);
}
if ((Post == undefined) || (Post == null)) {
_root.player.Eating = false;
} else {
Post.__set__EatingTime(0);
Post.Pre = _root.player;
Post.drag();
}
_root.ConsumedUp(1);
_root.PointUp(Points);
Remove();
}
function GetHead() {
if ((_type == 0) || (Pre == undefined)) {
return(this);
}
return(Pre.GetHead());
}
function GetTail() {
if (_type == 2) {
return(this);
}
return(Post.GetTail());
}
function GetLength() {
var _local3 = 1;
var _local2 = Post;
while (_local2 != undefined) {
_local3++;
_local2 = _local2.Post;
}
return(_local3);
}
function Remove() {
_root.mobInUse--;
if ((_type == 0) && (_inUse)) {
_root.wormInUse--;
}
super.Remove();
}
function Kill() {
Remove();
}
var _type = 2;
var _followDist = 12;
var _scale = 30;
var _minTurn = 0;
var _maxTurn = 0;
var _deadTime = 0;
var _fadeDeadTime = 10000;
var _reviveTime = 2000;
var _fadeRate = 3;
var _eatingTime = 0;
var _timeToEat = 5000;
var _timeToBeEaten = 500;
var _shouldSnake = false;
var _phase = 0;
var _phaseRate = 0.5;
var _phaseStrength = 0.314159265358979;
var _snakeWaitTime = 0;
var _minSnakeWait = 3000;
var _maxSnakeWait = 10000;
var _fed = false;
var _eatingSpeedMultiplier = 1.7;
var _fedSpeedMultiplier = 1.5;
var _inUse = false;
static var SEGLEN = 17;
static var ABSMAXTURN = 0.244346095279206;
var Trace = false;
}
Symbol 510 MovieClip [__Packages.RedCell] Frame 0
class RedCell extends Mob
{
var _xscale, _yscale, Points, _consumer, __get__Position, __get__Radius, __set__X, __set__Y, Remove;
function RedCell () {
super();
_xscale = (_yscale = _scale);
Edible = (true);
Points = 3;
_root.redCellInUse++;
_root.onRedCell(this);
}
function get Edible() {
return(super.__get__Edible());
}
function set Edible(val) {
if ((!Edible) && (val)) {
_consumer = undefined;
}
super.__set__Edible(val);
//return(Edible);
}
function Init(X, Y) {
super.Init();
}
function Update(elapsed) {
if (_consumer == undefined) {
if (!Edible) {
Edible = (true);
}
var _local7 = _root.enemies.length;
var _local5 = 0;
while (_local5 < _local7) {
var _local4 = _root.enemies[_local5];
if (!(_local4 instanceof WormBit)) {
} else if (_local4.Eating || (!_local4.Alive)) {
} else {
var _local6 = __get__Position().Distance(_local4.Position);
if (_local6 < __get__Radius()) {
StartEat(_local4);
break;
}
}
_local5++;
}
} else {
_eatingTime = _eatingTime + _root.elapsed;
__set__X(_consumer.X);
__set__Y(_consumer.Y);
if (_consumer.__get__Alive()) {
if (_consumer instanceof Munch) {
if (_eatingTime > _munchEatTime) {
_consumer.Eating = false;
_root.spawnMunch();
_root.ConsumedUp(1);
_root.PointUp(Points);
Eat();
}
} else if (_consumer instanceof WormBit) {
if (_eatingTime > _wormEatTime) {
_consumer.Food = undefined;
var _local7 = Math.max(2, 5 - _root.difficulty);
if ((_root.difficulty > 1) && (_consumer.GetLength() < (_local7 * 2))) {
_local7 = 2;
}
_consumer.Split(_local7);
Eat();
}
}
}
}
super.Update();
}
function StartEat(consumer) {
Edible = (false);
_eatingTime = 0;
var _local4 = false;
if (consumer == undefined) {
_consumer = _root.player;
_local4 = true;
} else {
_consumer = consumer;
}
if (_local4) {
consumer.Eating = true;
} else {
consumer.Food = this;
}
}
function Eat() {
_root.redCellInUse--;
Remove();
}
function Dropped() {
_consumer = undefined;
Edible = (true);
}
var _scale = 100;
var _eatingTime = 0;
var _munchEatTime = 500;
var _wormEatTime = 1700;
}
Symbol 503 MovieClip Frame 1
MunchPlayBtn.gotoAndStop("breathing");
Symbol 503 MovieClip Frame 10
stop();
increment = 3;
this.PlayTxt._visible = false;
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe < 24) {
this.MunchPlayBtn.gotoAndStop(this.MunchPlayBtn._currentframe + increment);
this.PlayTxt.gotoAndStop(1);
}
if (this.MunchPlayBtn._currentframe >= 24) {
this.MunchPlayBtn.gotoAndStop(24);
this.PlayTxt._visible = true;
if (this.PlayTxt._currentframe >= 1) {
if (this.PlayTxt._currentframe == 40) {
this.PlayTxt.gotoAndStop(40);
delete this.onEnterFrame;
}
if (this.PlayTxt._currentframe < 40) {
this.PlayTxt.gotoAndStop(this.PlayTxt._currentframe + increment);
}
if (this.PlayTxt._currentframe > 40) {
this.PlayTxt.gotoAndStop(this.PlayTxt._currentframe - increment);
}
}
}
};
Symbol 503 MovieClip Frame 20
stop();
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe < 24) {
this.MunchPlayBtn.gotoAndStop(this.MunchPlayBtn._currentframe + increment);
}
if ((this.PlayTxt._currentframe >= 80) || (this.PlayTxt._visible == false)) {
if (this.MunchPlayBtn._currentframe >= 24) {
if (this.MunchPlayBtn._currentframe < 50) {
this.MunchPlayBtn.gotoAndStop(this.MunchPlayBtn._currentframe + increment);
this.PlayTxt._visible = false;
this.PlayTxt.stop();
} else {
this.MunchPlayBtn.gotoAndStop("Start");
delete this.onEnterFrame;
}
}
} else {
this.PlayTxt.gotoAndStop(this.PlayTxt._currentframe + increment);
}
};
Symbol 503 MovieClip Frame 30
stop();
this.onEnterFrame = function () {
if (this.MunchPlayBtn._currentframe == 15) {
this.MunchPlayBtn.stop();
_root.gotoAndPlay("game");
}
};
Symbol 504 MovieClip Frame 1
stop();
credits_txt.htmlText = "Team members:";
credits_txt.htmlText = credits_txt.htmlText + "<u><a href=\"mailto:akai.to+infectious@gmail.com\">Chris Barrett</a></u>, <u><a href=\"mailto:chris-gingras@comcast.net\">Chris Gingras</a></u>, <u><a href=\"mailto:alex.gray.j@gmail.com\">Alex Gray</a></u>";
credits_txt.htmlText = credits_txt.htmlText + "\"Munch\" (the green guy) is copyright <u><a href=\"http://www.38studios.com/\">38 Studios</a></u>.";