Frame 1
_root.kongregateServices.connect();
stop();
Stage.showMenu = false;
this.dalink = "http://www.woogiworld.com/games-ww";
log.onPress = function () {
getURL (dalink, "_blank");
};
pbut._visible = false;
this.onEnterFrame = function () {
bt = _root.getBytesTotal();
bl = _root.getBytesLoaded();
perc = (bl / bt) * 100;
bar._xscale = perc;
if (perc >= 100) {
pbut._visible = true;
pbut.onPress = function () {
_root.gotoAndStop(3);
};
delete this.onEnterFrame;
}
};
Frame 3
stop();
Symbol 15 Button
on (release) {
getURL (_root.dalink, "_blank");
}
Symbol 21 MovieClip [pill] Frame 1
stop();
factor = 1.3;
p0 = this.attachMovie("pill_cap", "cap1", 1);
p1 = this.attachMovie("pill_cap", "cap0", 2);
p0._xscale = 150 * factor;
p0._yscale = 150 * factor;
p1._xscale = 150 * factor;
p1._yscale = 150 * factor;
p1._xscale = p1._xscale * -1;
this.w = 46 * factor;
this.h = 23 * factor;
p0.other = p1;
p1.other = p0;
p0.ind = 0;
p1.ind = 1;
this.initMe();
Symbol 26 MovieClip [pill_cap] Frame 1
this.ptype = "cap";
Symbol 31 MovieClip [pill_ball] Frame 1
this.ptype = "ball";
Symbol 32 MovieClip [virus] Frame 1
stop();
Symbol 37 MovieClip [virus1] Frame 1
this.ticker = 0;
this.onEnterFrame = function () {
this.ticker++;
if (this.ticker == 4) {
this._xscale = -100;
}
if (this.ticker == 8) {
this.ticker = 0;
this._xscale = 100;
}
};
Symbol 42 MovieClip [virus2] Frame 1
this.ticker = 0;
this.onEnterFrame = function () {
this.ticker++;
if (this.ticker == 4) {
this._xscale = -100;
}
if (this.ticker == 8) {
this.ticker = 0;
this._xscale = 100;
}
};
Symbol 47 MovieClip [virus3] Frame 1
this.ticker = 0;
this.onEnterFrame = function () {
this.ticker++;
if (this.ticker == 4) {
this._xscale = -100;
}
if (this.ticker == 8) {
this.ticker = 0;
this._xscale = 100;
}
};
Symbol 52 MovieClip [virus4] Frame 1
this.ticker = 0;
this.onEnterFrame = function () {
this.ticker++;
if (this.ticker == 4) {
this._xscale = -100;
}
if (this.ticker == 8) {
this.ticker = 0;
this._xscale = 100;
}
};
Symbol 57 MovieClip [virus5] Frame 1
this.ticker = 0;
this.onEnterFrame = function () {
this.ticker++;
if (this.ticker == 4) {
this._xscale = -100;
}
if (this.ticker == 8) {
this.ticker = 0;
this._xscale = 100;
}
};
Symbol 58 MovieClip [virus_guts] Frame 1
stop();
this.ptype = "virus";
Symbol 58 MovieClip [virus_guts] Frame 2
stop();
Symbol 58 MovieClip [virus_guts] Frame 3
stop();
Symbol 58 MovieClip [virus_guts] Frame 4
stop();
Symbol 58 MovieClip [virus_guts] Frame 5
stop();
Symbol 67 MovieClip [level_square] Frame 1
stop();
Symbol 67 MovieClip [level_square] Frame 2
stop();
Symbol 74 MovieClip [virus_explode] Frame 13
this.removeMovieClip();
Symbol 89 MovieClip Frame 1
stop();
Symbol 93 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 98 Button
on (release) {
doSound("mouse_click");
gotoAndPlay ("settings");
}
on (rollOver) {
doSound("mouse_over");
}
Symbol 144 Button
on (release) {
go();
}
on (rollOver) {
doSound("mouse_over");
}
Symbol 176 Button
on (press) {
go();
}
on (rollOver) {
doSound("mouse_over");
}
Symbol 188 MovieClip Frame 1
stop();
Symbol 188 MovieClip Frame 2
stop();
Symbol 191 MovieClip Frame 1
stop();
Symbol 191 MovieClip Frame 2
stop();
Symbol 194 MovieClip Frame 1
stop();
Symbol 194 MovieClip Frame 2
stop();
Symbol 196 Button
on (release) {
bgsong.stop();
delete bgsong;
curlevel = startlevel;
cv = 0;
while (cv < 20) {
levs[cv].removeMovieClip();
cv++;
}
doSound("mouse_click");
gotoAndPlay ("game");
}
on (rollOver) {
doSound("mouse_over");
}
Symbol 204 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 206 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 212 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 216 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 218 MovieClip Frame 1
this.cacheAsBitmap = true;
Symbol 220 MovieClip Frame 1
stop();
Symbol 220 MovieClip Frame 2
stop();
Symbol 220 MovieClip Frame 3
stop();
Symbol 221 Button
on (release) {
murderGame();
pauser.unloadMovie();
pauser.removeMovieClip();
doSound("mouse_click");
if (score > 0) {
gotoAndPlay ("results");
} else {
gotoAndPlay ("settings");
}
}
on (rollOver) {
doSound("mouse_over");
}
Symbol 247 MovieClip Frame 1
stop();
Symbol 247 MovieClip Frame 2
stop();
Symbol 247 MovieClip Frame 3
stop();
Symbol 247 MovieClip Frame 4
stop();
Symbol 247 MovieClip Frame 5
stop();
Symbol 247 MovieClip Frame 6
stop();
Symbol 247 MovieClip Frame 7
stop();
Symbol 247 MovieClip Frame 8
stop();
Symbol 247 MovieClip Frame 9
stop();
Symbol 247 MovieClip Frame 10
stop();
Symbol 256 MovieClip Frame 18
stop();
Symbol 259 MovieClip Frame 18
stop();
Symbol 260 MovieClip Frame 1
stop();
Symbol 260 MovieClip Frame 2
stop();
Symbol 269 Button
on (release) {
getURL (_root.dalink, "_blank");
}
Symbol 311 Button
on (release) {
if (this._parent.gamestarting) {
return(undefined);
}
if (this._parent.gameoverstarting) {
return(undefined);
}
this._parent.gameoverstarting = true;
gotoAndStop ("settings");
doSound("mouse_click");
bgsong.stop();
delete bgsong;
}
on (rollOver) {
doSound("mouse_over");
}
Symbol 312 MovieClip Frame 1
factor = 1.3;
difficulty = 0;
startlevel = 0;
virusesperlevel = 3;
boardcols = 8;
boardrows = 14;
ballfallrate = 5;
ballw = 46 * factor;
ballh = 23 * factor;
scale = 150;
scoreoffset = 1.5;
nextpill = null;
virustypes = 5;
scrollspeed = 1;
mainbgcols = new Array(3);
mainbgcols[0] = new Array("0xB11FC1", "0x45AFAF", "0x40D434");
mainbgcols[1] = new Array("0xE52323", "0x4F2CE36", "0x9027C1");
mainbgcols[2] = new Array("0xF8D687", "0x4CBEC1", "0x8033A2");
levelbg = new Array();
var cv = 0;
while (cv < 1000) {
levelbg.push((cv % 3) + 1);
cv++;
}
function turnDownMusic() {
this.onEnterFrame = function () {
vol = vol - 5;
s.setVolume(vol);
if (vol <= 50) {
delete this.onEnterFrame;
}
};
}
function turnUpMusic() {
vol = 50;
this.onEnterFrame = function () {
vol = vol + 5;
s.setVolume(vol);
if (vol >= 100) {
delete this.onEnterFrame;
}
};
}
function doHitTest(obj, stuff) {
if ((stuff[1] != "NaN") && (stuff[1] != "undefined")) {
return(obj.hitTest(stuff[0] * (wrap._xscale / 100), stuff[1] * (wrap._xscale / 100), stuff[2]));
}
return(obj.hitTest(stuff[0]));
}
function doSound(loc, loop) {
a = eval ("this." + loc);
if (loop) {
a.start(0, loop);
} else {
a.start();
}
return(undefined);
}
this.clear_pill = new Sound(this);
this.clear_pill.attachSound("clear_pill");
this.rotate_pill = new Sound(this);
this.rotate_pill.attachSound("rotate_pill");
this.land_pill = new Sound(this);
this.land_pill.attachSound("land_pill");
this.move_pill3 = new Sound(this);
this.move_pill3.attachSound("move_pill3");
this.move_pill2 = new Sound(this);
this.move_pill2.attachSound("move_pill2");
this.move_pill1 = new Sound(this);
this.move_pill1.attachSound("move_pill1");
this.move_pill0 = new Sound(this);
this.move_pill0.attachSound("move_pill0");
this.clear_virus = new Sound(this);
this.clear_virus.attachSound("clear_virus");
this.mouse_click = new Sound(this);
this.mouse_click.attachSound("mouse_click");
this.mouse_over = new Sound(this);
this.mouse_over.attachSound("mouse_over");
stop();
target = -1209.4;
dest = 882.4;
if (!bgsong) {
bgsong = new Sound(this);
bgsong.attachSound("bgsong1");
bgsong.start(0, 999);
}
mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
helpbut.onPress = function () {
if (this._parent.gamestarting) {
return(undefined);
}
this._parent.doSound("mouse_click");
this._parent.gotoAndPlay("instructions");
};
helpbut.onRollOver = function () {
this._parent.doSound("mouse_over");
};
function WW_Init() {
trace("WW_Init: PUT CODE HERE");
}
function WW_ReplayGame() {
trace("WW_ReplayGame: PUT CODE HERE");
stats = "STATUS: REPLAY";
stopAllSounds();
this.gameoverstarting = false;
_root.WPI_ArcadeStartSingleGame();
}
function WW_StartGame() {
trace("WW_StartGame: PUT CODE HERE");
stats = "STATUS: START";
this.gamestarting = false;
this.gotoAndPlay("settings");
}
function WW_StopGame(ob) {
trace("WW_StopGame: PUT CODE HERE");
stats = "STATUS: STOP";
}
function WW_DebugStop() {
var _local5 = this.createEmptyMovieClip("debugstop", this.getNextHighestDepth());
_local5._x = 30;
_local5._y = 30;
var _local4 = _local5.createEmptyMovieClip("bg", 0);
_local4.beginFill(16711680, 80);
_local4.moveTo(0, 0);
_local4.lineTo(0, 400);
_local4.lineTo(400, 400);
_local4.lineTo(400, 0);
_local4.lineTo(0, 0);
var _local3 = _local4.createEmptyMovieClip("btn_quit", 0);
_local3._x = 20;
_local3._y = 20;
_local3.beginFill(65280, 100);
_local3.moveTo(0, 0);
_local3.lineTo(200, 0);
_local3.lineTo(200, 40);
_local3.lineTo(0, 40);
_local3.lineTo(0, 0);
_local3.endFill();
_local3.createTextField("txt", 0, 0, 0, 200, 40);
_local3.txt.text = "Quit";
_local3.txt.selectable = false;
_local3.onPress = function () {
this._parent._parent._parent._visible = false;
this._parent._parent.removeMovieClip();
};
_local3 = _local4.createEmptyMovieClip("btn_replay", 1);
_local3._x = 20;
_local3._y = 80;
_local3.beginFill(65280, 100);
_local3.moveTo(0, 0);
_local3.lineTo(200, 0);
_local3.lineTo(200, 40);
_local3.lineTo(0, 40);
_local3.lineTo(0, 0);
_local3.endFill();
_local3.createTextField("txt", 0, 0, 0, 200, 40);
_local3.txt.text = "Replay";
_local3.txt.selectable = false;
_local3.onPress = function () {
_root.pluginMessageReceived("ww_arcade", "UserArcadeReplaySingleGame", {});
this._parent._parent.removeMovieClip();
};
}
function WPI_Plugin(plugin, action, ob) {
if (plugin == "ww_arcade") {
switch (action) {
case "UserArcadeReplaySingleGame" :
trace("REPLY: REPLAY GAME");
_root.reref.WW_ReplayGame();
break;
case "UserArcadeStartSingleGame" :
trace("REPLY: START GAME");
_root.reref.WW_StartGame();
break;
case "UserArcadeStopSingleGame" :
var _local3 = Number(ob.newwogs);
var _local5 = Number(ob.newpoints);
var _local4 = Number(ob.medal);
trace((((("REPLY: STOP GAME W: " + _local3) + " P: ") + _local5) + " M: ") + _local4);
_root.reref.WW_StopGame(ob);
}
}
}
function WPI_ArcadeStartSingleGame() {
trace("LOOPBACK: WPI_ArcadeStartSingleGame()");
_root.pluginMessageReceived("ww_arcade", "UserArcadeStartSingleGame", {});
}
function WPI_ArcadeStopSingleGame(score) {
trace(("LOOPBACK: WPI_ArcadeStopSingleGame(" + score) + ")");
_root.pluginMessageReceived("ww_arcade", "UserArcadeStopSingleGame", {newwogs:100, newpoints:0, medal:1});
}
_root.pluginMessageReceived = WPI_Plugin;
_root.reref = this;
this.WW_Init();
Symbol 312 MovieClip Frame 2
function go() {
doSound("mouse_click");
gotoAndPlay ("instructions2");
}
stop();
target = -1209.4;
dest = 882.4;
this.aup = false;
this.onEnterFrame = function () {
if (!Key.isDown(65)) {
this.aup = true;
}
if (Key.isDown(65) && (this.aup)) {
delete this.onEnterFrame;
go();
}
};
mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
Symbol 312 MovieClip Frame 3
function go() {
doSound("mouse_click");
gotoAndPlay ("instructions3");
}
stop();
target = -1209.4;
dest = 882.4;
this.aup = false;
this.onEnterFrame = function () {
if (!Key.isDown(65)) {
this.aup = true;
}
if (Key.isDown(65) && (this.aup)) {
delete this.onEnterFrame;
go();
}
};
mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
Symbol 312 MovieClip Frame 4
function go() {
doSound("mouse_click");
gotoAndPlay ("title");
}
stop();
target = -1209.4;
dest = 882.4;
this.aup = false;
this.onEnterFrame = function () {
if (!Key.isDown(65)) {
this.aup = true;
}
if (Key.isDown(65) && (this.aup)) {
delete this.onEnterFrame;
go();
}
};
mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
Symbol 312 MovieClip Frame 5
stop();
mainbut.onPress = function () {
_root.reref.murderGame();
bgsong.stop();
delete bgsong;
cv = 0;
while (cv < 20) {
levs[cv].removeMovieClip();
cv++;
}
cv = 0;
while (cv < 20) {
levs[cv].unloadMovie();
cv++;
}
doSound("mouse_click");
this._parent.gotoAndStop(1);
};
if (!bgsong) {
bgsong = new Sound(this);
bgsong.attachSound("bgsong1");
bgsong.start(0, 999);
}
var cv = 0;
while (cv < 3) {
d = eval ("this.diff" + cv);
d.ind = cv;
if (cv == difficulty) {
d.gotoAndPlay("selected");
}
d.onPress = function () {
dd = eval ("this.diff" + difficulty);
dd.gotoAndPlay("normal");
difficulty = this.ind;
this.gotoAndPlay("selected");
};
cv++;
}
levs = new Array();
var cv = 0;
while (cv < 20) {
l = attachMovie("level_square", "level_square" + cv, cv);
levs.push(l);
if (cv == startlevel) {
l.gotoAndPlay("selected");
}
l._x = 193.8 + (50 * (cv % 10));
l._y = 224.8 + (50 * int(cv / 10));
l.daval = cv + 1;
l.ind = cv;
l.onPress = function () {
ll = eval ("this.level_square" + startlevel);
ll.gotoAndPlay("normal");
startlevel = this.ind;
this.gotoAndPlay("selected");
};
cv++;
}
target = -1209.4;
dest = 882.4;
mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
Symbol 312 MovieClip Frame 6
function toggleMuse() {
if (museon) {
museon = false;
bgsong.stop();
} else {
museon = true;
bgsong.start(0, 999);
}
}
function initGame() {
pauser._visible = false;
pauser.swapDepths(999);
downkey = true;
resulthead._visible = false;
resulthead.swapDepths(5000);
switch (curlevel) {
case 0 :
sickwoog.gotoAndStop("h6");
break;
case 1 :
sickwoog.gotoAndStop("h3");
break;
default :
sickwoog.gotoAndStop("h0");
}
bgcols = mainbgcols[levelbg[curlevel] - 1];
multiplier = 1;
pillcount = 0;
elapsed = 0;
levelviruses = (curlevel + 1) * virusesperlevel;
if (levelviruses > 80) {
levelviruses = 80;
}
viruses = 0;
curpill = null;
ballfall = false;
curballfallrate = 1;
offset = 4 + int((20 - curlevel) / (boardrows / 8));
if (offset < 4) {
offset = 4;
}
if (offset > 10) {
offset = 10;
}
bg.gotoAndStop("bg" + levelbg[curlevel]);
target = bg.guts.mover._x - bg.guts.mover._width;
dest = bg.guts.mover2._x;
bg.guts.mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
bg.guts.mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
vtypes = new Array();
var _local3 = 0;
while (_local3 < 3) {
ok = false;
while (!ok) {
tmp = int(Math.random() * virustypes);
ok = true;
var _local2 = 0;
while (_local2 < vtypes.length) {
if (vtypes[_local2] == tmp) {
ok = false;
}
_local2++;
}
}
vtypes.push(tmp);
_local3++;
}
setupBoard();
updateScoreBoard();
}
function updateScoreBoard() {
var _local2 = "";
_local2 = _local2 + (("Level: " + (curlevel + 1)) + newline);
_local2 = _local2 + (("Score: " + score) + newline);
_local2 = _local2 + ("Viruses: " + viruses);
if (gamepaused) {
_local2 = _local2 + "\n\n** PAUSED **";
}
scoreboard = _local2;
_root.kongregateStats.submit("highScore", score);
}
function setupBoard() {
dep = 1;
board = new Array();
allpills = new Array();
allviruses = new Array();
pil = this.createEmptyMovieClip("pil", dep++);
vir = this.createEmptyMovieClip("vir", dep++);
screens = this.createEmptyMovieClip("screens", dep++);
cv = 0;
while (cv < boardcols) {
board.push(new Array());
cv2 = 0;
while (cv2 < boardrows) {
board[cv].push(0);
cv2++;
}
cv++;
}
vircols = new Array(0, 0, 0);
curv = 0;
while (curv < levelviruses) {
invalid = true;
dacol = -1;
clearcheck = 3;
v = null;
lastv = -1;
while (invalid) {
if (lastv == curv) {
board[v.col][v.row] = null;
v.removeMovieClip();
}
v = vir.attachMovie("virus", "virus" + curv, curv);
p0 = v.attachMovie("virus_guts", "cap0", 1);
p0.ind = 0;
v.ind = curv;
vx = int(Math.random() * boardcols);
vy = int(Math.random() * (boardrows - offset)) + offset;
while (board[vx][vy]._visible) {
vx = int(Math.random() * boardcols);
vy = int(Math.random() * (boardrows - offset)) + offset;
}
v.col = vx;
v.row = vy;
v._xscale = 150 * factor;
v._yscale = 150 * factor;
v._x = ((400 - ((ballw * boardcols) / 4)) + (v.col * (ballw / 2))) + (4 * factor);
v._y = (300 - (ballh * ((boardrows / 2) - 1))) + (v.row * ballh);
board[vx][vy] = v.cap0;
v.setCol = function (dacol) {
this.cap0.gotoAndPlay("v" + vtypes[dacol]);
var _local3 = new Color(this.cap0.vir.col);
_local3.setRGB(bgcols[dacol]);
this.cap0.val = dacol + 1;
this.capcol0 = dacol + 1;
};
if (dacol > 0) {
vircols[dacol]--;
}
dacol = int(Math.random() * 3);
vircols[dacol]++;
v.setCol(dacol);
invalid = false;
if (!invalid) {
if (checkVirus(-1, 0, vx, vy) >= 2) {
invalid = true;
}
}
if (!invalid) {
if (checkVirus(1, 0, vx, vy) >= 2) {
invalid = true;
}
}
if (!invalid) {
if (checkVirus(0, -1, vx, vy) >= 2) {
invalid = true;
}
}
if (!invalid) {
if (checkVirus(0, 1, vx, vy) >= 2) {
invalid = true;
}
}
if (!invalid) {
if (checkVirus2(1, 0, vx, vy)) {
invalid = true;
}
}
if (!invalid) {
if (checkVirus2(0, 1, vx, vy)) {
invalid = true;
}
}
lastv = curv;
}
allviruses.push(v);
viruses++;
curv++;
}
missingcolor = true;
while (missingcolor) {
missingcolor = false;
cv = 0;
while (cv < vircols.length) {
if (vircols[cv] == 0) {
missingcolor = true;
randv = int(Math.random() * allviruses.length);
vircols[allviruses[randv].capcol0 - 1]--;
allviruses[randv].setCol(cv);
vircols[cv]++;
}
cv++;
}
}
cv = 0;
while (cv < vircols.length) {
p = eval ("petri" + cv);
p._visible = true;
p.attachMovie("virus" + (vtypes[cv] + 1), "vir", 1);
p._xscale = (150 * factor) * 1.5;
p._yscale = (150 * factor) * 1.5;
p.setCol = function (dacol) {
var _local2 = new Color(this.vir.col);
_local2.setRGB(bgcols[dacol]);
this.val = dacol + 1;
};
p.setCol(cv);
cv++;
}
}
function checkVirus(dx, dy, x, y) {
val = board[x][y].val;
curx = x;
cury = y;
count = 0;
cv = 0;
while (cv < 3) {
curx = curx + dx;
cury = cury + dy;
if (board[curx][cury]._visible && (board[curx][cury].val == val)) {
count++;
}
cv++;
}
return(count);
}
function checkVirus2(dx, dy, x, y) {
val = board[x][y].val;
count = 0;
cv = x - dx;
while (cv <= (x + (dx * 2))) {
cv2 = y - dy;
while (cv2 <= (y + (dy * 2))) {
if (board[cv][cv2]._visible && (board[cv][cv2].val == val)) {
count++;
}
cv2++;
}
cv++;
}
if (count >= 3) {
return(true);
}
count = 0;
cv = x - (dx * 2);
while (cv <= (x + dx)) {
cv2 = y - (dy * 2);
while (cv2 <= (y + dy)) {
if (board[cv][cv2]._visible && (board[cv][cv2].val == val)) {
count++;
}
cv2++;
}
cv++;
}
if (count >= 3) {
return(true);
}
return(false);
}
function startGame() {
clearcheck = 4;
getNextPill();
addPill((boardcols / 2) - 1, 0);
gamestarted = true;
gamepaused = false;
this.onEnterFrame = function () {
if ((!gamestarted) || (gamepaused)) {
return(undefined);
}
if (ballfall) {
curballfallrate--;
if (curballfallrate == 0) {
curballfallrate = ballfallrate;
changed = false;
var _local1 = 0;
while (_local1 < allpills.length) {
if (allpills[_local1].cap0._visible || (allpills[_local1].cap1._visible)) {
allpills[_local1].row++;
if (ballIsStuck(allpills[_local1])) {
allpills[_local1].row--;
} else {
allpills[_local1].row--;
pushPop(allpills[_local1], false);
allpills[_local1].row++;
pushPop(allpills[_local1], true);
allpills[_local1].resetPos();
changed = true;
}
}
_local1++;
}
if (!changed) {
clearem = new Array();
_local1 = 0;
while (_local1 < allpills.length) {
if (allpills[_local1].cap0._visible || (allpills[_local1].cap1._visible)) {
switch (allpills[_local1]._rotation) {
case 0 :
case 180 :
coff = 1;
roff = 0;
break;
case 90 :
case -90 :
case 270 :
coff = 0;
roff = -1;
}
checkPill(0, 1, allpills[_local1].col, allpills[_local1].row);
checkPill(1, 0, allpills[_local1].col, allpills[_local1].row);
checkPill(0, 1, allpills[_local1].col + coff, allpills[_local1].row + roff);
checkPill(1, 0, allpills[_local1].col + coff, allpills[_local1].row + roff);
}
_local1++;
}
curpill = null;
ballfall = false;
checkCleared();
}
}
} else {
if (Key.isDown(40)) {
if (!downkey) {
movePill(0, 1);
}
} else {
downkey = false;
}
falling--;
if (falling <= 0) {
movePill(0, 1);
}
}
};
}
function pushPop(p, push) {
switch (p._rotation) {
case 0 :
case 180 :
coff = 1;
roff = 0;
break;
case 90 :
case -90 :
coff = 0;
roff = -1;
}
if (!push) {
switch (p._rotation) {
case 0 :
case -90 :
if (p.cap0._visible) {
board[p.col][p.row] = null;
}
if (p.cap1._visible) {
board[p.col + coff][p.row + roff] = null;
}
break;
default :
if (p.cap1._visible) {
board[p.col][p.row] = null;
}
if (!p.cap0._visible) {
break;
}
board[p.col + coff][p.row + roff] = null;
}
} else {
switch (p._rotation) {
case 0 :
case -90 :
if (p.cap0._visible) {
board[p.col][p.row] = p.cap0;
}
if (p.cap1._visible) {
board[p.col + coff][p.row + roff] = p.cap1;
}
break;
default :
if (p.cap1._visible) {
board[p.col][p.row] = p.cap1;
}
if (!p.cap0._visible) {
break;
}
board[p.col + coff][p.row + roff] = p.cap0;
}
}
}
function resetFalling() {
falling = (10 + (10 * (2 - difficulty))) - elapsed;
}
function checkPill(dx, dy, x, y) {
if (!board[x][y]._visible) {
return(undefined);
}
curx = x;
cury = y;
curval = board[x][y].val;
while (((curx >= 0) && (cury >= 0)) && (board[curx][cury].val == curval)) {
curx = curx - dx;
cury = cury - dy;
}
curx = curx + dx;
cury = cury + dy;
count = 0;
tmp = new Array();
while (((curx < boardcols) && (cury < boardrows)) && (board[curx][cury].val == curval)) {
tmp.push(new Array(curx, cury));
curx = curx + dx;
cury = cury + dy;
count++;
}
if (count >= clearcheck) {
cv = 0;
while (cv < tmp.length) {
t = new Array();
t[0] = 0 + tmp[cv][0];
t[1] = 0 + tmp[cv][1];
canadd = true;
cv2 = 0;
while (cv2 < clearem.length) {
if ((clearem[cv2][0] == t[0]) && (clearem[cv2][1] == t[1])) {
canadd = false;
}
cv2++;
}
if (canadd) {
clearem.push(t);
}
cv++;
}
}
}
function checkCleared() {
if (clearem.length >= 4) {
ballfall = true;
hadavirus = 0;
cv = 0;
while (cv < clearem.length) {
thex = clearem[cv][0];
they = clearem[cv][1];
if ((board[thex][they].ptype == "virus") && (board[thex][they]._visible)) {
hadavirus++;
viruses--;
var explod = screens.attachMovie("virus_explode", (("v" + thex) + "_") + they, 1000 + hadavirus);
explod._x = board[thex][they]._parent._x + 1;
explod._y = board[thex][they]._parent._y;
explod._xscale = (explod._xscale * 2) * factor;
explod._yscale = (explod._yscale * 2) * factor;
addtoScore(hadavirus);
vircols[board[thex][they].val - 1]--;
if (vircols[board[thex][they].val - 1] == 0) {
var cv2 = 0;
while (cv2 < vircols.length) {
p = eval ("petri" + cv2);
if (p.val == board[thex][they].val) {
var explod = screens.attachMovie("virus_explode", (("v" + thex) + "_") + they, 2000 + hadavirus);
explod._x = p._x + 21;
explod._y = p._y;
explod._xscale = (explod._xscale * 3) * factor;
explod._yscale = (explod._yscale * 3) * factor;
p._visible = false;
}
cv2++;
}
}
}
if (board[thex][they].other) {
replaceCap(board[thex][they]);
}
board[thex][they].val = 0;
board[thex][they]._visible = false;
cv++;
}
if (hadavirus) {
doSound("clear_pill");
doSound("clear_virus");
multiplier = multiplier * 2;
} else {
doSound("clear_pill");
}
updateScoreBoard();
if (viruses == 0) {
sickwoog.gotoAndStop("h9");
beatLevel();
return(undefined);
}
switch (curlevel) {
case 0 :
healthlevel = "h" + int((((levelviruses - viruses) / levelviruses) * 3) + 6);
break;
case 1 :
healthlevel = "h" + int((((levelviruses - viruses) / levelviruses) * 6) + 3);
break;
default :
healthlevel = "h" + int((((levelviruses - viruses) / levelviruses) * 10) - 1);
}
sickwoog.gotoAndStop(healthlevel);
} else {
ballfall = false;
curballfallrate = 1;
addPill((boardcols / 2) - 1, 0);
resetBonuses();
downkey = true;
}
}
function addtoScore(num) {
s = 200 * Math.pow(2, num - 1);
score = score + (s * multiplier);
}
function resetBonuses() {
multiplier = 1;
}
function showBoard() {
trace("----------------");
cv = 0;
while (cv < boardrows) {
str = "";
cv2 = 0;
while (cv2 < boardcols) {
if (!board[cv2][cv].val) {
str = str + "0|";
} else {
str = str + (board[cv2][cv].val + "|");
}
cv2++;
}
trace(str);
cv++;
}
trace("----------------");
}
function replaceCap(obj) {
if (!obj._parent) {
return(undefined);
}
daparent = obj._parent;
if (obj.ind == 1) {
pp = daparent.attachMovie("pill_ball", "cap1", 1);
pp._xscale = 150 * factor;
pp._yscale = 150 * factor;
pp.other = null;
pp.ind = 1;
daparent.setCol1(daparent.capcol1 - 1);
} else {
pp = daparent.attachMovie("pill_ball", "cap0", 2);
pp._xscale = 150 * factor;
pp._yscale = 150 * factor;
pp._xscale = pp._xscale * -1;
pp.other = null;
pp.ind = 0;
daparent.setCol0(daparent.capcol0 - 1);
}
}
function getNextPill() {
c0 = int(Math.random() * vtypes.length);
c1 = int(Math.random() * vtypes.length);
nextpill = new Array(c0, c1);
np.setCol0 = function (dacol) {
var _local3 = new Color(this.cap0.col);
_local3.setRGB(bgcols[dacol]);
this.cap0.val = dacol + 1;
this.capcol0 = dacol + 1;
};
np.setCol1 = function (dacol) {
var _local3 = new Color(this.cap1.col);
_local3.setRGB(bgcols[dacol]);
this.cap1.val = dacol + 1;
this.capcol1 = dacol + 1;
};
np.setCol0(c0);
np.setCol1(c1);
}
function addPill(cv, cv2) {
resetFalling();
p = pil.attachMovie("pill", "pill" + pillcount, pillcount);
allpills.push(p);
p.ind = pillcount;
p.col = cv;
p.row = cv2;
p.initMe = function () {
this.resetPos();
this.setCol0(nextpill[0]);
this.setCol1(nextpill[1]);
getNextPill();
};
p.resetPos = function () {
switch (this._rotation) {
case 0 :
case 180 :
this._x = ((400 - ((this.w * boardcols) / 4)) + (this.col * (this.w / 2))) + (4 * factor);
this._y = (300 - (this.h * ((boardrows / 2) - 1))) + (this.row * this.h);
break;
case -90 :
case 90 :
this._x = (((400 - ((this.w * boardcols) / 4)) - (this.w / 4)) + (this.col * (this.w / 2))) + (4 * factor);
this._y = (((300 - (this.h * ((boardrows / 2) - 1))) - (this.h / 4)) - (5.5 * factor)) + (this.row * this.h);
}
};
p.setCol0 = function (dacol) {
var _local3 = new Color(this.cap0.col);
_local3.setRGB(bgcols[dacol]);
this.cap0.val = dacol + 1;
this.capcol0 = dacol + 1;
};
p.setCol1 = function (dacol) {
var _local3 = new Color(this.cap1.col);
_local3.setRGB(bgcols[dacol]);
this.cap1.val = dacol + 1;
this.capcol1 = dacol + 1;
};
pillcount++;
curpill = p;
if (pillIsStuck(curpill._rotation)) {
lostLevel();
}
}
function rotatePill(deg) {
oldrot = 0 + curpill._rotation;
oldcol = 0 + curpill.col;
oldrow = 0 + curpill.row;
curpill._rotation = curpill._rotation + deg;
if (curpill._rotation < 0) {
curpill._rotation = curpill._rotation + 360;
}
newrot = 0 + curpill._rotation;
rot = curpill._rotation;
if (pillIsStuck(rot) || (((rot == 0) || (rot == 180)) && (curpill.col == (boardcols - 1)))) {
switch (rot) {
case 0 :
case 180 :
curpill.col--;
break;
case 90 :
case -90 :
case 270 :
curpill.row++;
}
if ((pillIsStuck(rot) || (((rot == 0) || (rot == 180)) && (curpill.col == (boardcols - 1)))) || (((rot == 0) || (rot == 180)) && (curpill.col == -1))) {
curpill.col = oldcol;
curpill.row = oldrow;
curpill._rotation = oldrot;
}
}
curpill.resetPos();
}
function pillIsStuck(rot) {
switch (rot) {
case 0 :
case 180 :
coff = 1;
roff = 0;
break;
case 90 :
case -90 :
case 270 :
coff = 0;
roff = -1;
}
if ((((rot == 90) || (rot == -90)) || (rot == 270)) && (curpill.row == 0)) {
return(false);
}
return(board[curpill.col][curpill.row]._visible || (board[curpill.col + coff][curpill.row + roff]._visible));
}
function ballIsStuck(ball) {
switch (ball._rotation) {
case 0 :
case 180 :
coff = 1;
roff = 0;
if (ball.row > (boardrows - 1)) {
return(true);
}
break;
case 90 :
case -90 :
coff = 0;
roff = -1;
if (ball._rotation == -90) {
if ((ball.cap0._visible && (ball.row > (boardrows - 1))) || (((!ball.cap0._visible) && (ball.cap1._visible)) && (ball.row > boardrows))) {
return(true);
}
} else {
if (!((ball.cap1._visible && (ball.row > (boardrows - 1))) || (((!ball.cap1._visible) && (ball.cap0._visible)) && (ball.row > boardrows)))) {
break;
}
return(true);
}
}
switch (ball._rotation) {
case 0 :
return((ball.cap0._visible && (board[ball.col][ball.row]._visible)) || (ball.cap1._visible && (board[ball.col + coff][ball.row + roff]._visible)));
case 180 :
return((ball.cap1._visible && (board[ball.col][ball.row]._visible)) || (ball.cap0._visible && (board[ball.col + coff][ball.row + roff]._visible)));
case -90 :
return((ball.cap0._visible && (board[ball.col][ball.row]._visible)) || (((!ball.cap0._visible) && (ball.cap1._visible)) && (board[ball.col][ball.row - 1]._visible)));
case 90 :
return((ball.cap1._visible && (board[ball.col][ball.row]._visible)) || (((!ball.cap1._visible) && (ball.cap0._visible)) && (board[ball.col][ball.row - 1]._visible)));
}
}
function movePill(dx, dy) {
if (!curpill) {
return(undefined);
}
if ((dy == 0) && (curpill.row == -1)) {
return(undefined);
}
if (dy > 0) {
resetFalling();
}
stuck = false;
curpill.col = curpill.col + dx;
curpill.row = curpill.row + dy;
if (curpill.col < 0) {
curpill.col = 0;
}
switch (curpill._rotation) {
case 0 :
case 180 :
if (curpill.col > (boardcols - 2)) {
curpill.col = boardcols - 2;
}
break;
default :
if (curpill.col <= (boardcols - 1)) {
break;
}
curpill.col = boardcols - 1;
}
switch (curpill._rotation) {
case 0 :
case 180 :
coff = 1;
roff = 0;
break;
case 90 :
case -90 :
coff = 0;
roff = -1;
}
if (curpill.row > (boardrows - 1)) {
stuck = true;
curpill.row = boardrows - 1;
} else if (pillIsStuck(curpill._rotation)) {
if (dy) {
stuck = true;
}
curpill.col = curpill.col - dx;
curpill.row = curpill.row - dy;
}
curpill.resetPos();
if (stuck) {
doSound("land_pill");
if (((curpill._rotation == 90) || (curpill._rotation == -90)) && (curpill.row == 0)) {
if (curpill._rotation == 90) {
c = curpill.cap1;
} else {
c = curpill.cap0;
}
c.other._visible = false;
c.other.val = 0;
replaceCap(c.other);
}
clearem = new Array();
switch (curpill._rotation) {
case 0 :
case -90 :
if (curpill.cap0._visible) {
board[curpill.col][curpill.row] = curpill.cap0;
}
if (curpill.cap1._visible) {
board[curpill.col + coff][curpill.row + roff] = curpill.cap1;
}
break;
default :
if (curpill.cap1._visible) {
board[curpill.col][curpill.row] = curpill.cap1;
}
if (!curpill.cap0._visible) {
break;
}
board[curpill.col + coff][curpill.row + roff] = curpill.cap0;
}
checkPill(0, 1, curpill.col, curpill.row);
checkPill(1, 0, curpill.col, curpill.row);
checkPill(0, 1, curpill.col + coff, curpill.row + roff);
checkPill(1, 0, curpill.col + coff, curpill.row + roff);
checkCleared();
}
}
function go() {
doSound("mouse_click");
nextlevelbut._visible = false;
curlevel++;
if (difficulty == 0) {
_root.kongregateStats.submit("maxLevelSlow", curlevel);
}
if (difficulty == 1) {
_root.kongregateStats.submit("maxLevelMedium", curlevel);
}
if (difficulty == 2) {
_root.kongregateStats.submit("maxLevelFast", curlevel);
}
initGame();
startGame();
}
function beatLevel() {
cumulativeviruses = cumulativeviruses + levelviruses;
gamestarted = false;
updateScoreBoard();
nextlevelbut._visible = true;
this.onEnterFrame = function () {
if (!Key.isDown(65)) {
this.aup = true;
}
if (Key.isDown(65) && (this.aup)) {
delete this.onEnterFrame;
go();
}
};
nextlevelbut.onPress = function () {
delete this.onPress;
go();
};
nextlevelbut.onRollOver = function () {
doSound("mouse_over");
};
resulthead.gotoAndStop("state0");
resulthead.goodjorb.gotoAndPlay(1);
resulthead._visible = true;
}
function lostLevel() {
cumulativeviruses = cumulativeviruses + (levelviruses - viruses);
gamestarted = false;
resulthead.gotoAndStop("state1");
resulthead.badjorb.gotoAndPlay(1);
resulthead._visible = true;
updateScoreBoard();
bgsong.stop();
delete bgsong;
}
function murderGame() {
cv = 0;
while (cv < vircols.length) {
p = eval ("petri" + cv);
p.vir.removeMovieClip();
cv++;
}
resulthead._visible = false;
pil.removeMovieClip();
vir.removeMovieClip();
screens.removeMovieClip();
curpill.removeMovieClip();
delete this.onEnterFrame;
Key.removeListener(this.keyob);
bgsong.stop();
delete bgsong;
}
stop();
trace("difficulty: " + difficulty);
gamestarted = true;
gamepaused = false;
nextlevelbut._visible = false;
origlevel = startlevel;
cumulativeviruses = 0;
score = 0;
bgsong = new Sound(this);
bgsong.attachSound("bgsong0");
bgsong.start(0, 999);
this.museon = true;
sickwoog.onEnterFrame = function () {
if (!Key.isDown(77)) {
this.mup = true;
}
if (Key.isDown(77) && (this.mup)) {
this.mup = false;
this._parent.toggleMuse();
}
};
muse.onPress = function () {
this._parent.toggleMuse();
};
initGame();
startGame();
this.keyob = new Object();
this.keyob.onKeyDown = function () {
if (!gamestarted) {
return(undefined);
}
presskey = Key.getCode();
switch (presskey) {
case 37 :
if ((!ballfall) && (!gamepaused)) {
doSound("move_pill" + int(curpill.row / 4));
movePill(-1, 0);
}
return;
case 39 :
if ((!ballfall) && (!gamepaused)) {
doSound("move_pill" + int(curpill.row / 4));
movePill(1, 0);
}
return;
case 40 :
return;
case 65 :
if ((!ballfall) && (!gamepaused)) {
doSound("rotate_pill");
rotatePill(-90);
}
return;
case 83 :
if ((!ballfall) && (!gamepaused)) {
doSound("rotate_pill");
rotatePill(90);
}
return;
case 68 :
showBoard();
return;
case 80 :
gamepaused = !gamepaused;
pauser._visible = !pauser._visible;
updateScoreBoard();
return;
default :
trace(presskey);
}
};
Key.addListener(this.keyob);
Symbol 312 MovieClip Frame 7
stop();
startlevel = origlevel + 1;
endlevel = curlevel + 1;
scoretxt = score;
virustxt = cumulativeviruses;
viruslefttxt = viruses;
target = mover._x - 1133;
dest = mover2._x;
if (!bgsong) {
bgsong = new Sound(this);
bgsong.attachSound("bgsong2");
bgsong.start();
}
mover.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
mover2.onEnterFrame = function () {
this._x = this._x - scrollspeed;
if (Math.abs(this._x - target) <= scrollspeed) {
this._x = dest;
}
};
donebut.onPress = function () {
doSound("mouse_click");
_root.WPI_CloseGame(3, null);
delete this.onPress;
};
donebut.onRollOver = function () {
doSound("mouse_over");
};