Frame 1
level = 1;
playing = 0;
push = new Sound(_root.mySound);
push.attachSound("push");
locked = new Sound(_root.mySound);
locked.attachSound("locked");
walk = new Sound(_root.mySound);
walk.attachSound("walk");
stop();
Instance of Symbol 17 MovieClip in Frame 1
onClipEvent (enterFrame) {
text = ((int(_parent.getBytesLoaded() / 1000) add " OF ") add int(_parent.getBytesTotal() / 1000)) add " LEDIX LOADED ...";
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
_parent.gotoAndStop(2);
}
}
Frame 2
function buildMap(map) {
var _local3 = this;
mapWidth = map[0].length;
mapHeight = map.length;
var _local2 = 0;
while (_local2 < mapHeight) {
var _local1 = 0;
while (_local1 < mapWidth) {
_local3.attachMovie("tile", (("t_" + _local2) + "_") + _local1, ++d);
_local3[(("t_" + _local2) + "_") + _local1]._x = _local1 * tileW;
_local3[(("t_" + _local2) + "_") + _local1]._y = _local2 * tileH;
_local3[(("t_" + _local2) + "_") + _local1].gotoAndStop(map[_local2][_local1]);
_local3[(("t_" + _local2) + "_") + _local1].exitBox = false;
if (map[_local2][_local1] == 3) {
ex++;
_local3[(("t_" + _local2) + "_") + _local1].exit = true;
} else {
_local3[(("t_" + _local2) + "_") + _local1].exit = false;
}
_local1++;
}
_local2++;
}
}
function createChar(px, py) {
attachMovie("char", "char", ++d);
var _local1 = char.getBounds(this);
var _local3 = (tileW * px) + _local1.xMax;
var _local2 = (tileH * py) + _local1.yMax;
char._x = _local3;
char._y = _local2;
}
function character(chardir) {
if (playGame) {
if (chardir == null) {
} else {
var dy = Math.floor((char._y + char._height) / tileH);
var _local3 = Math.floor((char._y - char._height) / tileH);
var lx = Math.floor((char._x - char._width) / tileW);
var rx = Math.floor((char._x + char._width) / tileW);
var _local2 = Math.floor(char._x / tileW);
var _local1 = Math.floor(char._y / tileH);
if (chardir == "up") {
if ((myMap[_local3][_local2] == M) or (myMap[_local3][_local2] == E)) {
char._y = char._y - s;
moves++;
walk.start(0, 1);
}
if (myMap[_local3][_local2] == B) {
if (myMap[_local3 - 1][_local2] == M) {
_root[(("t_" + _local3) + "_") + _local2].exitBox = false;
push.start(0, 1);
moves++;
BUp(_local3, _local2);
char._y = char._y - s;
} else if (myMap[_local3 - 1][_local2] == E) {
_root[(("t_" + _local3) + "_") + _local2].exitBox = false;
_root[(("t_" + (_local3 - 1)) + "_") + _local2].exitBox = true;
locked.start(0, 1);
moves++;
BUp(_local3, _local2);
char._y = char._y - s;
}
}
checkWin();
}
if (chardir == "down") {
if ((myMap[dy][_local2] == M) or (myMap[dy][_local2] == E)) {
char._y = char._y + s;
moves++;
walk.start(0, 1);
}
if (myMap[dy][_local2] == B) {
if (mymap[dy + 1][_local2] == M) {
_root[(("t_" + dy) + "_") + _local2].exitBox = false;
push.start(0, 1);
moves++;
BDown(dy, _local2);
char._y = char._y + s;
} else if (mymap[dy + 1][_local2] == E) {
_root[(("t_" + dy) + "_") + _local2].exitBox = false;
_root[(("t_" + (dy + 1)) + "_") + _local2].exitBox = true;
locked.start(0, 1);
moves++;
BDown(dy, _local2);
char._y = char._y + s;
}
}
checkWin();
}
if (chardir == "left") {
if ((myMap[_local1][lx] == M) or (myMap[_local1][lx] == E)) {
char._x = char._x - s;
moves++;
walk.start(0, 1);
}
if (myMap[_local1][lx] == B) {
if (myMap[_local1][lx - 1] == M) {
_root[(("t_" + _local1) + "_") + lx].exitBox = false;
push.start(0, 1);
moves++;
BLeft(_local1, lx);
char._x = char._x - s;
} else if (myMap[_local1][lx - 1] == E) {
_root[(("t_" + _local1) + "_") + lx].exitBox = false;
_root[(("t_" + _local1) + "_") + (lx - 1)].exitBox = true;
locked.start(0, 1);
moves++;
BLeft(_local1, lx);
char._x = char._x - s;
}
}
checkWin();
}
if (chardir == "right") {
if ((myMap[_local1][rx] == M) or (myMap[_local1][rx] == E)) {
char._x = char._x + s;
moves++;
walk.start(0, 1);
}
if (myMap[_local1][rx] == B) {
if (myMap[_local1][rx + 1] == M) {
_root[(("t_" + _local1) + "_") + rx].exitBox = false;
push.start(0, 1);
moves++;
BRight(_local1, rx);
char._x = char._x + s;
} else if (myMap[_local1][rx + 1] == E) {
_root[(("t_" + _local1) + "_") + rx].exitBox = false;
_root[(("t_" + _local1) + "_") + (rx + 1)].exitBox = true;
locked.start(0, 1);
moves++;
BRight(_local1, rx);
char._x = char._x + s;
}
}
checkWin();
}
updateAfterEvent();
}
}
}
function BUp(uy, cx) {
var _local1 = uy;
var _local2 = cx;
var _local3 = _root;
if (_local3[(("t_" + _local1) + "_") + _local2].exit == true) {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(E);
myMap[_local1][_local2] = E;
} else {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(M);
myMap[_local1][_local2] = M;
}
_local3[(("t_" + (_local1 - 1)) + "_") + _local2].gotoAndStop(B);
if (_local3[(("t_" + (_local1 - 1)) + "_") + _local2].exitBox == true) {
_local3[(("t_" + (_local1 - 1)) + "_") + _local2].gem.gotoAndStop(2);
}
myMap[_local1 - 1][_local2] = B;
}
function BDown(dy, cx) {
var _local1 = dy;
var _local2 = cx;
var _local3 = _root;
if (_local3[(("t_" + _local1) + "_") + _local2].exit == true) {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(E);
myMap[_local1][_local2] = E;
} else {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(M);
myMap[_local1][_local2] = M;
}
_local3[(("t_" + (_local1 + 1)) + "_") + _local2].gotoAndStop(B);
if (_local3[(("t_" + (_local1 + 1)) + "_") + _local2].exitBox == true) {
_local3[(("t_" + (_local1 + 1)) + "_") + _local2].gem.gotoAndStop(2);
}
myMap[_local1 + 1][_local2] = B;
}
function BLeft(cy, lx) {
var _local1 = cy;
var _local2 = lx;
var _local3 = _root;
if (_local3[(("t_" + _local1) + "_") + _local2].exit == true) {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(E);
myMap[_local1][_local2] = E;
} else {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(M);
myMap[_local1][_local2] = M;
}
_local3[(("t_" + _local1) + "_") + (_local2 - 1)].gotoAndStop(B);
if (_local3[(("t_" + _local1) + "_") + (_local2 - 1)].exitBox == true) {
_local3[(("t_" + _local1) + "_") + (_local2 - 1)].gem.gotoAndStop(2);
}
myMap[_local1][_local2 - 1] = B;
}
function BRight(cy, rx) {
var _local1 = cy;
var _local2 = rx;
var _local3 = _root;
if (_local3[(("t_" + _local1) + "_") + _local2].exit == true) {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(E);
myMap[_local1][_local2] = E;
} else {
_local3[(("t_" + _local1) + "_") + _local2].gotoAndStop(M);
myMap[_local1][_local2] = M;
}
_local3[(("t_" + _local1) + "_") + (_local2 + 1)].gotoAndStop(B);
if (_local3[(("t_" + _local1) + "_") + (_local2 + 1)].exitBox == true) {
_local3[(("t_" + _local1) + "_") + (_local2 + 1)].gem.gotoAndStop(2);
}
myMap[_local1][_local2 + 1] = B;
}
function checkWin() {
var _local3 = _root;
exitCounter = 0;
var _local2 = 0;
while (_local2 < mapHeight) {
var _local1 = 0;
while (_local1 < mapWidth) {
if (_local3[(("t_" + _local2) + "_") + _local1].exitBox == true) {
exitCounter++;
}
if (exitCounter == ex) {
playGame = false;
nextLevel.swapDepths(++d);
nextLevel.gotoAndPlay(2);
}
_local1++;
}
_local2++;
}
}
function placeChar(level) {
switch (level) {
case 1 :
createChar(4, 6);
return;
case 2 :
createChar(5, 2);
return;
case 3 :
createChar(6, 4);
return;
case 4 :
createChar(5, 2);
return;
case 5 :
createChar(2, 5);
return;
case 6 :
createChar(4, 2);
return;
case 7 :
createChar(5, 4);
return;
case 8 :
createChar(1, 4);
return;
case 9 :
createChar(3, 2);
return;
case 10 :
createChar(1, 5);
return;
case 11 :
createChar(2, 2);
return;
case 12 :
createChar(2, 5);
return;
case 13 :
createChar(4, 2);
return;
case 14 :
createChar(6, 6);
return;
case 15 :
createChar(6, 7);
return;
case 16 :
createChar(6, 6);
return;
case 17 :
createChar(2, 2);
return;
case 18 :
createChar(2, 2);
return;
case 19 :
createChar(3, 5);
return;
case 20 :
createChar(2, 7);
return;
case 21 :
createChar(6, 3);
return;
case 22 :
createChar(6, 5);
return;
case 23 :
createChar(6, 5);
return;
case 24 :
createChar(6, 3);
}
}
loopSound.gotoAndStop("Play");
playing = 1;
myMap1 = [[5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 1, 1, 1, 1, 1, 1], [5, 1, 1, 2, 2, 3, 2, 1], [5, 1, 2, 4, 2, 1, 2, 1], [5, 1, 2, 3, 4, 2, 2, 1], [5, 1, 2, 2, 1, 4, 1, 1], [5, 1, 3, 2, 2, 2, 1, 5], [5, 1, 1, 1, 1, 1, 1, 5]];
myMap2 = [[5, 5, 5, 5, 5, 5, 5, 5], [5, 1, 1, 1, 1, 1, 1, 1], [5, 1, 3, 2, 2, 2, 2, 1], [5, 1, 2, 1, 3, 1, 2, 1], [5, 1, 2, 2, 2, 4, 2, 1], [5, 1, 3, 4, 4, 2, 1, 1], [5, 1, 2, 2, 1, 1, 1, 5], [5, 1, 1, 1, 1, 5, 5, 5]];
myMap3 = [[5, 5, 5, 5, 5, 5, 5, 5], [5, 1, 1, 1, 5, 1, 1, 1], [5, 1, 3, 1, 1, 1, 3, 1], [5, 1, 2, 1, 2, 2, 3, 1], [5, 1, 2, 4, 4, 2, 2, 1], [5, 1, 2, 2, 4, 2, 2, 1], [5, 1, 2, 2, 1, 2, 2, 1], [5, 1, 2, 2, 1, 1, 1, 1], [5, 1, 1, 1, 1, 5, 5, 5]];
myMap4 = [[5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 1, 1, 1, 1, 5], [5, 5, 5, 1, 2, 2, 1, 1], [1, 1, 1, 1, 2, 2, 2, 1], [1, 3, 2, 1, 4, 4, 2, 1], [1, 2, 2, 2, 2, 2, 1, 1], [1, 3, 2, 2, 4, 1, 1, 5], [1, 1, 3, 2, 2, 1, 5, 5], [5, 1, 1, 1, 1, 1, 5, 5]];
myMap5 = [[5, 5, 5, 5, 5, 5, 5, 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, 2, 2, 1, 5], [1, 3, 2, 2, 1, 2, 1, 5], [1, 3, 3, 2, 2, 2, 1, 5], [1, 1, 1, 1, 1, 1, 1, 5]];
fscommand ("allowscale", false);
_root.help._visible = false;
tileW = 32;
tileH = 32;
ex = 0;
s = 32;
M = 2;
E = 3;
B = 4;
moves = 0;
playGame = true;
levelUp = true;
myMap = _root["myMap" + level];
buildMap(myMap);
placeChar(level);
stop();
Instance of Symbol 18 MovieClip in Frame 2
onClipEvent (keyDown) {
var chardir;
if (Key.isDown(38)) {
chardir = "up";
} else if (Key.isDown(40)) {
chardir = "down";
} else if (Key.isDown(37)) {
chardir = "left";
} else if (Key.isDown(39)) {
chardir = "right";
} else {
chardir = null;
}
_root.character(chardir);
updateAfterEvent();
}
Frame 3
var i = 0;
while (i < mapHeight) {
var j = 0;
while (j < mapWidth) {
removeMovieClip(_root[(("t_" + i) + "_") + j]);
j++;
}
i++;
}
removeMovieClip(char);
if (levelUp == true) {
level++;
} else {
level--;
}
if (level < 1) {
level = 24;
}
if (level > 24) {
level = 1;
}
prevFrame();
Symbol 10 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 1
stop();
Symbol 25 MovieClip Frame 110
_root.nextFrame();
Symbol 35 Button
on (press) {
getURL ("http://www.freestuff.gr/lightforce", "_blank");
}
Symbol 39 Button
on (release) {
if (_root.playing == 1) {
stopAllSounds();
loopSound.gotoAndStop("Stop");
playing = 0;
} else {
loopSound.gotoAndStop("Play");
playing = 1;
}
}
Symbol 43 Button
on (press) {
if (playGame == true) {
level--;
nextFrame();
}
}
Symbol 46 MovieClip Frame 1
stop();
Symbol 51 Button
on (press) {
getURL ("http://www.smashingames.com/cstrack/out.php?http://www.smashingames.com/", "_top");
}
Symbol 55 Button
on (release) {
_root.help._visible = true;
}
Symbol 63 Button
on (release) {
_root.help._visible = false;
}