Frame 1
function CommandButton(face) {
this.face = face;
return(this);
}
function dropDropCommand() {
var t = this._droptarget;
var clip = eval (t);
changeCommand(clip.id, this.command);
this.removeMovieClip();
}
function spawnDropCommand() {
var _local1 = createEmptyMovieClip("dropCommand", 100);
Mouse.addListener(_local1);
_local1.attachMovie(this.face, "icon", 1);
_local1.command = this.cmdID;
_local1._x = _root._xmouse - (_local1._width / 2);
_local1._y = _root._ymouse - (_local1._height / 2);
_local1.startDrag(false);
_local1._alpha = 50;
_local1.onMouseUp = dropDropCommand;
}
function buildCommandButton(cmdButton, id) {
var _local1 = createEmptyMovieClip("commandButton_" + id, id + 39);
_local1.face = COMMANDKEY[cmdButton.face] + "_icon";
_local1.cmdID = cmdButton.face;
_local1.attachMovie(_local1.face, "face", 1);
_local1.onPress = spawnDropCommand;
return(_local1);
}
function buildCommandListEntry(icon, id) {
var _local2 = id;
var _local1 = attachMovie(COMMANDKEY[icon] + "_icon", "commandList_" + _local2, _local2 + 4);
_local1.id = _local2;
return(_local1);
}
function drawMainProgram() {
var _local1 = 0;
while (_local1 < mainProgram.length) {
var _local3 = Math.floor(_local1 / 4);
var col = (_local1 % 4);
var _local2 = buildCommandListEntry(mainProgram[_local1], _local1);
_local2._x = 480 + (32 * col);
_local2._y = 109 + (32 * _local3);
_local1++;
}
}
function drawSubroutineOne() {
var _local1 = 0;
while (_local1 < subroutineOne.length) {
var _local3 = Math.floor(_local1 / 4);
var col = (_local1 % 4);
var _local2 = buildCommandListEntry(subroutineOne[_local1], _local1 + 16);
_local2._x = 480 + (32 * col);
_local2._y = 261 + (32 * _local3);
_local1++;
}
}
function drawSubroutineTwo() {
var _local1 = 0;
while (_local1 < subroutineTwo.length) {
var _local3 = Math.floor(_local1 / 4);
var col = (_local1 % 4);
var _local2 = buildCommandListEntry(subroutineTwo[_local1], _local1 + 24);
_local2._x = 480 + (32 * col);
_local2._y = 341 + (32 * _local3);
_local1++;
}
}
function clearProgram() {
ROOT_PROGRAM = new Array();
var _local1 = 0;
while (_local1 < 32) {
ROOT_PROGRAM[_local1] = 0;
_local1++;
}
mainProgram = new Array();
subroutineOne = new Array();
subroutineTwo = new Array();
distributeProgram();
}
function changeCommand(entryID, cmdID) {
var _local1 = cmdID;
var _local2 = entryID;
if (((_local2 > 15) && (_local1 == 6)) || ((_local2 > 23) && (_local1 == 7))) {
return(false);
}
playSoundEffect("setcommand");
ROOT_PROGRAM[_local2] = _local1;
distributeProgram();
redrawCommands();
return(undefined);
}
function distributeProgram() {
var _local1 = 0;
while (_local1 < 16) {
mainProgram[_local1] = ROOT_PROGRAM[_local1];
_local1++;
}
_local1 = 0;
while (_local1 < 8) {
subroutineOne[_local1] = ROOT_PROGRAM[_local1 + 16];
_local1++;
}
_local1 = 0;
while (_local1 < 8) {
subroutineTwo[_local1] = ROOT_PROGRAM[_local1 + 24];
_local1++;
}
}
function redrawCommands() {
drawMainProgram();
drawSubroutineOne();
drawSubroutineTwo();
}
function compileProgram() {
finalProgram = new Array();
var i = 0;
while (i < mainProgram.length) {
var theCommand = mainProgram[i];
if (theCommand) {
if (theCommand == 6) {
var _local2 = 0;
while (_local2 < subroutineOne.length) {
var _local3 = subroutineOne[_local2];
if (_local3) {
if (_local3 == 7) {
var _local1 = 0;
while (_local1 < subroutineTwo.length) {
_local3 = subroutineTwo[_local1];
if (_local3) {
finalProgram.push(_local3);
}
_local1++;
}
} else {
finalProgram.push(_local3);
}
}
_local2++;
}
} else if (theCommand == 7) {
var _local1 = 0;
while (_local1 < subroutineTwo.length) {
var _local3 = subroutineTwo[_local1];
if (_local3) {
finalProgram.push(_local3);
}
_local1++;
}
} else {
finalProgram.push(theCommand);
}
}
i++;
}
var functionArray = Array(0, billGoForward, billGoBackward, billTurnLeft, billTurnRight, billGrab);
var i = 0;
while (i < finalProgram.length) {
var commandID = finalProgram[i];
finalProgram[i] = functionArray[commandID];
i++;
}
if (finalProgram.length == 0) {
trace("You're trying to run an empty program");
finishCommands();
} else {
doCommand(0);
}
}
function doCommand(n) {
var _local3 = this;
var _local2 = finalProgram[n];
if (_local2) {
var _local1 = createEmptyMovieClip("commandTimer", 9999);
_local1.countdown = 40;
_local1.nextCommand = n + 1;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.countdown--;
if (_local1.countdown < 0) {
doCommand(_local1.nextCommand);
}
};
_local2();
} else {
finishCommands();
}
}
function finishCommands() {
var _local1 = 0;
for (var _local2 in levelChips) {
if (typeof(levelChips[_local2]) == "movieclip") {
_local1++;
}
}
if (_local1) {
startLevel(levelNumber);
} else {
startLevel(levelNumber + 1);
}
commandTimer.removeMovieClip();
waitingToStart = true;
}
function billSetDirection(direction) {
var _local1 = direction;
if (_local1 < 0) {
_local1 = 3;
} else if (_local1 > 3) {
_local1 = 0;
}
ObjBILL.dir = _local1;
var _local2 = ObjBILL.directionTable[_local1];
var _local3 = ("bill_" + _local2) + "_1";
ObjBILL.mc.attachMovie(_local3, "sprite", 1);
}
function billTurnLeft() {
billSetDirection(ObjBILL.dir - 1);
commandTimer.countdown = commandTimer.countdown - 35;
playSoundEffect("turn");
}
function billTurnRight() {
billSetDirection(ObjBILL.dir + 1);
commandTimer.countdown = commandTimer.countdown - 35;
playSoundEffect("turn");
}
function billGrab() {
var _local1 = 0;
while (_local1 < currentLevel.chips.length) {
var _local2 = currentLevel.chips[_local1];
if ((ObjBILL.xPos == _local2[0]) && (ObjBILL.yPos == _local2[1])) {
var _local3 = levelChips["chip" + _local1];
if (_local3) {
_local3.removeMovieClip();
playSoundEffect("grabChip");
}
}
_local1++;
}
commandTimer.countdown = commandTimer.countdown - 35;
}
function billGoBackward() {
var _local2 = this;
var _local3 = currentMap[ObjBILL.yPos][ObjBILL.xPos];
if (tileWalkability[_local3][(ObjBILL.dir + 2) % 4]) {
if (ObjBILL.dir == 2) {
var nextTile = currentMap[ObjBILL.yPos - 1][ObjBILL.xPos];
var step = function () {
ObjBILL.mc._y = ObjBILL.mc._y - 1;
};
ObjBILL.yPos = ObjBILL.yPos - 1;
} else if (ObjBILL.dir == 3) {
var nextTile = currentMap[ObjBILL.yPos][ObjBILL.xPos + 1];
var step = function () {
ObjBILL.mc._x = ObjBILL.mc._x + 1;
};
ObjBILL.xPos = ObjBILL.xPos + 1;
} else if (ObjBILL.dir == 0) {
var nextTile = currentMap[ObjBILL.yPos + 1][ObjBILL.xPos];
var step = function () {
ObjBILL.mc._y = ObjBILL.mc._y + 1;
};
ObjBILL.yPos = ObjBILL.yPos + 1;
} else if (ObjBILL.dir == 1) {
var nextTile = currentMap[ObjBILL.yPos][ObjBILL.xPos - 1];
var step = function () {
ObjBILL.mc._x = ObjBILL.mc._x - 1;
};
ObjBILL.xPos = ObjBILL.xPos - 1;
}
if (nextTile == 1) {
return(false);
}
playSoundEffect("walk");
var _local1 = createEmptyMovieClip("BillMotor", 99);
_local1.step = step;
_local1.countdown = 32;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.step();
ObjBILL.playAnimation();
_local1.countdown--;
if (!_local1.countdown) {
_local1.removeMovieClip();
}
};
} else {
return(false);
}
return(undefined);
}
function billGoForward() {
var _local2 = this;
var _local3 = currentMap[ObjBILL.yPos][ObjBILL.xPos];
if (tileWalkability[_local3][ObjBILL.dir]) {
if (ObjBILL.dir == 0) {
var nextTile = currentMap[ObjBILL.yPos - 1][ObjBILL.xPos];
var step = function () {
ObjBILL.mc._y = ObjBILL.mc._y - 1;
};
ObjBILL.yPos = ObjBILL.yPos - 1;
} else if (ObjBILL.dir == 1) {
var nextTile = currentMap[ObjBILL.yPos][ObjBILL.xPos + 1];
var step = function () {
ObjBILL.mc._x = ObjBILL.mc._x + 1;
};
ObjBILL.xPos = ObjBILL.xPos + 1;
} else if (ObjBILL.dir == 2) {
var nextTile = currentMap[ObjBILL.yPos + 1][ObjBILL.xPos];
var step = function () {
ObjBILL.mc._y = ObjBILL.mc._y + 1;
};
ObjBILL.yPos = ObjBILL.yPos + 1;
} else if (ObjBILL.dir == 3) {
var nextTile = currentMap[ObjBILL.yPos][ObjBILL.xPos - 1];
var step = function () {
ObjBILL.mc._x = ObjBILL.mc._x - 1;
};
ObjBILL.xPos = ObjBILL.xPos - 1;
}
if (nextTile == 1) {
return(false);
}
playSoundEffect("walk");
var _local1 = createEmptyMovieClip("BillMotor", 99);
_local1.step = step;
_local1.countdown = 32;
_local1.onEnterFrame = function () {
var _local1 = this;
_local1.step();
ObjBILL.playAnimation();
_local1.countdown--;
if (!_local1.countdown) {
_local1.removeMovieClip();
}
};
} else {
return(false);
}
return(undefined);
}
function startLevel(n) {
waitingToStart = true;
playBackgroundMusic("");
levelNumber = n;
if (levelNumber >= gameLevels.length) {
levelNumber = 0;
}
mData = gameLevels[levelNumber];
drawLevelMap(mData.map);
currentLevel = mData;
currentMap = currentLevel.map;
drawLevelChips(mdata.chips);
drawLevelBill(mdata.bill);
var buttonOrder = Array(1, 2, 3, 4, 5, 6, 7, 0);
var _local1 = 0;
while (_local1 < 8) {
var cmdB = new CommandButton(buttonOrder[_local1]);
var _local2 = buildCommandButton(cmdB, _local1);
var _local3 = Math.floor(_local1 / 4);
var col = (_local1 % 4);
_local2._x = 480 + (32 * col);
_local2._y = 22 + (32 * _local3);
_local1++;
}
clearProgram();
redrawCommands();
var block = createEmptyMovieClip("blocker", 199);
block.beginFill(0, 0);
block.moveTo(0, 0);
block.lineTo(640, 0);
block.lineTo(640, 480);
block.lineTo(0, 480);
block.lineTo(0, 0);
block.endFill();
block.onRelease = function () {
};
var titleWin = createEmptyMovieClip("LevelTitle", 200);
titleWin._x = 160;
titleWin._y = 120;
titleWin.onRelease = function () {
blocker.removeMovieClip();
this.removeMovieClip();
};
var bg = titleWin.createEmptyMovieClip("bg", 1);
bg.beginFill(8704);
bg.moveTo(0, 0);
bg.lineTo(320, 0);
bg.lineTo(320, 240);
bg.lineTo(0, 240);
bg.lineTo(0, 0);
bg.endFill();
bg.lineStyle(4, 65280);
bg.moveTo(0, 0);
bg.lineTo(320, 0);
bg.lineTo(320, 240);
bg.lineTo(0, 240);
bg.lineTo(0, 0);
titleWin.createTextField("titleField", 2, 24, 24, 272, 72);
var tField = titleWin.titleField;
tField.wordWrap = true;
titleFormat = new TextFormat();
titleFormat.font = "Verdana";
titleFormat.size = 16;
titleFormat.color = 65280;
titleFormat.align = "center";
titleFormat.bold = true;
tField.text = mData.title;
tField.setTextFormat(titleFormat);
titleWin.createTextField("startField", 3, 24, 144, 272, 72);
var sField = titleWin.startField;
startFormat = new TextFormat();
startFormat.font = "Verdana";
startFormat.size = 10;
startFormat.color = 65280;
startFormat.align = "center";
sField.text = "Click Here to Begin";
sField.setTextFormat(startFormat);
}
function drawLevelBill(bill) {
var _local1 = bill;
var _local3 = createEmptyMovieClip("levelBill", 3);
_local3._x = 32;
_local3._y = 48;
var _local2 = _local3.createEmptyMovieClip("bill", 1);
ObjBILL = new BillObj(_local1[0], _local1[1], _local1[2], _local2);
_local2._x = _local1[0] * 32;
_local2._y = _local1[1] * 32;
billSetDirection(_local1[2]);
}
function drawLevelMap(map) {
var LMAP = createEmptyMovieClip("levelMap", 1);
LMAP._x = 32;
LMAP._y = 48;
var _local2 = 0;
while (_local2 < 12) {
var _local1 = 0;
while (_local1 < 12) {
var currentTile = map[_local2][_local1];
var tileID = ((_local2 * 12) + _local1);
var _local3 = LMAP.attachMovie("tile" + currentTile, "tile" + tileID, tileID);
_local3._x = _local1 * 32;
_local3._y = _local2 * 32;
_local1++;
}
_local2++;
}
}
function drawLevelChips(chips) {
var LCHIPS = createEmptyMovieClip("levelChips", 2);
LCHIPS._x = 32;
LCHIPS._y = 48;
var _local1 = 0;
while (_local1 < chips.length) {
var _local3 = chips[_local1];
var chipX = _local3[0];
var chipY = _local3[1];
var _local2 = LCHIPS.attachMovie("chip", "chip" + _local1, _local1);
_local2._x = chipX * 32;
_local2._y = chipY * 32;
_local2.id = _local1;
_local1++;
}
}
function LevelObj(map, bill, chips, title) {
var _local1 = this;
_local1.map = map;
_local1.bill = bill;
_local1.chips = chips;
_local1.title = title;
return(_local1);
}
function BillObj(x, y, direction, mc) {
var _local1 = this;
_local1.xPos = x;
_local1.yPos = y;
_local1.dir = direction;
_local1.mc = mc;
_local1.animate = 1;
_local1.directionTable = new Array("up", "right", "down", "left");
_local1.playAnimation = function () {
animate++;
if (animate > 2) {
animate = 1;
}
var _local1 = ObjBILL.directionTable[ObjBILL.dir];
var _local2 = (("bill_" + _local1) + "_") + animate;
ObjBILL.mc.attachMovie(_local2, "sprite", 1);
};
}
function runGame() {
gotoAndStop ("GAME_SCREEN");
startLevel(0);
}
function playSoundEffect(soundID) {
SoundEffect.stop();
SoundEffect = new Sound(levelBill.bill);
SoundEffect.attachSound(soundID);
SoundEffect.start();
}
_quality = "LOW";
fscommand ("showmenu", false);
COMMANDKEY = Array("blank", "forward", "back", "turnleft", "turnright", "grab", "sub1", "sub2");
level1 = new LevelObj(Array(Array(0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0), Array(0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0)), Array(6, 9, 0), Array(Array(6, 8)), "LEVEL 1\nBill's First Step");
level2 = new LevelObj(Array(Array(1, 1, 1, 1, 1, 5, 5, 5, 1, 1, 1, 1), Array(4, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1), Array(4, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 6), Array(1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 6), Array(1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1), Array(4, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 6), Array(4, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1), Array(4, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1), Array(4, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1), Array(4, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1), Array(4, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1), Array(1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1)), Array(6, 10, 0), Array(Array(6, 9), Array(6, 8), Array(6, 7), Array(6, 6), Array(6, 5), Array(6, 4), Array(6, 3), Array(6, 2)), "LEVEL 2\nLots of Chips!");
level3 = new LevelObj(Array(Array(8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 0), Array(0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0), Array(11, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 0), Array(8, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), Array(3, 3, 1), Array(Array(6, 3), Array(6, 6)), "LEVEL 3\nLearn To Turn");
level4 = new LevelObj(Array(Array(1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0), Array(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0), Array(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0), Array(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0), Array(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0), Array(1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0), Array(1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0), Array(1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0), Array(0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Array(0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), Array(6, 3, 2), Array(Array(6, 5), Array(8, 5), Array(8, 3)), "LEVEL 4\nTurning a New Leaf");
level5 = new LevelObj(Array(Array(0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1), Array(1, 0, 1, 8, 5, 5, 5, 5, 9, 1, 1, 0), Array(0, 1, 1, 4, 0, 0, 0, 0, 0, 9, 1, 1), Array(1, 0, 1, 11, 0, 0, 0, 0, 0, 0, 9, 1), Array(0, 1, 0, 1, 11, 0, 0, 0, 0, 0, 6, 1), Array(1, 0, 1, 0, 1, 11, 0, 0, 0, 0, 6, 1), Array(0, 1, 0, 1, 0, 1, 11, 0, 0, 0, 6, 1), Array(1, 0, 1, 0, 1, 0, 1, 11, 7, 7, 10, 1), Array(0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0), Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0), Array(0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1), Array(1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0)), Array(4, 1, 2), Array(Array(4, 2), Array(7, 2), Array(7, 5), Array(9, 5)), "LEVEL 5\nZig-Zag");
level6 = new LevelObj(Array(Array(0, 0, 0, 8, 5, 5, 9, 0, 0, 0, 0, 0), Array(0, 0, 0, 4, 0, 0, 6, 0, 0, 0, 0, 0), Array(0, 1, 0, 4, 0, 0, 6, 0, 1, 0, 0, 0), Array(0, 0, 0, 4, 0, 0, 6, 0, 0, 0, 0, 0), Array(8, 5, 5, 0, 0, 0, 0, 5, 5, 9, 0, 0), Array(4, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), Array(4, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0), Array(11, 7, 7, 0, 0, 0, 0, 7, 7, 10, 0, 0), Array(0, 0, 0, 4, 0, 0, 6, 0, 0, 0, 0, 0), Array(0, 1, 0, 4, 0, 0, 6, 0, 1, 0, 0, 0), Array(0, 0, 0, 11, 7, 7, 10, 0, 0, 0, 0, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), Array(4, 1, 2), Array(Array(4, 2), Array(4, 3), Array(4, 4), Array(4, 5), Array(4, 6), Array(4, 7), Array(4, 8), Array(4, 9), Array(5, 9), Array(5, 8), Array(5, 7), Array(5, 6), Array(5, 5), Array(5, 4), Array(5, 3), Array(5, 2)), "LEVEL 6\nUse The Subroutine");
level7 = new LevelObj(Array(Array(0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0), Array(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0), Array(1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1), Array(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), Array(0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0), Array(1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0), Array(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0), Array(0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0), Array(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), Array(1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1), Array(0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0)), Array(3, 4, 2), Array(Array(4, 8), Array(5, 8), Array(6, 8), Array(7, 8), Array(7, 7), Array(7, 6), Array(7, 5), Array(7, 4), Array(6, 4), Array(5, 4), Array(4, 4), Array(3, 4), Array(3, 5), Array(3, 6), Array(3, 7), Array(3, 8)), "LEVEL 7\nSquare O' Chips");
level8 = new LevelObj(Array(Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Array(0, 0, 14, 3, 3, 3, 3, 3, 3, 3, 9, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0), Array(0, 0, 8, 3, 3, 3, 3, 3, 12, 0, 2, 0), Array(0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0), Array(0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0), Array(0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0), Array(0, 0, 11, 3, 3, 3, 3, 3, 3, 3, 10, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), Array(2, 1, 1), Array(Array(10, 1), Array(10, 9), Array(2, 9), Array(2, 5), Array(8, 5)), "LEVEL 8\nSpiral Path");
level9 = new LevelObj(Array(Array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1), Array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0)), Array(2, 1, 2), Array(Array(2, 2), Array(2, 3), Array(2, 4), Array(2, 5), Array(2, 6), Array(2, 7), Array(2, 8), Array(2, 9), Array(3, 9), Array(4, 9), Array(5, 9), Array(6, 9), Array(7, 9), Array(8, 9), Array(9, 9), Array(10, 9), Array(10, 8), Array(10, 7), Array(10, 6), Array(10, 5), Array(10, 4), Array(10, 3), Array(10, 2), Array(10, 1), Array(9, 1), Array(8, 1), Array(7, 1), Array(6, 1), Array(5, 1), Array(4, 1), Array(4, 2), Array(4, 3), Array(4, 4), Array(4, 5), Array(4, 6), Array(5, 6), Array(6, 6), Array(7, 6), Array(8, 6)), "LEVEL 9\nSpiral of Chips");
gameLevels = new Array(level1, level2, level3, level4, level5, level6, level7, level8, level9);
tileWalkability = Array(Array(1, 1, 1, 1), Array(0, 0, 0, 0), Array(1, 0, 1, 0), Array(0, 1, 0, 1), Array(1, 1, 1, 0), Array(0, 1, 1, 1), Array(1, 0, 1, 1), Array(1, 1, 0, 1), Array(0, 1, 1, 0), Array(0, 0, 1, 1), Array(1, 0, 0, 1), Array(1, 1, 0, 0), Array(0, 0, 0, 1), Array(1, 0, 0, 0), Array(0, 1, 0, 0), Array(0, 0, 1, 0));
var p = createEmptyMovieClip("preloader", 1);
p._x = 270;
p._y = 244;
p.lineStyle(1, 16777215, 100);
p.moveTo(0, 0);
p.lineTo(100, 0);
p.lineTo(100, 3);
p.lineTo(0, 3);
p.lineTo(0, 0);
p.createEmptyMovieClip("progress", 1);
p.progress._x = 0;
p.progress._y = 0;
p.onEnterFrame = function () {
var _local2 = this;
var _local3 = _local2._parent.getBytesTotal();
var prog = _local2._parent.getBytesLoaded();
var _local1 = prog / _local3;
_local1 = Math.floor(100 * _local1);
if (_local1 == 100) {
_local2._parent.gotoAndStop(2);
_local2.removeMovieClip();
}
p.progress.beginFill(16777215, 100);
p.progress.moveTo(0, 0);
p.progress.lineTo(_local1, 0);
p.progress.lineTo(_local1, 3);
p.progress.lineTo(0, 3);
p.progress.lineTo(0, 0);
p.progress.endFill();
};
stop();
Frame 2
stop();
Symbol 114 Button
on (release) {
runGame();
}
Symbol 119 Button
on (release) {
playSoundEffect("hitbutton");
if (waitingToStart) {
waitingToStart = false;
compileProgram();
}
}
Symbol 122 Button
on (release) {
playSoundEffect("hitbutton");
if (waitingToStart) {
clearProgram();
redrawCommands();
}
}
Symbol 125 Button
on (release) {
playSoundEffect("hitbutton");
if (waitingToStart) {
var mc = attachMovie("howToPlay", "howToPlay", 1234);
mc._x = (mc._y = 30);
mc.onRelease = function () {
this.removeMovieClip();
};
}
}