Frame 1
fscommand ("allowscale", false);
playing = 0;
stop();
Instance of Symbol 12 MovieClip in Frame 1
onClipEvent (enterFrame) {
text = ((int(_parent.getBytesLoaded() / 1000) add " OF ") add int(_parent.getBytesTotal() / 1000)) add " D-STAR LOADED ...";
if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
_parent.gotoAndPlay(2);
}
}
Frame 2
level = 1;
moves = 0;
collect = new Sound(_root.mySound);
collect.attachSound("collect");
space = new Sound(_root.mySound);
space.attachSound("space");
stop();
Frame 3
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]);
if (map[_local2][_local1] == 3) {
ex++;
}
if (map[_local2][_local1] == 4) {
bY = _local2;
bX = _local1;
}
_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 charControl() {
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 (playGame) {
if (Key.isDown(38)) {
up = true;
} else if (Key.isDown(40)) {
down = true;
} else if (Key.isDown(37)) {
left = true;
} else if (Key.isDown(39)) {
right = true;
}
}
if (up == true) {
playGame = false;
if ((myMap[_local3][_local2] == M) or (myMap[_local3][_local2] == E)) {
if (mov) {
mov = false;
moves++;
}
if (myMap[_local3][_local2] == E) {
_root[(("t_" + _local3) + "_") + _local2].gotoAndStop(2);
myMap[_local3][_local2] = M;
collect.start(0, 1);
exitCounter++;
}
char._y = char._y - 16;
} else {
up = false;
playGame = true;
mov = true;
}
}
if (down == true) {
playGame = false;
if ((myMap[dy][_local2] == M) or (myMap[dy][_local2] == E)) {
if (mov) {
mov = false;
moves++;
}
if (myMap[dy][_local2] == E) {
_root[(("t_" + dy) + "_") + _local2].gotoAndStop(2);
myMap[dy][_local2] = M;
collect.start(0, 1);
exitCounter++;
}
char._y = char._y + 16;
} else {
down = false;
playGame = true;
mov = true;
}
}
if (left == true) {
playGame = false;
if ((myMap[_local1][lx] == M) or (myMap[_local1][lx] == E)) {
if (mov) {
mov = false;
moves++;
}
if (myMap[_local1][lx] == E) {
_root[(("t_" + _local1) + "_") + lx].gotoAndStop(2);
myMap[_local1][lx] = M;
collect.start(0, 1);
exitCounter++;
}
char._x = char._x - 16;
} else {
left = false;
playGame = true;
mov = true;
}
}
if (right == true) {
playGame = false;
if ((myMap[_local1][rx] == M) or (myMap[_local1][rx] == E)) {
if (mov) {
mov = false;
moves++;
}
if (myMap[_local1][rx] == E) {
_root[(("t_" + _local1) + "_") + rx].gotoAndStop(2);
myMap[_local1][rx] = M;
collect.start(0, 1);
exitCounter++;
}
char._x = char._x + 16;
} else {
right = false;
playGame = true;
mov = true;
}
}
if ((Key.isDown(32) and playGame) and hit) {
hit = false;
moves++;
removeMovieClip(char);
createChar(bX, bY);
_root[(("t_" + bY) + "_") + bX].gotoAndStop(2);
myMap[bY][bX] = 2;
_root[(("t_" + _local1) + "_") + _local2].gotoAndStop(4);
myMap[_local1][_local2] = 4;
bX = _local2;
bY = _local1;
space.start(0, 1);
}
if (ex == exitCounter) {
playGame = false;
level++;
nextFrame();
}
if (Key.isDown(17)) {
playGame = false;
nextFrame();
}
if (moves >= 1024) {
gotoAndStop (6);
}
}
function removeTiles() {
var _local3 = _root;
up = false;
down = false;
left = false;
right = false;
var _local2 = 0;
while (_local2 < mapHeight) {
var _local1 = 0;
while (_local1 < mapWidth) {
removeMovieClip(_local3[(("t_" + _local2) + "_") + _local1]);
removeMovieClip(char);
_local1++;
}
_local2++;
}
}
myMap1 = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1, 1], [1, 2, 1, 2, 2, 2, 2, 2, 3, 2, 1, 1], [1, 2, 1, 1, 2, 2, 3, 2, 2, 2, 2, 1], [1, 2, 2, 1, 3, 2, 2, 2, 2, 2, 2, 1], [1, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 1], [1, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 4, 2, 2, 3, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
myMap2 = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 1], [1, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 1, 3, 1, 2, 1, 2, 2, 1, 2, 1, 1], [1, 2, 1, 3, 1, 2, 2, 1, 3, 1, 2, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 2, 1, 2, 2, 4, 2, 1, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
myMap3 = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1], [1, 2, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1], [1, 2, 3, 1, 3, 2, 2, 2, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 3, 1, 2, 3, 2, 1], [1, 2, 1, 3, 2, 2, 2, 2, 2, 2, 2, 1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1, 1, 1, 1, 1, 1, 1, 1]];
myMap10 = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1], [1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1], [1, 2, 1, 2, 1, 2, 2, 3, 1, 2, 2, 1], [1, 2, 3, 1, 3, 2, 2, 1, 3, 2, 2, 1], [1, 2, 1, 2, 1, 2, 2, 3, 1, 2, 2, 1], [1, 2, 2, 1, 2, 2, 1, 1, 2, 2, 2, 1], [1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
tileW = 32;
tileH = 32;
s = 32;
M = 2;
E = 3;
ex = 0;
exitCounter = 0;
myMap = _root["myMap" + level];
buildMap(myMap);
createChar(4, 7);
playGame = true;
hit = true;
mov = true;
stop();
Instance of Symbol 21 MovieClip in Frame 3
onClipEvent (enterFrame) {
_root.charControl();
}
onClipEvent (keyUp) {
_root.hit = true;
}
Frame 4
if (level == 11) {
nextFrame();
} else {
removeTiles();
prevFrame();
}
Frame 5
removeTiles();
finalMoves = ("You made it with " + moves) + " moves !";
stop();
Frame 6
removeTiles();
stop();
Symbol 5 MovieClip Frame 1
stop();
Symbol 15 Button
on (press) {
nextFrame();
}
Symbol 18 Button
on (press) {
getURL ("http://www.freestuff.gr/lightforce", "_blank");
}
Symbol 29 Button
on (release) {
if (_root.playing == 1) {
stopAllSounds();
loopSound.gotoAndStop("Stop");
playing = 0;
} else {
loopSound.gotoAndStop("Play");
playing = 1;
}
}
Symbol 31 MovieClip Frame 1
stop();
Symbol 34 Button
on (press) {
gotoAndPlay (2);
}