Frame 1
function set100() {
Stage.scaleMode = "noScale";
}
function deadClick() {
}
function clearfood() {
x = 0;
while (x < 6) {
food[x].onboard = false;
food[x].type = 0;
food[x].xp = 0;
food[x].yp = 0;
food[x].xvel = 0;
food[x].yvel = 0;
food[x].xacc = 0;
food[x].yacc = 0;
food[x].dist = -1;
x++;
}
}
function continuegame() {
if (gamestate == "gameover") {
newgame(level);
gamestate = "playing";
}
}
function newgame(ngl) {
clearfood();
score = 0;
level = ngl;
numfood = 4;
if (level >= 6) {
numfood = 5;
}
if (level >= 12) {
numfood = 6;
}
purple = 0;
togo = Math.min((level * 5) + 15, 100);
threshold = 500;
if (level > maxlevel) {
prob = 0;
} else {
prob = level;
}
}
function rect(x, y, w, h, c) {
bmp.fillRect(new flash.geom.Rectangle(x, y, w, h), c);
}
function printgameover() {
m.a = 2;
m.d = 2;
m.ty = 176;
m.tx = 10;
bmp.draw(gameover, m);
}
function printclick() {
m.a = 2;
m.d = 2;
m.ty = 176;
m.tx = 10;
bmp.draw(click, m);
}
function printscore(ps) {
m.a = 2;
m.d = 2;
m.ty = 6;
if (level >= 10) {
m.tx = 10;
bmp.draw(nums[int(level / 10) % 10], m);
m.tx = 26;
bmp.draw(nums[level % 10], m);
} else {
m.tx = 10;
bmp.draw(nums[level % 10], m);
}
if (ps >= 1000) {
m.tx = 90;
bmp.draw(nums[int(ps / 1000) % 10], m);
}
if (ps >= 100) {
m.tx = 106;
bmp.draw(nums[int(ps / 100) % 10], m);
}
if (ps >= 10) {
m.tx = 122;
bmp.draw(nums[int(ps / 10) % 10], m);
}
m.tx = 138;
bmp.draw(nums[ps % 10], m);
p = 1;
while (p <= 5) {
if (purple >= p) {
m.a = 1;
m.d = 1;
m.ty = 4;
m.tx = (8 * p) + 36;
bmp.draw(pics[0], m);
}
p++;
}
}
function printmong() {
if (gamestate == "playing") {
if ((q % 15) < 5) {
mongmouth = 0;
} else {
mongmouth = 1;
}
} else {
mongmouth = 0;
}
m.a = (m.d = 1);
m.tx = mongx;
m.ty = mongy;
bmp.draw(mong[mongmouth], m);
}
function printfood() {
pf = 0;
while (pf < numfood) {
if (food[pf].onboard) {
m.a = (m.d = 1);
m.tx = food[pf].xp;
m.ty = food[pf].yp;
bmp.draw(pics[food[pf].type], m);
}
pf++;
}
}
function printlevelup() {
m.a = (m.d = 1);
m.tx = 49 + Math.abs(15 - (q % 30));
m.ty = 92;
bmp.draw(levelup, m);
delay--;
if (delay == 0) {
gamestate = "before";
}
}
function printtoomuch() {
m.a = (m.d = 1);
m.tx = 49 + Math.abs(15 - (q % 30));
m.ty = 92;
bmp.draw(toomuch, m);
delay--;
if (delay == 0) {
gamestate = "gameover";
if (score > highscore) {
highscore = score;
}
}
}
function printscreen() {
rect(4, 22, 152, 1, 11154346);
rect(4, 169, 152, 1, 11154346);
switch (gamestate) {
case "gameover" :
if (q < 90) {
printscore(score);
} else {
printscore(highscore);
}
if ((q < 45) || (q > 135)) {
printgameover();
} else {
printclick();
}
break;
case "before" :
printscore(score);
printclick();
break;
case "playing" :
printscore(score);
printfood();
break;
case "levelup" :
printscore(score);
printlevelup();
break;
case "endgame" :
printscore(score);
printtoomuch();
}
printmong();
}
function newlevel() {
level = (level % 100) + 1;
if (level > maxlevel) {
prob = 0;
} else {
prob = level;
}
togo = Math.min((level * 5) + 15, 100);
mongx = 120;
mongy = 92;
if (level >= 6) {
numfood = 5;
}
if (level >= 12) {
numfood = 6;
}
gamestate = "before";
}
function foodout(w) {
soundfoodout.stop();
soundfoodout.start(0, 0);
togo--;
if (food[w].onboard == false) {
food[w].onboard = true;
food[w].xp = 4;
food[w].yp = (random(int(96 / numfood)) + 34) + ((120 / numfood) * w);
if ((chances[prob][8] != 0) && ((chances[prob][9] == 1) || (random(2) == 0))) {
food[w].xvel = random((chances[prob][1] - chances[prob][0]) + 1) + chances[prob][0];
food[w].yvel = 0;
food[w].xacc = 0;
food[w].yacc = 0;
figure(w, chances[prob][8]);
} else {
food[w].xvel = random((chances[prob][1] - chances[prob][0]) + 1) + chances[prob][0];
food[w].yvel = (random((chances[prob][3] - chances[prob][2]) + 1) + chances[prob][2]) * ((random(2) * 2) - 1);
food[w].xacc = random((chances[prob][5] - chances[prob][4]) + 1) + chances[prob][4];
food[w].yacc = (random((chances[prob][7] - chances[prob][6]) + 1) + chances[prob][6]) * ((random(2) * 2) - 1);
food[w].dist = -1;
}
if (random(100) < ((level * 40) / (level + 5))) {
food[w].type = 0;
} else if (random(20) == 0) {
food[w].type = 12;
} else {
food[w].type = random(Math.min(11, level + 2)) + 1;
}
}
}
function figure(fn, sd) {
food[fn].dist = 20;
if (sd == 1) {
picker = random(3) * 2;
} else {
picker = random(5);
}
food[fn].xvel = 0;
food[fn].yvel = 0;
if ((picker != 0) && (picker != 4)) {
food[fn].xvel = random((chances[prob][1] - chances[prob][0]) + 1) + chances[prob][0];
}
if (picker < 2) {
food[fn].yvel = (random((chances[prob][3] - chances[prob][2]) + 1) + chances[prob][2]) * -1;
}
if (picker > 2) {
food[fn].yvel = random((chances[prob][3] - chances[prob][2]) + 1) + chances[prob][2];
}
}
function between(vv, ll, hh) {
if ((vv >= ll) && (vv <= hh)) {
return(true);
}
return(false);
}
function checklevelend() {
endlevel = true;
cl = 0;
while (cl < numfood) {
if (food[cl].onboard || (togo > 0)) {
endlevel = false;
}
cl++;
}
return(endlevel);
}
focusRect = false;
tabEnabled = false;
var my_cm = new ContextMenu();
var nop = new ContextMenuItem("Anonymous D", deadClick);
nop.separatorBefore = false;
my_cm.customItems.push(nop);
var nop = new ContextMenuItem("Mongler 2600", deadClick);
nop.separatorBefore = false;
my_cm.customItems.push(nop);
var nop = new ContextMenuItem("Instructions:", deadClick);
nop.separatorBefore = true;
my_cm.customItems.push(nop);
var nop = new ContextMenuItem("Don't mongle purple cocks!", deadClick);
nop.separatorBefore = false;
my_cm.customItems.push(nop);
var nop = new ContextMenuItem("Continue Game", continuegame);
nop.separatorBefore = true;
my_cm.customItems.push(nop);
var nop = new ContextMenuItem("100% (No Scale)", set100);
nop.separatorBefore = true;
my_cm.customItems.push(nop);
_root.menu = my_cm;
bmp = new flash.display.BitmapData(160, 192, false, 4288230246);
inmask.createEmptyMovieClip("pic", 1000);
inmask.attachBitmap(bmp, 1);
inmask._xscale = 200;
chances = new Array();
chances[0] = new Array(3, 9, 3, 6, 0, 1, 0, 1, 2, 0);
chances[1] = new Array(1, 2, 0, 0, 0, 0, 0, 0, 0, 0);
chances[2] = new Array(1, 2, 0, 0, 0, 0, 0, 0, 0, 0);
chances[3] = new Array(1, 3, 0, 0, 0, 0, 0, 0, 0, 0);
chances[4] = new Array(1, 3, 0, 0, 0, 0, 0, 0, 0, 0);
chances[5] = new Array(1, 2, 0, 1, 0, 0, 0, 0, 0, 0);
chances[6] = new Array(1, 3, 0, 1, 0, 0, 0, 0, 0, 0);
chances[7] = new Array(1, 3, 0, 2, 0, 0, 0, 0, 0, 0);
chances[8] = new Array(1, 4, 0, 1, 0, 0, 0, 0, 0, 0);
chances[9] = new Array(2, 4, 0, 0, 0, 0, 0, 0, 0, 0);
chances[10] = new Array(2, 5, 0, 0, 0, 0, 0, 0, 0, 0);
chances[11] = new Array(2, 4, 1, 2, 0, 0, 0, 0, 0, 0);
chances[12] = new Array(2, 5, 0, 3, 0, 0, 0, 0, 0, 0);
chances[13] = new Array(1, 5, 0, 0, 1, 1, 0, 0, 0, 0);
chances[14] = new Array(1, 2, 1, 5, 0, 0, 1, 1, 0, 0);
chances[15] = new Array(1, 5, 1, 3, 1, 1, 0, 0, 0, 0);
chances[16] = new Array(1, 5, 1, 5, 1, 1, 1, 1, 0, 0);
chances[17] = new Array(2, 6, 1, 5, 0, 1, 0, 0, 0, 0);
chances[18] = new Array(2, 6, 1, 5, 0, 0, 0, 1, 0, 0);
chances[19] = new Array(2, 6, 1, 5, 0, 1, 0, 1, 0, 0);
chances[20] = new Array(1, 2, 1, 1, 0, 0, 0, 0, 1, 1);
chances[21] = new Array(1, 3, 1, 2, 0, 0, 0, 0, 1, 1);
chances[22] = new Array(2, 4, 1, 3, 0, 0, 0, 0, 1, 1);
chances[23] = new Array(1, 3, 1, 1, 0, 0, 0, 0, 2, 1);
chances[24] = new Array(2, 4, 1, 2, 0, 0, 0, 0, 2, 1);
chances[25] = new Array(1, 5, 1, 3, 0, 0, 0, 0, 1, 0);
chances[26] = new Array(2, 5, 2, 4, 0, 1, 0, 0, 1, 0);
chances[27] = new Array(2, 2, 2, 6, 0, 0, 0, 1, 0, 0);
chances[28] = new Array(2, 5, 2, 4, 0, 1, 0, 1, 2, 0);
chances[29] = new Array(2, 6, 2, 6, 0, 1, 0, 1, 2, 0);
chances[30] = new Array(6, 6, 0, 0, 0, 0, 0, 0, 0, 0);
chances[31] = new Array(6, 6, 1, 1, 0, 0, 0, 0, 0, 0);
chances[32] = new Array(6, 6, 2, 6, 0, 0, 0, 0, 0, 0);
chances[33] = new Array(6, 6, 6, 6, 0, 0, 0, 0, 1, 1);
chances[34] = new Array(6, 6, 6, 6, 0, 0, 0, 0, 2, 1);
chances[35] = new Array(1, 8, 1, 6, 0, 1, 0, 1, 0, 0);
chances[36] = new Array(1, 8, 1, 6, 0, 1, 0, 1, 0, 0);
chances[37] = new Array(2, 8, 2, 6, 0, 1, 0, 1, 0, 0);
chances[38] = new Array(2, 9, 2, 6, 0, 1, 0, 1, 1, 0);
chances[39] = new Array(3, 9, 3, 6, 0, 1, 0, 1, 1, 0);
maxlevel = 39;
pics = new Array();
x = 0;
while (x < 13) {
var tempbmp = flash.display.BitmapData.loadBitmap(("s" + x) + ".png");
pics[x] = tempbmp;
x++;
}
nums = new Array();
x = 0;
while (x < 10) {
var tempbmp = flash.display.BitmapData.loadBitmap(("n" + x) + ".png");
nums[x] = tempbmp;
x++;
}
mong = new Array();
x = 0;
while (x < 2) {
var tempbmp = flash.display.BitmapData.loadBitmap(("mong" + x) + ".png");
mong[x] = tempbmp;
x++;
}
var click = flash.display.BitmapData.loadBitmap("click.png");
var gameover = flash.display.BitmapData.loadBitmap("gameover.png");
var levelup = flash.display.BitmapData.loadBitmap("levelup.png");
var toomuch = flash.display.BitmapData.loadBitmap("toomuch.png");
_root.createEmptyMovieClip("holdeat", 11);
var soundeat = new Sound(holdeat);
soundeat.attachSound("eat.wav");
_root.createEmptyMovieClip("holdpurple", 12);
var soundpurple = new Sound(holdpurple);
soundpurple.attachSound("purple.wav");
_root.createEmptyMovieClip("holdfoodout", 13);
var soundfoodout = new Sound(holdfoodout);
soundfoodout.attachSound("foodout.wav");
_root.createEmptyMovieClip("holdlevelup", 14);
var soundlevelup = new Sound(holdlevelup);
soundlevelup.attachSound("levelup.wav");
_root.createEmptyMovieClip("holdgameover", 15);
var soundgameover = new Sound(holdgameover);
soundgameover.attachSound("gameover.wav");
_root.createEmptyMovieClip("holdthreshold", 16);
var soundthreshold = new Sound(holdthreshold);
soundthreshold.attachSound("threshold.wav");
food = new Array();
x = 0;
while (x < 6) {
food[x] = new Object();
x++;
}
highscore = 0;
q = 0;
mongx = 128;
mongy = 92;
newgame(1);
gamestate = "gameover";
var m = (new flash.geom.Matrix());
this.onEnterFrame = function () {
rect(0, 0, 160, 192, 0);
printscreen();
q = (q + 1) % 180;
if ((gamestate == "levelup") || (gamestate == "endgame")) {
newx = 128;
diffx = Math.min(Math.abs(mongx - newx), 3);
if (mongx < newx) {
mongx = mongx + diffx;
}
if (mongx > newx) {
mongx = mongx - diffx;
}
newy = 92;
diffy = Math.min(Math.abs(mongy - newy), 6);
if (mongy < newy) {
mongy = mongy + diffy;
}
if (mongy > newy) {
mongy = mongy - diffy;
}
}
if (gamestate == "playing") {
newx = Math.max(4, Math.min(148, int((_xmouse - 7) / 2)));
diffx = Math.min(Math.abs(mongx - newx), 3);
if (mongx < newx) {
mongx = mongx + diffx;
}
if (mongx > newx) {
mongx = mongx - diffx;
}
newy = Math.max(25, Math.min(151, int(_ymouse - 9)));
diffy = Math.min(Math.abs(mongy - newy), 6);
if (mongy < newy) {
mongy = mongy + diffy;
}
if (mongy > newy) {
mongy = mongy - diffy;
}
fo = 0;
while (fo < numfood) {
if ((food[fo].onboard == false) && (togo > 0)) {
if (random(level + 70) < (3 * level)) {
foodout(fo);
}
}
fo++;
}
if (checklevelend()) {
gamestate = "levelup";
}
mf = 0;
while (mf < numfood) {
if (food[mf].onboard) {
food[mf].xvel = food[mf].xvel + food[mf].xacc;
if (food[mf].xvel >= chances[prob][1]) {
food[mf].xacc = Math.abs(food[mf].xacc) * -1;
}
if (food[mf].xvel <= chances[prob][0]) {
food[mf].xacc = Math.abs(food[mf].xacc);
}
food[mf].yvel = food[mf].yvel + food[mf].yacc;
if (food[mf].yvel >= chances[prob][3]) {
food[mf].yacc = Math.abs(food[mf].yacc) * -1;
}
if (food[mf].yvel <= (chances[prob][3] * -1)) {
food[mf].yacc = Math.abs(food[mf].yacc);
}
food[mf].xp = food[mf].xp + food[mf].xvel;
food[mf].yp = food[mf].yp + food[mf].yvel;
if (food[mf].yp > 151) {
food[mf].yacc = food[mf].yacc * -1;
food[mf].yvel = Math.abs(food[mf].yvel) * -1;
food[mf].yp = food[mf].yp + food[mf].yvel;
}
if (food[mf].yp < 25) {
food[mf].yacc = food[mf].yacc * -1;
food[mf].yvel = Math.abs(food[mf].yvel);
food[mf].yp = food[mf].yp + food[mf].yvel;
}
if (food[mf].xp >= (155 - pics[food[mf].type].width)) {
food[mf].onboard = false;
if (checklevelend()) {
gamestate = "levelup";
}
}
if (food[mf].dist > 0) {
food[mf].dist--;
}
if (food[mf].dist == 0) {
figure(mf, chances[prob][8]);
}
}
mf++;
}
cc = 0;
while (cc < numfood) {
if (food[cc].onboard) {
if ((between(food[cc].xp, mongx, mongx + 7) || (between((food[cc].xp + pics[food[cc].type].width) - 1, mongx, mongx + 7))) && (between(food[cc].yp, mongy, mongy + 15) || (between((food[cc].yp + pics[food[cc].type].height) - 1, mongy, mongy + 15)))) {
food[cc].onboard = false;
if (food[cc].type != 0) {
score = score + food[cc].type;
if (food[cc].type == 11) {
score--;
}
if (food[cc].type == 12) {
score = score + Math.min(level - 8, 8);
}
soundeat.stop();
soundeat.start(0, 0);
if (checklevelend()) {
gamestate = "levelup";
}
} else {
purple++;
soundpurple.stop();
soundpurple.start(0, 0);
}
}
}
cc++;
}
if (score >= threshold) {
purple = Math.max(0, purple - 1);
threshold = threshold + 500;
if (score >= 10000) {
threshold = 30000;
}
if (score >= 20000) {
score = score - 10000;
}
soundeat.stop();
soundthreshold.start(0, 0);
}
if (purple >= 6) {
gamestate = "endgame";
delay = 120;
soundgameover.stop();
soundgameover.start(0, 0);
}
if (gamestate == "levelup") {
delay = 60;
soundlevelup.stop();
soundlevelup.start(0, 0);
}
}
};
this.onMouseDown = function () {
if (gamestate == "gameover") {
newgame(1);
gamestate = "playing";
}
if (gamestate == "before") {
newlevel();
gamestate = "playing";
}
};