Frame 1
function clearScreen() {
removeMovieClip("Interface");
removeMovieClip("Map");
}
function levelUp() {
level++;
if ((trashAtStart + 2) < trashMax) {
trashAtStart = trashAtStart + 2;
}
if ((numOfBins - 1) >= numOfBinsMin) {
numOfBins--;
}
if ((litterbugsAtStart + 1) < litterbugsMax) {
litterbugsAtStart++;
}
if ((litterbugDropChance + 1) < litterbugDropChanceMax) {
litterbugDropChance = litterbugDropChance + 1;
}
removeMovieClip("Map");
gotoAndPlay ("Play");
}
function setupMap() {
binTiles = [];
freeTiles = [];
binIndex = 1;
_root.createEmptyMovieClip("Map", 1);
var _local4 = 1;
while (_local4 <= mapHeight) {
var _local5 = _root[(("level" + _root.mapNum) + "Row") + _local4];
var _local3 = 1;
while (_local3 <= mapWidth) {
var _local6 = whatNumber(_local3, _local4);
if (_local5[_local3 - 1] > 0) {
if (_local5[_local3 - 1] == 1) {
binTiles.push(_local6);
} else {
Map.attachMovie("maptile" + _local5[_local3 - 1], "MapTile" + _local6, (_local4 * 1000) + _local3);
theMapTile = Map["MapTile" + _local6];
theMapTile._x = (_local3 * tileWidth) - (tileWidth / 2);
theMapTile._y = (_local4 * tileHeight) - (tileWidth / 2);
if (_local5[_local3 - 1] == 4) {
theMapTile.gotoAndStop(randInt(1, 3));
}
}
} else {
freeTiles.push(_local6);
}
_local3++;
}
_local4++;
}
shuffle(binTiles);
var _local9 = 0;
while (_local9 < binTiles.length) {
var _local6 = binTiles[_local9];
var _local7 = whatRow(_local6);
var _local8 = whatColumn(_local6);
if (_local9 < numOfBins) {
Map.attachMovie("maptile" + binIndex, "MapTile" + _local6, (_local7 * 1000) + _local8);
theBin = Map["MapTile" + _local6];
theBin._x = (_local8 * tileWidth) - (tileWidth / 2);
theBin._y = (_local7 * tileHeight) - (tileWidth / 2);
theBin.trashType = binIndex;
theBin.onEnterFrame = function () {
if (this._currentframe == 1) {
if (this.Collider.hitTest(Map.Player.Collider)) {
if (_root.trashHeld.length != 0) {
_root.dumpTrash(this);
}
}
}
};
if (binIndex < binIndexMax) {
binIndex++;
} else {
binIndex = 1;
}
} else {
Map.attachMovie("maptile6", "MapTile" + _local6, (_local7 * 1000) + _local8);
theMapTile = Map["MapTile" + _local6];
theMapTile._x = (_local8 * tileWidth) - (tileWidth / 2);
theMapTile._y = (_local7 * tileHeight) - (tileWidth / 2);
}
_local9++;
}
}
function spawnTrash(theTile) {
if (theTile == undefined) {
do {
match = false;
var _local5 = randInt(0, freeTiles.length);
theTile = freeTiles[_local5];
var _local8 = whatRow(theTile);
var _local9 = whatColumn(theTile);
var _local6 = Math.abs(Map.Player.currentRow - _local8);
var _local7 = Math.abs(Map.Player.currentColumn - _local9);
if ((_local7 <= 6) && (_local6 <= 4)) {
match = true;
}
} while (match == true);
freeTiles.splice(_local5, 1);
} else {
var _local8 = whatRow(theTile);
var _local9 = whatColumn(theTile);
var _local3 = 0;
while (_local3 < freeTiles.length) {
if (freeTiles[_local3] == theTile) {
freeTiles.splice(_local3, 1);
}
_local3++;
}
}
totalTrash++;
var _local11 = randInt(1, 3);
var _local10 = randInt(1, 3);
Map.attachMovie("trash" + _local11, "Trash" + trashIndex, (_local8 * 1000) + _local9);
theTrash = Map["Trash" + trashIndex];
theTrash.gotoAndPlay(_local10);
theTrash.myFrame = _local10;
theTrash.myID = trashIndex;
theTrash.myType = _local11;
trashActive.push(theTrash);
theTrash._x = (_local9 * tileWidth) - 25;
theTrash._y = (_local8 * tileHeight) - 25;
theTrash.currentTile = theTile;
theTrash.currentRow = _local8;
theTrash.currentColumn = _local9;
theTrash.onEnterFrame = function () {
if (gameInPlay) {
if (_root.trashHeld.length < _root.maxTrashHeld) {
if (this.Collider.hitTest(Map.Player.Collider)) {
pickupTrash(this);
}
}
}
};
if (trashIndex < trashIndexMax) {
trashIndex++;
} else {
trashIndex = 1;
}
}
function pickupTrash(theTrash) {
SFX.gotoAndPlay("PickupTrash");
trashHeld.push(theTrash.myType);
trashFrames.push(theTrash.myFrame);
updateInventory();
removeTrash(theTrash);
}
function updateInventory(theType, theIcon) {
var _local1 = 1;
while (_local1 <= 5) {
removeMovieClip(Interface.Inventory["Trash" + _local1]);
Interface.Inventory.attachMovie("trash" + trashHeld[_local1 - 1], "Trash" + _local1, _local1);
var _local2 = Interface.Inventory["Trash" + _local1];
_local2.gotoAndStop(trashFrames[_local1 - 1]);
_local2._x = Interface.Inventory["Slot" + _local1]._x;
_local2._y = Interface.Inventory["Slot" + _local1]._y;
_local1++;
}
}
function dumpTrash(theBin) {
var _local1 = 0;
while (_local1 < trashHeld.length) {
if (trashHeld[_local1] == theBin.trashType) {
SFX.gotoAndPlay("DumpTrash" + theBin.trashType);
theBin.gotoAndPlay("Dump" + trashFrames[_local1]);
trashHeld.splice(_local1, 1);
trashFrames.splice(_local1, 1);
totalTrash--;
score = score + trashPoints;
if ((totalTrash == 0) && (numOfLitterbugs == 0)) {
gotoAndPlay ("WinLevel");
}
break;
}
_local1++;
}
updateInventory();
}
function removeTrash(theTrash) {
freeTiles.push(theTrash.currentTile);
var _local1 = 0;
while (_local1 < trashActive.length) {
if (trashActive[_local1] == theTrash) {
trashActive.splice(_local1, 1);
}
_local1++;
}
removeMovieClip(theTrash);
}
function spawnLitterbug() {
do {
match = false;
var _local6 = randInt(0, freeTiles.length);
var _local10 = freeTiles[_local6];
var _local4 = whatRow(_local10);
var _local5 = whatColumn(_local10);
var _local7 = Math.abs(Map.Player.currentRow - _local4);
var _local8 = Math.abs(Map.Player.currentColumn - _local5);
if ((_local8 <= 6) && (_local7 <= 4)) {
match = true;
}
} while (match == true);
_local10 = whatNumber(_local5, _local4);
numOfLitterbugs++;
var _local9 = randInt(1, litterbugTypes);
Map.attachMovie("litterbug" + _local9, "Litterbug" + litterbugIndex, ((_local4 * 1000) + litterbugDepth) + litterbugIndex);
theLitterbug = Map["Litterbug" + litterbugIndex];
litterbugsActive.push(theLitterbug);
theLitterbug._x = (_local5 * tileWidth) - 25;
theLitterbug._y = (_local4 * tileHeight) - 25;
theLitterbug.myIndex = litterbugIndex;
theLitterbug.currentTile = _local10;
theLitterbug.currentRow = _local4;
theLitterbug.currentColumn = _local5;
theLitterbug.currentDir = "Down";
theLitterbug.speed = litterbugSpeed;
theLitterbug.reformed = false;
theLitterbug.onEnterFrame = function () {
if (_root.gameInPlay) {
this.Anim.Clip.play();
this.lastDir = this.currentDir;
this.lastTile = this.currentTile;
this.currentRow = Math.ceil(this._y / tileHeight);
this.currentColumn = Math.ceil(this._x / tileWidth);
this.currentTile = whatNumber(this.currentColumn, this.currentRow);
if (this.currentTile != this.lastTile) {
if ((!this.reformed) && (_root.totalTrash < _root.trashMax)) {
if (_root.randInt(1, 100) < _root.litterbugDropChance) {
var _local3 = 0;
while (_local3 < freeTiles.length) {
if (freeTiles[_local3] == this.currentTile) {
Interface.TrashIcon.gotoAndPlay("Drop");
SFX.gotoAndPlay("LitterbugDrop");
spawnTrash(this.currentTile);
break;
}
_local3++;
}
}
}
if (_root.randInt(1, 10) == 1) {
this.currentDir = chooseLitterbugDir(this);
}
}
moveClip(this);
this.swapDepths(((this.currentRow * 1000) + _root.litterbugDepth) + this.myIndex);
if (this.Collider.hitTest(Map.Player.Collider)) {
if (!this.reformed) {
_root.numOfLitterbugs--;
this.reformed = true;
SFX.gotoAndPlay("ConvertLitterbug");
this.gotoAndStop("Reformed");
score = score + litterbugPoints;
if ((totalTrash == 0) && (numOfLitterbugs == 0)) {
gotoAndPlay ("WinLevel");
}
}
}
} else {
this.Clip.Anim.stop();
}
};
if (litterbugIndex < litterbugIndexMax) {
litterbugIndex++;
} else {
litterbugIndex = 1;
}
}
function chooseLitterbugDir(theClip) {
var _local1 = randInt(1, 4);
if (_local1 == 1) {
dir = "Up";
} else if (_local1 == 2) {
dir = "Down";
} else if (_local1 == 3) {
dir = "Left";
} else {
dir = "Right";
}
return(dir);
}
function moveClip(theClip) {
theClip.obstacleHit = false;
if (theClip.currentDir == "Up") {
var _local4 = theClip._x;
var _local3 = theClip._y - theClip.speed;
var _local17 = _local4;
var _local15 = _local3 - tileHalf;
var _local13 = _local4 - tileEdge;
var _local12 = _local3 - tileEdge;
var _local20 = _local4 + tileEdge;
var _local18 = _local3 - tileEdge;
} else if (theClip.currentDir == "Down") {
var _local4 = theClip._x;
var _local3 = theClip._y + theClip.speed;
var _local17 = _local4;
var _local15 = _local3 + tileHalf;
var _local13 = _local4 - tileEdge;
var _local12 = _local3 + tileEdge;
var _local20 = _local4 + tileEdge;
var _local18 = _local3 + tileEdge;
} else if (theClip.currentDir == "Left") {
var _local4 = theClip._x - theClip.speed;
var _local3 = theClip._y;
var _local17 = _local4 - tileHalf;
var _local15 = _local3;
var _local7 = _local4 - tileEdge;
var _local29 = _local3 - tileEdge;
var _local30 = _local4 - tileEdge;
var _local27 = _local3 + tileEdge;
} else if (theClip.currentDir == "Right") {
var _local4 = theClip._x + theClip.speed;
var _local3 = theClip._y;
var _local17 = _local4 + tileHalf;
var _local15 = _local3;
var _local7 = _local4 + tileEdge;
var _local29 = _local3 - tileEdge;
var _local30 = _local4 + tileEdge;
var _local27 = _local3 + tileEdge;
}
if (theClip == Map.Player) {
var _local19 = theClip.Anim._currentframe;
theClip.gotoAndStop(theClip.currentDir);
theClip.Anim.gotoAndPlay(_local19);
} else {
var _local19 = theClip.Clip.Anim._currentframe;
theClip.Clip.gotoAndStop(theClip.currentDir);
theClip.Clip.Anim.gotoAndPlay(_local19);
}
var _local6 = Math.ceil(_local15 / tileHeight);
var _local5 = Math.ceil(_local17 / tileWidth);
var _local9 = _root[(("level" + _root.mapNum) + "Row") + _local6];
if ((theClip.currentDir == "Up") || (theClip.currentDir == "Down")) {
var _local21 = Math.ceil(_local12 / tileHeight);
var _local25 = Math.ceil(_local13 / tileWidth);
var _local28 = _root[(("level" + _root.mapNum) + "Row") + _local21];
var _local24 = Math.ceil(_local18 / tileHeight);
var _local16 = Math.ceil(_local20 / tileWidth);
var _local8 = _root[(("level" + _root.mapNum) + "Row") + _local24];
} else if ((theClip.currentDir == "Left") || (theClip.currentDir == "Right")) {
var _local11 = Math.ceil(_local29 / tileHeight);
var _local14 = Math.ceil(_local7 / tileWidth);
var _local26 = _root[(("level" + _root.mapNum) + "Row") + _local11];
var _local22 = Math.ceil(_local27 / tileHeight);
var _local23 = Math.ceil(_local30 / tileWidth);
var _local10 = _root[(("level" + _root.mapNum) + "Row") + _local22];
}
if ((_local6 > 0) && (_local6 <= mapHeight)) {
if ((_local5 > 0) && (_local5 <= mapWidth)) {
if (_local9[_local5 - 1] == 0) {
if ((theClip.currentDir == "Up") || (theClip.currentDir == "Down")) {
if ((_local28[_local25 - 1] != 0) || (_local8[_local16 - 1] != 0)) {
var _local4 = ((theClip.currentColumn - 1) * tileWidth) + tileHalf;
}
} else if ((theClip.currentDir == "Left") || (theClip.currentDir == "Right")) {
if ((_local26[_local14 - 1] != 0) || (_local10[_local23 - 1] != 0)) {
var _local3 = ((theClip.currentRow - 1) * tileHeight) + tileHalf;
}
}
} else if ((theClip.currentDir == "Up") || (theClip.currentDir == "Down")) {
theClip.obstacleHit = true;
var _local3 = ((theClip.currentRow - 1) * tileHeight) + tileHalf;
} else if ((theClip.currentDir == "Left") || (theClip.currentDir == "Right")) {
theClip.obstacleHit = true;
var _local4 = ((theClip.currentColumn - 1) * tileWidth) + tileHalf;
}
} else {
theClip.obstacleHit = true;
var _local4 = ((theClip.currentColumn - 1) * tileWidth) + tileHalf;
}
} else {
theClip.obstacleHit = true;
var _local3 = ((theClip.currentRow - 1) * tileHeight) + tileHalf;
}
if (theClip != Map.Player) {
if (theClip.obstacleHit) {
if (theClip.currentDir == "Up") {
if (randInt(1, 2) == 1) {
theClip.currentDir = "Left";
} else {
theClip.currentDir = "Right";
}
} else if (theClip.currentDir == "Down") {
if (randInt(1, 2) == 1) {
theClip.currentDir = "Left";
} else {
theClip.currentDir = "Right";
}
} else if (theClip.currentDir == "Left") {
if (randInt(1, 2) == 1) {
theClip.currentDir = "Up";
} else {
theClip.currentDir = "Down";
}
} else if (theClip.currentDir == "Right") {
if (randInt(1, 2) == 1) {
theClip.currentDir = "Up";
} else {
theClip.currentDir = "Down";
}
}
}
}
theClip._x = _local4;
theClip._y = _local3;
}
function centerMap(theSpeed) {
if (theSpeed == undefined) {
theSpeed = 1;
}
var _local2 = new Object({x:Map.Player._x, y:Map.Player._y});
Map.Player._parent.localToGlobal(_local2);
var _local4 = _local2.x;
var _local3 = _local2.y;
Map._x = Map._x + ((centerX - _local4) / theSpeed);
Map._y = Map._y + ((centerY - _local3) / theSpeed);
Fence._x = Fence._x + ((centerX - _local4) / theSpeed);
Fence._y = Fence._y + ((centerY - _local3) / theSpeed);
}
function addTime(secsAdded) {
minutesLeft = minutesLeft + Math.floor(secsAdded / 60);
secondsLeft = secondsLeft + (secsAdded % 60);
minutesLeft = minutesLeft + Math.floor(secondsLeft / 60);
secondsLeft = secondsLeft % 60;
}
function decrementTimer() {
if (gameInPlay) {
if (secondsLeft == 0) {
if (minutesLeft == 0) {
clearInterval(timerCode);
gotoAndPlay ("GameOver");
} else {
secondsLeft = 59;
minutesLeft--;
}
} else {
secondsLeft--;
}
}
}
function setTimerDigits(theMins, theSecs, theClip) {
minutesText = String(theMins);
secondsText = String(theSecs);
if (minutesText.length < 2) {
theClip.mins1 = "";
theClip.mins2 = minutesText;
} else {
theClip.mins1 = minutesText.substr(0, 1);
theClip.mins2 = minutesText.substr(1, 1);
}
if (secondsText.length < 2) {
theClip.secs1 = "0";
theClip.secs2 = secondsText;
} else {
theClip.secs1 = secondsText.substr(0, 1);
theClip.secs2 = secondsText.substr(1, 1);
}
if ((theMins <= freakOutMins) && (theSecs <= freakOutSecs)) {
SFX.gotoAndPlay("StartTimerFreakOut");
theClip.gotoAndStop("FreakOut");
} else {
SFX.gotoAndPlay("StopTimerFreakOut");
theClip.gotoAndStop("Normal");
}
}
function whatNumber(theColumn, theRow) {
var _local1 = ((theRow - 1) * mapWidth) + theColumn;
return(_local1);
}
function whatRow(theTile) {
var _local1 = Math.ceil(theTile / mapWidth);
return(_local1);
}
function whatColumn(theTile) {
var _local1 = theTile % mapWidth;
if (_local1 == 0) {
_local1 = mapWidth;
}
return(_local1);
}
function randInt(num0, num1) {
if (arguments.length == 1) {
return(Math.round(Math.random() * num0));
}
return(Math.round(Math.random() * Math.abs(num0 - num1)) + num0);
}
function shuffle(theArray) {
i = 0;
while (i < (theArray.length - 1)) {
var _local2 = Math.round(Math.random() * i);
var _local3 = theArray[i];
theArray[i] = theArray[_local2];
theArray[_local2] = _local3;
i++;
}
return(theArray);
}
fscommand ("allowscale", false);
stop();
var trackerVars_get = new LoadVars();
var trackerVars_send = new LoadVars();
trackerVars_send.gameID = _root.gameID;
trackerVars_get.onLoad = function (success) {
if (success) {
}
};
addGamePlay = function () {
trackerVars_send.sendAndLoad(_root.trackerURL, trackerVars_get, "POST");
};
_global.home = this;
gk1 = "stuTest";
home.userInfoURL = "http://games.zeeks.com/php/userInfo.php";
home.highScoresURL = "http://games.zeeks.com/php/addHighScore.php";
home.userKey = "agqs8xo4a6ozxdrumivhl98jmatd4q";
loadVariables (userInfoURL, this.getNextHighestDepth());
gotKey = true;
_global.loadScores = function (score, obj) {
delete home.scoreList;
home.scoreList = new LoadVars();
home.scoreList.onLoad = function (success) {
if (success) {
for (var _local1 in home.scoreList) {
}
setScores(1, obj);
} else {
setScores(0, obj);
}
};
if (score != undefined) {
home.scoreList.load(score);
} else {
var _local2 = (home.highScoresURL + "?gk=") + home.gk1;
home.scoreList.load(_local2);
}
};
_global.getScores = function (score, obj) {
if ((score != undefined) || (score != null)) {
var _local1 = score;
var _local3 = (((((((((home.highScoresURL + "?gk=") + home.gk1) + "&uk=") + home.userKey) + "&s=") + _local1) + "&es=") + encrypt(_local1)) + "&sd=") + home.seed;
loadScores(_local3, obj);
} else {
loadScores(null, obj);
}
};
_global.setScores = function (type, obj) {
if (type) {
if (home.scoreList.rank != undefined) {
home.returnedInfo = "Good Job, you've made the list. Your RANK is " + home.scoreList.rank;
} else {
home.returnedInfo = "You're score did not make the list";
}
var _local1 = 1;
while (_local1 <= 10) {
obj["total_" + _local1] = (home.scoreList[("hs_" + _local1) + "_score"] + " pts - ") + home.scoreList[("hs_" + _local1) + "_username"];
_local1++;
}
}
};
_global.encrypt = function (encScore) {
encScore = encScore.toString();
my_date = new Date();
my_date.hours = my_date.getUTCHours();
my_date.minutes = my_date.getUTCMinutes();
my_date.seconds = my_date.getUTCSeconds();
if (my_date.seconds < 10) {
my_date.seconds = "0" + my_date.seconds;
}
if (my_date.minutes < 10) {
my_date.minutes = "0" + my_date.minutes;
}
if (my_date.hours < 10) {
my_date.hours = "0" + my_date.hours;
}
home.seed = ((((my_date.hours + ":") + my_date.minutes) + ":") + my_date.seconds) + ":28";
charList = new Array(2, 8, 10, 5, 4, 1, 11, 7);
keyChars = new Array();
i = 0;
while (i < 8) {
var _local1 = charList[i];
keyChars.push(seed.charAt(_local1 - 1));
i++;
}
snafuText = "";
i = 0;
while (i < encScore.length) {
tempHolder = keyChars.shift();
keyChars.push(tempHolder);
tempName = "ascii" + i;
tempName = encScore.charCodeAt(i) + Math.round(tempHolder);
snafuText = snafuText + String.fromCharCode(tempName);
i++;
}
return(snafuText);
};
_global.home = this;
gk1 = "michaelRecycle";
loadVariables (userInfoURL, this.getNextHighestDepth());
gotKey = true;
_global.loadScores = function () {
delete home.scoreList;
home.scoreList = new LoadVars();
trace("Initiating Load");
home.scoreList.onLoad = function (success) {
if (success) {
trace("Highscores loaded successfully.");
for (var _local1 in home.scoreList) {
trace((_local1 + " -> ") + home.scoreList[_local1]);
}
setScores(1);
} else {
setScores(0);
trace("An error occurred while loading highscores.");
}
};
if ((arguments[0] != undefined) || (arguments[0] != null)) {
trace("You have submitted a score to the list");
home.scoreList.load(arguments[0]);
} else {
var _local3 = (home.highScoresURL + "?gk=") + home.gk1;
trace("You have requested the highscore list");
home.scoreList.load(_local3);
}
};
_global.getScores = function () {
if ((arguments[0] != undefined) || (arguments[0] != null)) {
var _local2 = arguments[0];
var _local3 = (((((((((home.highScoresURL + "?gk=") + home.gk1) + "&uk=") + home.userKey) + "&s=") + _local2) + "&es=") + encrypt(_local2)) + "&sd=") + home.seed;
loadScores(_local3);
} else {
loadScores();
}
};
_global.setScores = function (type) {
if (type) {
if ((home.scoreList.rank != undefined) || (home.scoreList.rank != null)) {
home.returnedInfo = "Good Job, you've made the list. Your RANK is " + home.scoreList.rank;
} else {
home.returnedInfo = "You're score did not make the list";
}
var _local1 = 1;
while (_local1 <= 10) {
home[("hs_" + _local1) + "_score"] = home.scoreList[("hs_" + _local1) + "_score"];
home[("hs_" + _local1) + "_username"] = home.scoreList[("hs_" + _local1) + "_username"];
_local1++;
}
}
};
_global.encrypt = function (encScore) {
encScore = encScore.toString();
my_date = new Date();
my_date.hours = my_date.getUTCHours();
my_date.minutes = my_date.getUTCMinutes();
my_date.seconds = my_date.getUTCSeconds();
if (my_date.seconds < 10) {
my_date.seconds = "0" + my_date.seconds;
}
if (my_date.minutes < 10) {
my_date.minutes = "0" + my_date.minutes;
}
if (my_date.hours < 10) {
my_date.hours = "0" + my_date.hours;
}
home.seed = ((((my_date.hours + ":") + my_date.minutes) + ":") + my_date.seconds) + ":28";
charList = new Array(2, 8, 10, 5, 4, 1, 11, 7);
keyChars = new Array();
i = 0;
while (i < 8) {
var _local1 = charList[i];
keyChars.push(seed.charAt(_local1 - 1));
i++;
}
snafuText = "";
i = 0;
while (i < encScore.length) {
tempHolder = keyChars.shift();
keyChars.push(tempHolder);
tempName = "ascii" + i;
tempName = encScore.charCodeAt(i) + Math.round(tempHolder);
snafuText = snafuText + String.fromCharCode(tempName);
i++;
}
return(snafuText);
};
local = new LocalConnection();
domain = local.domain();
var fs = domain.indexOf("funschool.kaboose");
var fsdev = domain.indexOf("fundev.kaboose");
var zk = domain.indexOf("zeeks");
var dev = domain.indexOf("localhost");
if ((fs >= 0) || (fsdev >= 0)) {
highBTN._visible = false;
} else {
highBTN._visible = true;
}
var trackerVars_get = new LoadVars();
var trackerVars_send = new LoadVars();
trackerVars_send.gameID = _root.gameID;
trackerVars_get.onLoad = function (success) {
if (success) {
trace("Your gameplay has been tracked succesfully");
}
};
addGamePlay = function () {
trace("ADD GAMEPLAY NOW!");
trace("Game ID: " + trackerVars_send.gameID);
trackerVars_send.sendAndLoad(_root.trackerURL, trackerVars_get, "POST");
};
Frame 10
stop();
Frame 20
if ((fs >= 0) || (fsdev >= 0)) {
gotoAndPlay ("Title");
} else if (score == null) {
getScores(null, _root.scoreContainer_mc);
} else {
getScores(_root.score, _root.scoreContainer_mc);
}
stop();
Frame 30
var level = 1;
var score = 0;
var gameInPlay = false;
var playerStartRow = 2;
var playerStartColumn = 2;
var playerSpeed = 8;
var playerDepth = 500;
var playerBusy = false;
var mapNum = 1;
var numOfMaps = 1;
var numOfBins = 10;
var numOfBinsMin = 3;
var binIndex = 1;
var binIndexMax = 3;
var binTiles = [];
var numOfLitterbugs = 0;
var litterbugsAtStart = 1;
var litterbugsActive = [];
var litterbugsMax = 50;
var litterbugIndex = 1;
var litterbugIndexMax = 75;
var litterbugDropChance = 1;
var litterbugDropChanceMax = 50;
var litterbugSpeed = 3;
var litterbugDepth = 200;
var litterbugTypes = 1;
var litterbugPoints = 100;
var totalTrash = 0;
var trashActive = [];
var trashMax = 50;
var trashAtStart = 10;
var trashIndex = 1;
var trashIndexMax = 100;
var trashHeld = [];
var trashFrames = [];
var maxTrashHeld = 5;
var trashPoints = 25;
var leftEdge = 0;
var rightEdge = 550;
var topEdge = 0;
var bottomEdge = 400;
var centerX = 275;
var centerY = 175;
var minutesLeft = 5;
var secondsLeft = 0;
var freakOutMins = 0;
var freakOutSecs = 20;
var timerUnit = 1000;
var tileWidth = 50;
var tileHeight = 50;
var tileHalf = 25;
var tileEdge = 24;
var mapWidth = 50;
var mapHeight = 25;
var numOfTiles = (mapWidth * mapHeight);
var freeTiles = [];
var level1Row1 = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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0, 0, 0, 0, 0, 0, 0, 1, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4];
var level1Row22 = [4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 4];
var level1Row23 = [4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 4];
var level1Row24 = [4, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 4];
var level1Row25 = [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4];
attachMovie("interface", "Interface", 10000);
SFX.gotoAndPlay("StartMusic");
gotoAndPlay ("Play");
Frame 40
setupMap();
Map.attachMovie("player", "Player", (playerStartRow * 100) + playerDepth);
Map.Player._x = ((playerStartColumn - 1) * tileWidth) + tileHalf;
Map.Player._y = ((playerStartRow - 1) * tileHeight) + tileHalf;
Map.Player.currentRow = playerStartRow;
Map.Player.currentColumn = playerStartColumn;
Map.Player.speed = playerSpeed;
Map.Player.Anim.gotoAndStop(1);
trashHeld = [];
trashFrames = [];
numOfLitterbugs = 0;
var i = 1;
while (i <= litterbugsAtStart) {
spawnLitterbug();
i++;
}
totalTrash = 0;
trashIndex = 1;
trashActive = [];
var i = 1;
while (i <= trashAtStart) {
spawnTrash();
i++;
}
centerMap();
minutesLeft = 5;
secondsLeft = 0;
setTimerDigits(minutesLeft, secondsLeft, Interface.GameTimer);
Interface.gotoAndPlay("GetReady");
stop();
Interface.onEnterFrame = function () {
if (gameInPlay) {
setTimerDigits(minutesLeft, secondsLeft, Interface.GameTimer);
}
};
Map.Player.onEnterFrame = function () {
if (gameInPlay) {
if (!playerBusy) {
this.lastX = this._x;
this.lastY = this._y;
this.lastDir = this.currentDir;
this.currentRow = Math.ceil(this._y / tileHeight);
this.currentColumn = Math.ceil(this._x / tileWidth);
this.currentTile = whatNumber(this.currentColumn, this.currentRow);
if (Key.isDown(38)) {
this.currentDir = "Up";
this.Anim.play();
moveClip(this);
} else if (Key.isDown(40)) {
this.currentDir = "Down";
this.Anim.play();
moveClip(this);
} else if (Key.isDown(37)) {
this.currentDir = "Left";
this.Anim.play();
moveClip(this);
} else if (Key.isDown(39)) {
this.currentDir = "Right";
this.Anim.play();
moveClip(this);
} else {
this.Anim.gotoAndStop(1);
}
}
}
centerMap(3);
this.swapDepths(((this.currentRow * 1000) + playerDepth) + this.currentColumn);
};
Frame 50
gameInPlay = false;
clearInterval(timerCode);
Map.Player.gotoAndStop("WinLevel");
Interface.gotoAndPlay("WinLevel");
stop();
Frame 60
gameInPlay = false;
stopAllSounds();
clearInterval(timerCode);
Map.Player.gotoAndStop("GameOver");
Interface.gotoAndPlay("GameOver");
stop();
Symbol 19 MovieClip Frame 1
if (!_root.gameInPlay) {
stop();
}
Symbol 20 MovieClip Frame 1
stop();
Symbol 20 MovieClip Frame 10
stop();
Symbol 25 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 1
stop();
Symbol 49 MovieClip [interface] Frame 1
stop();
Symbol 49 MovieClip [interface] Frame 75
_root.SFX.gotoAndPlay("Go");
_root.Music.gotoAndPlay("StartInGame");
_root.timerCode = setInterval(_root.decrementTimer, _root.timerUnit);
_root.gameInPlay = true;
Symbol 49 MovieClip [interface] Frame 110
gotoAndStop (1);
Symbol 49 MovieClip [interface] Frame 115
_root.SFX.gotoAndPlay("WinLevel");
Symbol 49 MovieClip [interface] Frame 195
gotoAndStop (1);
_root.levelUp();
Symbol 49 MovieClip [interface] Frame 200
_root.SFX.gotoAndPlay("TimesUp");
Symbol 49 MovieClip [interface] Frame 220
_root.SFX.gotoAndPlay("GameOver");
Symbol 49 MovieClip [interface] Frame 330
_root.gotoAndStop("HiScores");
_root.clearScreen();
Symbol 55 MovieClip [maptile4] Frame 1
stop();
Symbol 72 MovieClip [maptile2] Frame 1
stop();
Symbol 72 MovieClip [maptile2] Frame 11
gotoAndStop (1);
Symbol 72 MovieClip [maptile2] Frame 21
gotoAndStop (1);
Symbol 72 MovieClip [maptile2] Frame 31
gotoAndStop (1);
Symbol 78 MovieClip [maptile1] Frame 1
stop();
Symbol 78 MovieClip [maptile1] Frame 11
gotoAndStop (1);
Symbol 78 MovieClip [maptile1] Frame 21
gotoAndStop (1);
Symbol 78 MovieClip [maptile1] Frame 31
gotoAndStop (1);
Symbol 83 MovieClip [trash3] Frame 1
stop();
Symbol 84 MovieClip [trash1] Frame 1
stop();
Symbol 85 MovieClip [trash2] Frame 1
stop();
Symbol 87 MovieClip [maptile3] Frame 1
stop();
Symbol 87 MovieClip [maptile3] Frame 11
gotoAndStop (1);
Symbol 87 MovieClip [maptile3] Frame 21
gotoAndStop (1);
Symbol 87 MovieClip [maptile3] Frame 31
gotoAndStop (1);
Symbol 103 MovieClip Frame 1
stop();
Symbol 103 MovieClip Frame 10
stop();
Symbol 103 MovieClip Frame 20
stop();
Symbol 103 MovieClip Frame 30
stop();
Symbol 122 MovieClip Frame 1
stop();
Symbol 122 MovieClip Frame 10
stop();
Symbol 122 MovieClip Frame 20
stop();
Symbol 122 MovieClip Frame 30
stop();
Symbol 123 MovieClip [litterbug1] Frame 1
stop();
Symbol 123 MovieClip [litterbug1] Frame 10
stop();
Symbol 139 MovieClip [player] Frame 1
stop();
Symbol 139 MovieClip [player] Frame 10
stop();
Symbol 139 MovieClip [player] Frame 20
stop();
Symbol 139 MovieClip [player] Frame 30
stop();
Symbol 139 MovieClip [player] Frame 40
stop();
Symbol 139 MovieClip [player] Frame 50
stop();
Symbol 151 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
_root.addGamePlay();
gotoAndPlay ("Start");
}
Symbol 153 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
score = null;
gotoAndPlay ("HiScores");
}
Symbol 155 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
gotoAndPlay ("HowTo");
}
Symbol 172 MovieClip Frame 1
stop();
Symbol 172 MovieClip Frame 6
gotoAndStop (1);
Symbol 172 MovieClip Frame 16
gotoAndStop (1);
Symbol 172 MovieClip Frame 26
gotoAndStop (1);
Symbol 172 MovieClip Frame 36
gotoAndStop (1);
Symbol 172 MovieClip Frame 46
gotoAndStop (1);
Symbol 172 MovieClip Frame 56
gotoAndStop (1);
Symbol 172 MovieClip Frame 66
gotoAndStop (1);
Symbol 172 MovieClip Frame 76
gotoAndStop (1);
Symbol 172 MovieClip Frame 86
gotoAndStop (1);
Symbol 172 MovieClip Frame 96
gotoAndStop (1);
Symbol 172 MovieClip Frame 106
gotoAndStop (1);
Symbol 172 MovieClip Frame 116
gotoAndStop (1);
Symbol 172 MovieClip Frame 126
gotoAndStop (1);
Symbol 172 MovieClip Frame 136
gotoAndStop (1);
Symbol 174 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
gotoAndPlay ("Title");
}