Frame 1
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");
function clearScreen() {
removeMovieClip("Interface");
removeMovieClip("Player");
i = 1;
while (i <= 3) {
removeMovieClip(_root["Shelf" + i]);
i++;
}
}
function levelUp() {
if (numOfKids < 3) {
numOfKids++;
spawnKid(numOfKids);
}
}
function addStrike() {
strikes++;
Interface.StrikesMeter.nextFrame();
if (strikes >= maxStrikes) {
gotoAndPlay ("GameOver");
}
}
function spawnKid(kidNum) {
var _local5 = randInt(1, kidTypes);
attachMovie("kid" + _local5, "Kid" + kidNum, kidDepth + kidNum);
var theKid = _root["Kid" + kidNum];
theKid.myID = kidNum;
theKid._x = 30;
theKid._y = shelfRows[kidNum - 1];
theKid.onEnterFrame = function () {
if (gameInPlay) {
if (!theKid.busy) {
var _local2 = getTimer();
if ((_local2 >= this.boredTime) && (_local2 < this.angryTime)) {
this.Anim.gotoAndStop("Bored");
} else if ((_local2 >= this.angryTime) && (_local2 < this.walkOutTime)) {
this.Anim.gotoAndStop("Angry");
} else if (_local2 >= this.walkOutTime) {
this.Anim.gotoAndStop("WalkOut");
this.gotoAndPlay("WalkOut");
theKid.busy = true;
addStrike();
}
}
if (!theKid.busy) {
if (this.Collider.hitTest(Player._x, Player._y, true)) {
if (playerHasBook == this.subjectWanted) {
playerBusy = true;
Player._x = theKid.Collider._x + theKid._x;
Player._y = theKid.Collider._y + theKid._y;
Player.gotoAndPlay("DeliverBook");
SFX.gotoAndPlay("DeliverBook");
theKid.busy = true;
theKid.gotoAndPlay("TakeBook");
}
}
}
} else {
this.gotoAndStop(1);
}
};
}
function startKidTimer(theKid) {
var _local1 = getTimer();
theKid.boredTime = _local1 + (kidBoredTime * 1000);
theKid.angryTime = _local1 + (kidAngryTime * 1000);
theKid.walkOutTime = _local1 + (kidWalkOutTime * 1000);
}
function askForBook(theKid) {
do {
match = false;
var _local4 = randInt(1, numOfSubjects);
var _local2 = 1;
while (_local2 <= numOfKids) {
var _local3 = _root["Kid" + _local2];
if (_local3 != theKid) {
if (_local4 == _local3.subjectWanted) {
match = true;
}
}
_local2++;
}
} while (match == true);
SFX.gotoAndPlay("AskForBook");
theKid.subjectWanted = _local4;
theKid.SubjectIcon.gotoAndStop(theKid.subjectWanted);
}
function rewardPlayer() {
SFX.gotoAndPlay("AwardPoints");
score = score + deliveryPoints;
booksDelivered++;
if ((booksDelivered % levelUpEvery) == 0) {
levelUp();
}
playerBusy = false;
}
function checkBooks(theBooks) {
Player.gotoAndStop("Up");
Player.Anim.gotoAndStop(1);
playerBusy = true;
Player.bookSubject = theBooks.subject;
Player.bookColour = theBooks.colour;
var _local6 = randInt(1, 4);
theBooks.gotoAndPlay("PullOut" + _local6);
var _local5 = false;
var _local2 = 1;
while (_local2 <= 3) {
var _local3 = _root["Kid" + _local2];
if (theBooks.subject == _local3.subjectWanted) {
_local5 = true;
break;
}
_local2++;
}
if (_local5) {
Player.gotoAndPlay("RightBook");
} else {
Player.gotoAndPlay("WrongBook");
}
}
function toggleBookIcons() {
var _local4 = 1;
while (_local4 <= 3) {
var _local5 = _root["Shelf" + _local4];
var _local3 = 1;
while (_local3 <= 5) {
var _local2 = _local5["Books" + _local3];
if (_local2.SubjectIcon._visible) {
_local2.SubjectIcon._visible = false;
} else {
_local2.SubjectIcon._visible = true;
}
_local3++;
}
_local4++;
}
}
function setupBooks() {
var _local5 = 1;
while (_local5 <= 15) {
shelfBooks.push(_local5);
bookSubjects.push(_local5);
_local5++;
}
shuffle(shelfBooks);
shuffle(bookSubjects);
_local5 = 1;
while (_local5 <= 3) {
var _local6 = _root["Shelf" + _local5];
var _local3 = 1;
while (_local3 <= 5) {
var _local2 = _local6["Books" + _local3];
k = 1;
while (k <= 4) {
var _local4 = _local2["Volume" + k];
_local4.gotoAndStop(shelfBooks[bookIndex]);
k++;
}
_local2.subject = bookSubjects[bookIndex];
_local2.colour = shelfBooks[bookIndex];
_local2.SubjectIcon.gotoAndStop(_local2.subject);
bookIndex++;
_local3++;
}
_local5++;
}
}
function movePlayer(moveDir) {
if (moveDir == "Left") {
Player.Anim.play();
moveX = -playerMove;
moveY = 0;
} else if (moveDir == "Right") {
Player.Anim.play();
moveX = playerMove;
moveY = 0;
} else if (moveDir == "Up") {
Player.Anim.play();
moveX = 0;
moveY = -playerMove;
} else if (moveDir == "Down") {
Player.Anim.play();
moveX = 0;
moveY = playerMove;
} else if (moveDir == "Idle") {
Player.Anim.gotoAndStop(1);
moveX = 0;
moveY = 0;
}
destX = Player._x + moveX;
destY = Player._y + moveY;
if (moveX != 0) {
if ((destX >= leftEdge) && (destX <= rightEdge)) {
var _local1 = 0;
while (_local1 < aisles.length) {
if ((Player._y >= (aisles[_local1] - shelfSnap)) && (Player._y <= (aisles[_local1] + shelfSnap))) {
Player._y = aisles[_local1];
Player.swapDepths(((_local1 + 1) * 1000) + 500);
Player._x = destX;
if (moveX < 0) {
Player.gotoAndStop("Left");
} else {
Player.gotoAndStop("Right");
}
}
_local1++;
}
}
if (destX >= rightEdge) {
Player._x = rightEdge;
} else if (destX <= leftEdge) {
Player._x = leftEdge;
}
}
if (moveY != 0) {
if ((Player._x >= leftEdge) && (Player._x <= (leftEdge + shelfSnap))) {
Player._x = leftEdge;
Player._y = destY;
if (moveY < 0) {
Player.gotoAndStop("Up");
} else {
Player.gotoAndStop("Down");
}
}
if (destY >= bottomEdge) {
Player._y = bottomEdge;
} else if (destY <= topEdge) {
Player._y = topEdge;
if (playerHasBook != 0) {
SFX.gotoAndPlay("ReturnBook");
playerHasBook = 0;
Player.Book._visible = false;
}
}
}
}
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) {
var _local2 = Math.round(Math.random() * i);
var _local3 = theArray[i];
theArray[i] = theArray[_local2];
theArray[_local2] = _local3;
i++;
}
return(theArray);
}
fscommand ("allowscale", false);
Music.gotoAndPlay("StartTitle");
if ((fs >= 0) || (fsdev >= 0)) {
highBTN._visible = false;
} else {
highBTN._visible = true;
}
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 = "lightningLibrarian";
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);
};
Frame 10
stop();
Instance of Symbol 101 MovieClip in Frame 10
onClipEvent (load) {
this.Feet.gotoAndStop(1);
}
Instance of Symbol 188 MovieClip "TitleBooks" in Frame 10
onClipEvent (load) {
this.SubjectIcon._visible = false;
}
Instance of Symbol 90 MovieClip in Frame 10
onClipEvent (load) {
this.gotoAndStop(25);
}
Frame 20
recapText = ("You helped " + booksDelivered) + " kids find the right book!";
recapScore = score;
Frame 30
SFX.gotoAndPlay("StopTimer");
Music.gotoAndPlay("StartTitle");
if (score == null) {
}
stop();
Frame 40
var level = 1;
var score = 0;
var introDelay = 5;
var gameInPlay = false;
var numOfSubjects = 15;
var deliveryPoints = 50;
var booksDelivered = 0;
var strikes = 0;
var maxStrikes = 5;
var levelUpEvery = 10;
var numOfKids = 1;
var kidTypes = 3;
var kidDepth = 500;
var kidBoredTime = 15;
var kidAngryTime = 25;
var kidWalkOutTime = 30;
var playerStartX = 155;
var playerStartY = 175;
var playerMove = 10;
var playerCenterY = -40;
var playerBusy = false;
var playerHasBook = 0;
var bookIndex = 0;
var bookSubjects = [];
var shelfBooks = [];
var shelfColumns = [230, 300, 370, 440, 510];
var shelfRows = [120, 240, 360];
var shelfSnap = 30;
var leftEdge = 155;
var rightEdge = 520;
var topEdge = 90;
var bottomEdge = 360;
var aisles = [120, 240, 360];
attachMovie("interface", "Interface", 10000);
attachMovie("player", "Player", 1500);
Player._x = playerStartX;
Player._y = playerStartY;
i = 1;
while (i <= 3) {
_root["Shelf" + i].swapDepths(i * 1000);
i++;
}
gotoAndPlay ("Play");
Frame 50
setupBooks();
Player.Anim.gotoAndStop(1);
Player.Book._visible = false;
Interface.StrikesMeter.gotoAndStop(1);
Interface.gotoAndPlay("Intro");
stop();
Player.onEnterFrame = function () {
if (gameInPlay) {
if (!playerBusy) {
if (Key.isDown(37)) {
movePlayer("Left");
} else if (Key.isDown(39)) {
movePlayer("Right");
} else if (Key.isDown(40)) {
movePlayer("Down");
} else if (Key.isDown(38)) {
movePlayer("Up");
} else {
movePlayer("Idle");
}
if (playerHasBook == 0) {
if (Key.isDown(32)) {
var _local4 = 1;
while (_local4 <= 3) {
var _local5 = _root["Shelf" + _local4];
var _local2 = 1;
while (_local2 <= 5) {
var _local3 = _local5["Books" + _local2];
if (_local3.hitTest(Player.Collider)) {
checkBooks(_local3);
break;
}
_local2++;
}
_local4++;
}
}
}
}
}
};
Frame 60
gameInPlay = false;
stopAllSounds();
SFX.gotoAndPlay("GameOver");
Interface.gotoAndPlay("GameOver");
stop();
Symbol 9 MovieClip Frame 10
stop();
Symbol 10 MovieClip Frame 1
stop();
Symbol 15 Button
on (keyPress "<Space>") {
gotoAndPlay ("GetReady");
}
Symbol 22 MovieClip [interface] Frame 1
stop();
Symbol 22 MovieClip [interface] Frame 10
_root.SFX.gotoAndPlay("StartTimer");
var count = _root.introDelay;
Symbol 22 MovieClip [interface] Frame 60
count--;
if (count > 0) {
gotoAndPlay ("Delay");
}
Symbol 22 MovieClip [interface] Frame 65
_root.SFX.gotoAndPlay("StopTimer");
Symbol 22 MovieClip [interface] Frame 75
_root.SFX.gotoAndPlay("DeliverBook");
Symbol 22 MovieClip [interface] Frame 140
stopAllSounds();
_root.SFX.gotoAndPlay("Go");
_root.Music.gotoAndPlay("StartInGame");
_root.gameInPlay = true;
_root.toggleBookIcons();
_root.spawnKid(_root.numOfKids);
Symbol 22 MovieClip [interface] Frame 175
gotoAndStop (1);
Symbol 22 MovieClip [interface] Frame 315
_root.gotoAndStop("Recap");
_root.clearScreen();
Symbol 47 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 1
stop();
Symbol 73 MovieClip [player] Frame 1
if (_root.playerHasBook != 0) {
Book._visible = true;
Book.gotoAndStop(bookColour);
} else {
Book._visible = false;
}
stop();
Symbol 73 MovieClip [player] Frame 10
if (_root.playerHasBook != 0) {
Book._visible = true;
Book.gotoAndStop(bookColour);
} else {
Book._visible = false;
}
Symbol 73 MovieClip [player] Frame 25
SubjectIcon.gotoAndStop(bookSubject);
_root.SFX.gotoAndPlay("RightBook");
Symbol 73 MovieClip [player] Frame 35
_root.playerHasBook = bookSubject;
Book._visible = true;
Book.gotoAndStop(bookSubject);
_root.playerBusy = false;
gotoAndStop ("Down");
Symbol 73 MovieClip [player] Frame 45
SubjectIcon.gotoAndStop(bookSubject);
var randNum = _root.randInt(1, 3);
_root.SFX.gotoAndPlay("WrongBook" + randNum);
Symbol 73 MovieClip [player] Frame 60
_root.playerBusy = false;
gotoAndStop ("Down");
Symbol 73 MovieClip [player] Frame 65
if (_root.playerHasBook != 0) {
Book._visible = true;
Book.gotoAndStop(bookColour);
} else {
Book._visible = false;
}
Symbol 73 MovieClip [player] Frame 75
stop();
Anim.gotoAndStop(1);
Book._visible = false;
_root.playerHasBook = 0;
Symbol 73 MovieClip [player] Frame 85
if (_root.playerHasBook != 0) {
Book._visible = true;
Book.gotoAndStop(bookColour);
} else {
Book._visible = false;
}
Symbol 90 MovieClip Frame 1
stop();
Symbol 90 MovieClip Frame 10
_root.SFX.gotoAndPlay("KidBored");
stop();
Symbol 90 MovieClip Frame 20
_root.SFX.gotoAndPlay("KidAngry");
stop();
Symbol 90 MovieClip Frame 30
_root.SFX.gotoAndPlay("KidWalkOut");
stop();
Symbol 91 MovieClip [kid3] Frame 1
busy = true;
_root.startKidTimer(this);
Anim.gotoAndStop("Happy");
Symbol 91 MovieClip [kid3] Frame 20
_root.askForBook(this);
Anim.Feet.gotoAndStop(1);
busy = false;
stop();
Symbol 91 MovieClip [kid3] Frame 25
Anim.Feet.play();
Anim.gotoAndStop("WalkOut");
Symbol 91 MovieClip [kid3] Frame 45
gotoAndPlay ("WalkIn");
Symbol 91 MovieClip [kid3] Frame 50
Anim.gotoAndStop("Happy");
Book.gotoAndStop(_root.Player.bookColour);
Symbol 91 MovieClip [kid3] Frame 65
Anim.Feet.play();
_root.rewardPlayer();
Symbol 91 MovieClip [kid3] Frame 90
stop();
_root.spawnKid(myID);
Symbol 95 MovieClip Frame 1
stop();
Symbol 95 MovieClip Frame 10
_root.SFX.gotoAndPlay("KidBored");
stop();
Symbol 95 MovieClip Frame 20
_root.SFX.gotoAndPlay("KidAngry");
stop();
Symbol 95 MovieClip Frame 30
_root.SFX.gotoAndPlay("KidWalkOut");
stop();
Symbol 96 MovieClip [kid2] Frame 1
busy = true;
_root.startKidTimer(this);
Anim.gotoAndStop("Happy");
Symbol 96 MovieClip [kid2] Frame 20
_root.askForBook(this);
Anim.Feet.gotoAndStop(1);
busy = false;
stop();
Symbol 96 MovieClip [kid2] Frame 25
Anim.Feet.play();
Anim.gotoAndStop("WalkOut");
Symbol 96 MovieClip [kid2] Frame 45
gotoAndPlay ("WalkIn");
Symbol 96 MovieClip [kid2] Frame 50
Anim.gotoAndStop("Happy");
Book.gotoAndStop(_root.Player.bookColour);
Symbol 96 MovieClip [kid2] Frame 65
Anim.Feet.play();
_root.rewardPlayer();
Symbol 96 MovieClip [kid2] Frame 90
stop();
_root.spawnKid(myID);
Symbol 101 MovieClip Frame 1
stop();
Symbol 101 MovieClip Frame 10
_root.SFX.gotoAndPlay("KidBored");
stop();
Symbol 101 MovieClip Frame 20
_root.SFX.gotoAndPlay("KidAngry");
stop();
Symbol 101 MovieClip Frame 30
_root.SFX.gotoAndPlay("KidWalkOut");
stop();
Symbol 102 MovieClip [kid1] Frame 1
busy = true;
_root.startKidTimer(this);
Anim.gotoAndStop("Happy");
Symbol 102 MovieClip [kid1] Frame 20
_root.askForBook(this);
Anim.Feet.gotoAndStop(1);
busy = false;
stop();
Symbol 102 MovieClip [kid1] Frame 25
Anim.Feet.play();
Anim.gotoAndStop("WalkOut");
Symbol 102 MovieClip [kid1] Frame 45
gotoAndPlay ("WalkIn");
Symbol 102 MovieClip [kid1] Frame 50
Anim.gotoAndStop("Happy");
Book.gotoAndStop(_root.Player.bookColour);
Symbol 102 MovieClip [kid1] Frame 65
Anim.Feet.play();
_root.rewardPlayer();
Symbol 102 MovieClip [kid1] Frame 90
stop();
_root.spawnKid(myID);
Symbol 125 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
_root.addGamePlay();
gotoAndPlay ("Start");
}
Symbol 127 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
score = null;
gotoAndPlay ("HiScores");
}
Symbol 129 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
gotoAndPlay ("HowTo");
}
Symbol 152 MovieClip Frame 1
stop();
Symbol 152 MovieClip Frame 6
gotoAndStop (1);
Symbol 152 MovieClip Frame 16
gotoAndStop (1);
Symbol 152 MovieClip Frame 26
gotoAndStop (1);
Symbol 152 MovieClip Frame 36
gotoAndStop (1);
Symbol 152 MovieClip Frame 46
gotoAndStop (1);
Symbol 152 MovieClip Frame 56
gotoAndStop (1);
Symbol 152 MovieClip Frame 66
gotoAndStop (1);
Symbol 152 MovieClip Frame 76
gotoAndStop (1);
Symbol 152 MovieClip Frame 86
gotoAndStop (1);
Symbol 152 MovieClip Frame 96
gotoAndStop (1);
Symbol 152 MovieClip Frame 106
gotoAndStop (1);
Symbol 152 MovieClip Frame 116
gotoAndStop (1);
Symbol 152 MovieClip Frame 126
gotoAndStop (1);
Symbol 152 MovieClip Frame 136
gotoAndStop (1);
Symbol 152 MovieClip Frame 146
gotoAndStop (1);
Symbol 152 MovieClip Frame 156
gotoAndStop (1);
Symbol 152 MovieClip Frame 166
gotoAndStop (1);
Symbol 152 MovieClip Frame 176
gotoAndStop (1);
Symbol 152 MovieClip Frame 186
gotoAndStop (1);
Symbol 157 MovieClip Frame 1
stop();
Symbol 157 MovieClip Frame 6
gotoAndStop (1);
Symbol 157 MovieClip Frame 16
gotoAndStop (1);
Symbol 166 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
gotoAndPlay ("Title");
}
Symbol 187 MovieClip Frame 1
stop();
Symbol 188 MovieClip Frame 1
stop();
Symbol 188 MovieClip Frame 5
_root.SFX.gotoAndPlay("PullOutBook");
Symbol 188 MovieClip Frame 20
_root.SFX.gotoAndPlay("PutBackBook");
Symbol 188 MovieClip Frame 25
gotoAndStop (1);
Symbol 188 MovieClip Frame 30
_root.SFX.gotoAndPlay("PullOutBook");
Symbol 188 MovieClip Frame 45
_root.SFX.gotoAndPlay("PutBackBook");
Symbol 188 MovieClip Frame 50
gotoAndStop (1);
Symbol 188 MovieClip Frame 55
_root.SFX.gotoAndPlay("PullOutBook");
Symbol 188 MovieClip Frame 70
_root.SFX.gotoAndPlay("PutBackBook");
Symbol 188 MovieClip Frame 75
gotoAndStop (1);
Symbol 188 MovieClip Frame 80
_root.SFX.gotoAndPlay("PullOutBook");
Symbol 188 MovieClip Frame 95
_root.SFX.gotoAndPlay("PutBackBook");
Symbol 188 MovieClip Frame 100
gotoAndStop (1);
Symbol 195 Button
on (rollOver) {
SFX.gotoAndPlay("RollOver");
}
on (press) {
SFX.gotoAndPlay("Click");
}
on (release) {
gotoAndPlay ("Title");
}
Symbol 229 Button
on (keyPress "B") {
toggleBookIcons();
}