Frame 1
function buildMap(map) {
_root.attachMovie("empty", "tiles", ++d);
game.clip = _root.tiles;
game.clip._x = gameInitial_x;
game.clip._y = gameInitial_y;
var mapWidth = map[0].length;
var mapHeight = map.length;
var i = 0;
while (i < mapHeight) {
var j = 0;
while (j < mapWidth) {
var name = ((("t_" + i) + "_") + j);
game[name] = new game["Tile" + map[i][j]]();
game.clip.attachMovie("tile", name, (i * 100) + (j * 2));
game.clip[name]._x = j * game.tileW;
game.clip[name]._y = i * game.tileH;
game.clip[name].gotoAndStop(game[name].frame);
j++;
}
i++;
}
game.items = myItems;
var i = 0;
while (i < game.items.length) {
var name = ((("item" + game.items[i][2]) + "_") + game.items[i][1]);
game[name] = new game["Item" + game.items[i][0]]();
game[name].position = i;
game.clip.attachMovie("item", name, 10001 + i);
game[name].clip = game.clip[name];
game[name].clip._x = (game.items[i][1] * game.tileW) + (game.tileW / 2);
game[name].clip._y = (game.items[i][2] * game.tileH) + (game.tileH / 2);
game[name].clip.gotoAndStop(game.items[i][0]);
i++;
}
_root.points = game.points;
var enemies = myEnemies;
game.currentEnemies = enemies.length;
var i = 0;
while (i < game.currentEnemies) {
var name = ("enemy" + i);
game[name] = new game["Enemyp" + enemies[i][0]]();
game.clip.attachMovie("enemy1", name, 10012 + i);
game[name].clip = game.clip[name];
game[name].xtile = enemies[i][1];
game[name].ytile = enemies[i][2];
game[name].width = game.clip[name]._width / 2;
game[name].height = game.clip[name]._height / 2;
game[name].x = (game[name].xtile * game.tileW) + (game.tileW / 2);
game[name].y = (game[name].ytile * game.tileH) + (game.tileH / 2);
game[name].clip._x = game[name].x;
game[name].clip._y = game[name].y;
i++;
}
game.clip.attachMovie("char", "char", 1000);
char.clip = game.clip.char;
char.x = (char.xtile * game.tileW) + (game.tileW / 2);
char.y = (char.ytile * game.tileH) + (game.tileH / 2);
char.width = char.clip._width / 2;
char.height = char.clip._height / 2;
char.clip._x = char.x;
char.clip._y = char.y;
}
function enemyBrain() {
var i = 0;
while (i < 5) {
var name = ("enemy" + i);
var ob = game[name];
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (((ob.downleft and ob.upleft) and ob.downright) and ob.upleft) {
moveChar(ob, ob.xMove, ob.yMove);
} else {
ob.xMove = -ob.xMove;
ob.yMove = -ob.yMove;
}
if (!_root.infiniteLife) {
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
_root.lifes = _root.lifes - 1;
mylifes.gotoAndStop(_root.lifes);
if (lifes == 0) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(35);
}
if (!_root.hurt) {
char.clip.gotoAndPlay("hurt");
return(undefined);
}
}
}
i++;
}
}
function starting_point() {
char.x = (startingXtile * game.tileW) + (game.tileW / 2);
char.y = (startingYtile * game.tileH) + (game.tileH / 2);
char.clip._x = char.x;
char.clip._y = char.y;
}
function detectKeys() {
var ob = _root.char;
var keypressed = false;
if (key.isDown(39)) {
keyPressed = _root.moveChar(ob, 1, 0);
} else if (key.isDown(37)) {
keyPressed = _root.moveChar(ob, -1, 0);
} else if (key.isDown(38)) {
keyPressed = _root.moveChar(ob, 0, -1);
} else if (key.isDown(40)) {
keyPressed = _root.moveChar(ob, 0, 1);
}
if (!KeyPressed) {
ob.clip.mychar.gotoAndStop(1);
} else {
ob.clip.mychar.play();
}
enemyBrain();
}
function moveChar(ob, dirx, diry) {
getMyCorners(ob.x, ob.y + (ob.speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
}
}
if (diry == 1) {
if (ob.downleft and ob.downright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
getMyCorners(ob.x + (ob.speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
ob.clip.gotoAndStop((dirx + (diry * 2)) + 3);
ob.xtile = Math.floor(ob.clip._x / game.tileW);
ob.ytile = Math.floor(ob.clip._y / game.tileH);
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == _root.char)) {
game.points = true;
removeMovieClip(itemname.clip);
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
if ((game.points = true)) {
opendoorname = (("t_" + unlockY) + "_") + unlockX;
game.clip[opendoorname].gotoAndStop(4);
game.Tile2.prototype.walkable = true;
}
}
if (((_root.char.ytile == unlockY) && (_root.char.xtile == unlockX)) && (_root.unlock)) {
removeMovieClip(_root.tiles);
_root.unlock = false;
_root.nextFrame();
}
return(true);
}
function getMyCorners(x, y, ob) {
ob.downY = Math.floor(((y + ob.height) - 1) / game.tileH);
ob.upY = Math.floor((y - ob.height) / game.tileH);
ob.leftX = Math.floor((x - ob.width) / game.tileW);
ob.rightX = Math.floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = game[(("t_" + ob.upY) + "_") + ob.leftX].walkable;
ob.downleft = game[(("t_" + ob.downY) + "_") + ob.leftX].walkable;
ob.upright = game[(("t_" + ob.upY) + "_") + ob.rightX].walkable;
ob.downright = game[(("t_" + ob.downY) + "_") + ob.rightX].walkable;
}
gameInitial_x = 75;
gameInitial_y = 106;
hurt = false;
unlock = false;
lifes = 4;
infiniteLife = false;
stop();
var tempLv = 0;
Frame 2
fscommand ("allowscale", true);
myMap1 = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 1, 1, 1, 1, 1, 1, 5, 5], [5, 5, 1, 0, 0, 1, 0, 1, 5, 5], [5, 5, 1, 0, 0, 0, 2, 1, 5, 5], [5, 5, 1, 0, 0, 1, 0, 1, 5, 5], [5, 5, 1, 1, 1, 1, 1, 1, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
game = {tileW:45, tileH:45, currentMap:1, points:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
unlockY = 4;
unlockX = 6;
char = {xtile:3, ytile:4, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
myEnemies = [[1, 4, 4]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 0;
game.Enemyp1.prototype.yMove = -1;
game.Enemyp1.prototype.speed = 0.5;
myItems = [[1, 3, 3]];
game.Item1 = function () {
};
game.Item1.prototype.points = false;
unlock = true;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 2
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys();
}
}
Frame 3
stop();
Frame 4
fscommand ("allowscale", true);
myMap1 = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 1, 1, 1, 1, 1, 1, 1, 1, 5], [5, 1, 0, 1, 2, 0, 1, 0, 1, 5], [5, 1, 0, 0, 0, 0, 0, 0, 1, 5], [5, 1, 0, 1, 0, 0, 1, 0, 1, 5], [5, 1, 1, 1, 1, 1, 1, 1, 1, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
game = {tileW:45, tileH:45, currentMap:1, points:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
unlockY = 3;
unlockX = 4;
char = {xtile:2, ytile:4, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoandstop(_root.lifes);
myEnemies = [[2, 4, 5], [2, 7, 5]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 1;
game.Enemyp1.prototype.yMove = 0;
game.Enemyp1.prototype.speed = 1;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 0;
game.Enemyp2.prototype.yMove = 1;
game.Enemyp2.prototype.speed = 1;
myItems = [[1, 7, 4]];
game.Item1 = function () {
};
game.Item1.prototype.points = false;
unlock = true;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 4
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys();
}
}
Frame 5
stop();
Frame 6
fscommand ("allowscale", true);
myMap1 = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 1, 1, 1, 1, 1, 1, 1, 1, 5], [5, 1, 0, 1, 2, 0, 1, 0, 1, 5], [5, 1, 0, 0, 0, 0, 0, 0, 1, 5], [5, 1, 0, 1, 0, 0, 1, 0, 1, 5], [5, 1, 1, 1, 1, 1, 1, 1, 1, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
game = {tileW:45, tileH:45, currentMap:1, points:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
unlockY = 3;
unlockX = 4;
char = {xtile:2, ytile:4, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoandstop(_root.lifes);
myEnemies = [[2, 4, 5], [2, 5, 5], [2, 7, 5]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 1;
game.Enemyp1.prototype.yMove = 0;
game.Enemyp1.prototype.speed = 1;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 0;
game.Enemyp2.prototype.yMove = 1;
game.Enemyp2.prototype.speed = 1;
myItems = [[1, 7, 4]];
game.Item1 = function () {
};
game.Item1.prototype.points = false;
unlock = true;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 6
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys();
}
}
Frame 7
stop();
Frame 8
fscommand ("allowscale", true);
myMap1 = [[1, 1, 5, 5, 5, 5, 5, 5, 1, 1], [1, 2, 1, 5, 5, 5, 5, 1, 0, 1], [1, 0, 1, 5, 5, 5, 5, 1, 0, 1], [1, 0, 0, 1, 1, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 1], [5, 1, 0, 0, 0, 0, 0, 0, 1, 5], [5, 5, 1, 0, 0, 1, 1, 1, 5, 5], [5, 5, 5, 1, 1, 5, 5, 5, 5, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
game = {tileW:45, tileH:45, currentMap:1, points:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
unlockY = 1;
unlockX = 1;
char = {xtile:8, ytile:1, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoandstop(_root.lifes);
myEnemies = [[1, 1, 4], [3, 1, 3], [2, 2, 5]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 1;
game.Enemyp1.prototype.yMove = 0;
game.Enemyp1.prototype.speed = 2;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 1;
game.Enemyp2.prototype.yMove = 0;
game.Enemyp2.prototype.speed = 1;
game.Enemyp3 = function () {
};
game.Enemyp3.prototype.xMove = 1;
game.Enemyp3.prototype.yMove = 1;
game.Enemyp3.prototype.speed = 1;
myItems = [[1, 4, 6]];
game.Item1 = function () {
};
game.Item1.prototype.points = false;
unlock = true;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 8
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys();
}
}
Frame 9
stop();
Frame 10
function buildMap(map) {
function enemyBrain() {
var i = 0;
while (i < 5) {
var name = ("enemy" + i);
var ob = game[name];
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (((ob.downleft and ob.upleft) and ob.downright) and ob.upleft) {
moveChar(ob, ob.xMove, ob.yMove);
} else {
ob.xMove = -ob.xMove;
ob.yMove = -ob.yMove;
}
if (!_root.infiniteLife) {
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
_root.lifes = _root.lifes - 1;
mylifes.gotoAndStop(_root.lifes);
if (_root.lifes == 0) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(35);
}
if (!_root.hurt) {
char.clip.gotoAndPlay("hurt");
return(undefined);
}
}
}
i++;
}
}
function detectKeys() {
var ob = _root.char;
var keypressed = false;
if (key.isDown(39)) {
keyPressed = _root.moveChar(ob, 1, 0);
} else if (key.isDown(37)) {
keyPressed = _root.moveChar(ob, -1, 0);
} else if (key.isDown(38)) {
keyPressed = _root.moveChar(ob, 0, -1);
} else if (key.isDown(40)) {
keyPressed = _root.moveChar(ob, 0, 1);
}
if (!KeyPressed) {
ob.clip.mychar.gotoAndStop(1);
} else {
ob.clip.mychar.play();
}
enemyBrain();
}
function moveChar(ob, dirx, diry) {
getMyCorners(ob.x, ob.y + (ob.speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
}
}
if (diry == 1) {
if (ob.downleft and ob.downright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
getMyCorners(ob.x + (ob.speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
ob.clip.gotoAndStop((dirx + (diry * 2)) + 3);
ob.xtile = Math.floor(ob.clip._x / game.tileW);
ob.ytile = Math.floor(ob.clip._y / game.tileH);
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == _root.char)) {
game.points = true;
removeMovieClip(itemname.clip);
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
var name = "enemy3";
game[name] = new game.Enemyp3();
game.clip.attachMovie("enemy1", name, 10005);
game[name].clip = game.clip[name];
game[name].xtile = 4;
game[name].ytile = 2;
game[name].width = game.clip[name]._width / 2;
game[name].height = game.clip[name]._height / 2;
game[name].x = (game[name].xtile * game.tileW) + (game.tileW / 2);
game[name].y = (game[name].ytile * game.tileH) + (game.tileH / 2);
game[name].clip._x = game[name].x;
game[name].clip._y = game[name].y;
if ((game.points = true)) {
opendoorname = (("t_" + unlockY) + "_") + unlockX;
game.clip[opendoorname].gotoAndStop(4);
game.Tile2.prototype.walkable = true;
}
}
if ((_root.char.ytile == unlockY) && (_root.char.xtile == unlockX)) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(11);
}
if ((_root.char.ytile == 4) && (_root.char.xtile == 4)) {
var name = "enemy3";
game[name].xMove = 0;
game[name].yMove = -1;
game[name].speed = 0.5;
}
return(true);
}
function getMyCorners(x, y, ob) {
ob.downY = Math.floor(((y + ob.height) - 1) / game.tileH);
ob.upY = Math.floor((y - ob.height) / game.tileH);
ob.leftX = Math.floor((x - ob.width) / game.tileW);
ob.rightX = Math.floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = game[(("t_" + ob.upY) + "_") + ob.leftX].walkable;
ob.downleft = game[(("t_" + ob.downY) + "_") + ob.leftX].walkable;
ob.upright = game[(("t_" + ob.upY) + "_") + ob.rightX].walkable;
ob.downright = game[(("t_" + ob.downY) + "_") + ob.rightX].walkable;
}
_root.attachMovie("empty", "tiles", ++d);
game.clip = _root.tiles;
game.clip._x = gameInitial_x;
game.clip._y = gameInitial_y;
var mapWidth = map[0].length;
var mapHeight = map.length;
var i = 0;
while (i < mapHeight) {
var j = 0;
while (j < mapWidth) {
var name = ((("t_" + i) + "_") + j);
game[name] = new game["Tile" + map[i][j]]();
game.clip.attachMovie("tile", name, (i * 100) + (j * 2));
game.clip[name]._x = j * game.tileW;
game.clip[name]._y = i * game.tileH;
game.clip[name].gotoAndStop(game[name].frame);
j++;
}
i++;
}
game.items = myItems;
var i = 0;
while (i < game.items.length) {
var name = ((("item" + game.items[i][2]) + "_") + game.items[i][1]);
game[name] = new game["Item" + game.items[i][0]]();
game[name].position = i;
game.clip.attachMovie("item", name, 10001 + i);
game[name].clip = game.clip[name];
game[name].clip._x = (game.items[i][1] * game.tileW) + (game.tileW / 2);
game[name].clip._y = (game.items[i][2] * game.tileH) + (game.tileH / 2);
game[name].clip.gotoAndStop(game.items[i][0]);
i++;
}
var enemies = myEnemies;
game.currentEnemies = enemies.length;
var i = 0;
while (i < game.currentEnemies) {
var name = ("enemy" + i);
game[name] = new game["Enemyp" + enemies[i][0]]();
game.clip.attachMovie("enemy1", name, 10021 + i);
game[name].clip = game.clip[name];
game[name].xtile = enemies[i][1];
game[name].ytile = enemies[i][2];
game[name].width = game.clip[name]._width / 2;
game[name].height = game.clip[name]._height / 2;
game[name].x = (game[name].xtile * game.tileW) + (game.tileW / 2);
game[name].y = (game[name].ytile * game.tileH) + (game.tileH / 2);
game[name].clip._x = game[name].x;
game[name].clip._y = game[name].y;
i++;
}
game.clip.attachMovie("char", "char", 1000);
char.clip = game.clip.char;
char.x = (char.xtile * game.tileW) + (game.tileW / 2);
char.y = (char.ytile * game.tileH) + (game.tileH / 2);
char.width = char.clip._width / 2;
char.height = char.clip._height / 2;
char.clip._x = char.x;
char.clip._y = char.y;
}
function enemyBrain() {
var i = 0;
while (i < 5) {
var name = ("enemy" + i);
var ob = game[name];
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (((ob.downleft and ob.upleft) and ob.downright) and ob.upleft) {
moveChar(ob, ob.xMove, ob.yMove);
} else {
ob.xMove = -ob.xMove;
ob.yMove = -ob.yMove;
}
if (!_root.infiniteLife) {
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
_root.lifes = _root.lifes - 1;
mylifes.gotoAndStop(_root.lifes);
if (_root.lifes == 0) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(35);
}
if (!_root.hurt) {
char.clip.gotoAndPlay("hurt");
return(undefined);
}
}
}
i++;
}
}
function detectKeys() {
var ob = _root.char;
var keypressed = false;
if (key.isDown(39)) {
keyPressed = _root.moveChar(ob, 1, 0);
} else if (key.isDown(37)) {
keyPressed = _root.moveChar(ob, -1, 0);
} else if (key.isDown(38)) {
keyPressed = _root.moveChar(ob, 0, -1);
} else if (key.isDown(40)) {
keyPressed = _root.moveChar(ob, 0, 1);
}
if (!KeyPressed) {
ob.clip.mychar.gotoAndStop(1);
} else {
ob.clip.mychar.play();
}
enemyBrain();
}
function moveChar(ob, dirx, diry) {
getMyCorners(ob.x, ob.y + (ob.speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
}
}
if (diry == 1) {
if (ob.downleft and ob.downright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
getMyCorners(ob.x + (ob.speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
ob.clip.gotoAndStop((dirx + (diry * 2)) + 3);
ob.xtile = Math.floor(ob.clip._x / game.tileW);
ob.ytile = Math.floor(ob.clip._y / game.tileH);
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == _root.char)) {
game.points = true;
removeMovieClip(itemname.clip);
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
var name = "enemy3";
game[name] = new game.Enemyp3();
game.clip.attachMovie("enemy1", name, 10005);
game[name].clip = game.clip[name];
game[name].xtile = 4;
game[name].ytile = 2;
game[name].width = game.clip[name]._width / 2;
game[name].height = game.clip[name]._height / 2;
game[name].x = (game[name].xtile * game.tileW) + (game.tileW / 2);
game[name].y = (game[name].ytile * game.tileH) + (game.tileH / 2);
game[name].clip._x = game[name].x;
game[name].clip._y = game[name].y;
if ((game.points = true)) {
opendoorname = (("t_" + unlockY) + "_") + unlockX;
game.clip[opendoorname].gotoAndStop(4);
game.Tile2.prototype.walkable = true;
}
}
if ((_root.char.ytile == unlockY) && (_root.char.xtile == unlockX)) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(11);
}
if ((_root.char.ytile == 4) && (_root.char.xtile == 4)) {
var name = "enemy3";
game[name].xMove = 0;
game[name].yMove = -1;
game[name].speed = 0.5;
}
return(true);
}
function getMyCorners(x, y, ob) {
ob.downY = Math.floor(((y + ob.height) - 1) / game.tileH);
ob.upY = Math.floor((y - ob.height) / game.tileH);
ob.leftX = Math.floor((x - ob.width) / game.tileW);
ob.rightX = Math.floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = game[(("t_" + ob.upY) + "_") + ob.leftX].walkable;
ob.downleft = game[(("t_" + ob.downY) + "_") + ob.leftX].walkable;
ob.upright = game[(("t_" + ob.upY) + "_") + ob.rightX].walkable;
ob.downright = game[(("t_" + ob.downY) + "_") + ob.rightX].walkable;
}
fscommand ("allowscale", true);
myMap1 = [[5, 5, 5, 5, 1, 5, 5, 5, 5, 5], [5, 5, 5, 1, 2, 1, 5, 5, 5, 5], [5, 5, 1, 0, 0, 0, 1, 5, 5, 5], [5, 5, 5, 1, 0, 1, 1, 1, 1, 5], [5, 5, 1, 0, 0, 0, 0, 0, 0, 1], [5, 5, 5, 1, 0, 1, 1, 0, 1, 5], [5, 5, 5, 1, 0, 1, 5, 1, 5, 5], [5, 5, 1, 0, 0, 1, 5, 5, 5, 5], [5, 5, 5, 1, 1, 5, 5, 5, 5, 5]];
game = {tileW:45, tileH:45, currentMap:1, points:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
unlockY = 1;
unlockX = 4;
char = {xtile:3, ytile:7, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoAndStop(_root.lifes);
myEnemies = [[1, 3, 4], [2, 4, 2]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 1;
game.Enemyp1.prototype.yMove = 0;
game.Enemyp1.prototype.speed = 1;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 1;
game.Enemyp2.prototype.yMove = 0;
game.Enemyp2.prototype.speed = 1;
game.Enemyp3 = function () {
};
game.Enemyp3.prototype.xMove = 0;
game.Enemyp3.prototype.yMove = 1;
game.Enemyp3.prototype.speed = 1;
myItems = [[1, 7, 5]];
game.Item1 = function () {
};
game.Item1.prototype.points = false;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 10
onClipEvent (enterFrame) {
if (!_root.hurt) {
_parent.detectKeys();
}
}
Frame 11
if (_root.tempLv == 8) {
gotoAndStop (15);
} else if (_root.tempLv == 9) {
gotoAndStop (40);
}
stop();
Frame 12
function enemyBrain6() {
var i = 0;
while (i < 5) {
var name = ("enemy" + i);
var ob = game[name];
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (((ob.downleft and ob.upleft) and ob.downright) and ob.upleft) {
moveChar6(ob, ob.xMove, ob.yMove);
} else {
ob.xMove = -ob.xMove;
ob.yMove = -ob.yMove;
}
if (!_root.infiniteLife) {
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
_root.lifes = _root.lifes - 1;
mylifes.gotoAndStop(_root.lifes);
if (_root.lifes == 0) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(35);
}
if (!_root.hurt) {
char.clip.gotoAndPlay("hurt");
return(undefined);
}
}
}
i++;
}
}
function detectKeys_6() {
var ob = _root.char;
var keypressed = false;
if (key.isDown(39)) {
keyPressed = _root.moveChar6(ob, 1, 0);
} else if (key.isDown(37)) {
keyPressed = _root.moveChar6(ob, -1, 0);
} else if (key.isDown(38)) {
keyPressed = _root.moveChar6(ob, 0, -1);
} else if (key.isDown(40)) {
keyPressed = _root.moveChar6(ob, 0, 1);
}
if (!KeyPressed) {
ob.clip.mychar.gotoAndStop(1);
} else {
ob.clip.mychar.play();
}
enemyBrain6();
}
function moveChar6(ob, dirx, diry) {
getMyCorners(ob.x, ob.y + (ob.speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
}
}
if (diry == 1) {
if (ob.downleft and ob.downright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
getMyCorners(ob.x + (ob.speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
ob.clip.gotoandstop((dirx + (diry * 2)) + 3);
ob.xtile = Math.floor(ob.clip._x / game.tileW);
ob.ytile = Math.floor(ob.clip._y / game.tileH);
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == _root.char)) {
game.points = true;
removeMovieClip(itemname.clip);
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
var name = "enemy3";
game[name] = new game.Enemyp1();
game.clip.attachMovie("enemy1", name, 10025);
game[name].clip = game.clip[name];
game[name].xtile = 2;
game[name].ytile = 2;
game[name].width = game.clip[name]._width / 2;
game[name].height = game.clip[name]._height / 2;
game[name].x = (game[name].xtile * game.tileW) + (game.tileW / 2);
game[name].y = (game[name].ytile * game.tileH) + (game.tileH / 2);
game[name].clip._x = game[name].x;
game[name].clip._y = game[name].y;
var name = "enemy4";
game[name] = new game.Enemyp2();
game.clip.attachMovie("enemy1", name, 10026);
game[name].clip = game.clip[name];
game[name].xtile = 2;
game[name].ytile = 2;
game[name].width = game.clip[name]._width / 2;
game[name].height = game.clip[name]._height / 2;
game[name].x = (game[name].xtile * game.tileW) + (game.tileW / 2);
game[name].y = (game[name].ytile * game.tileH) + (game.tileH / 2);
game[name].clip._x = game[name].x;
game[name].clip._y = game[name].y;
var name = "enemy2";
game[name].xMove = 1;
game[name].yMove = 0;
game[name].speed = 2;
if ((game.points = true)) {
opendoorname = (("t_" + unlockY) + "_") + unlockX;
game.clip[opendoorname].gotoandstop(4);
game.Tile2.prototype.walkable = true;
}
}
if ((_root.char.ytile == 4) && (_root.char.xtile == 2)) {
var name = "enemy3";
game[name].xMove = 0;
game[name].yMove = -1;
game[name].speed = 1.2;
var name = "enemy4";
game[name].xMove = 0;
game[name].yMove = -1;
game[name].speed = 1.5;
}
if ((_root.char.ytile == unlockY) && (_root.char.xtile == unlockX)) {
removeMovieClip(_root.tiles);
_root.gotoAndStop(13);
}
return(true);
}
function getMyCorners(x, y, ob) {
ob.downY = Math.floor(((y + ob.height) - 1) / game.tileH);
ob.upY = Math.floor((y - ob.height) / game.tileH);
ob.leftX = Math.floor((x - ob.width) / game.tileW);
ob.rightX = Math.floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = game[(("t_" + ob.upY) + "_") + ob.leftX].walkable;
ob.downleft = game[(("t_" + ob.downY) + "_") + ob.leftX].walkable;
ob.upright = game[(("t_" + ob.upY) + "_") + ob.rightX].walkable;
ob.downright = game[(("t_" + ob.downY) + "_") + ob.rightX].walkable;
}
fscommand ("allowscale", true);
myMap1 = [[5, 5, 5, 5, 5, 5, 5, 5, 5, 5], [5, 1, 1, 1, 1, 1, 1, 1, 1, 5], [5, 1, 2, 1, 1, 0, 0, 0, 1, 5], [5, 1, 0, 1, 1, 0, 0, 0, 1, 5], [5, 1, 0, 0, 0, 0, 0, 0, 1, 5], [5, 1, 0, 1, 1, 1, 1, 0, 1, 5], [5, 1, 0, 1, 0, 0, 0, 0, 1, 5], [5, 1, 1, 1, 1, 1, 1, 1, 1, 5], [5, 5, 5, 5, 5, 5, 5, 5, 5, 5]];
game = {tileW:45, tileH:45, currentMap:1, points:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
unlockY = 2;
unlockX = 2;
char = {xtile:4, ytile:6, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoandstop(_root.lifes);
myEnemies = [[3, 7, 4], [2, 6, 2], [2, 5, 2]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 0;
game.Enemyp1.prototype.yMove = 1;
game.Enemyp1.prototype.speed = 2;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 0;
game.Enemyp2.prototype.yMove = 1;
game.Enemyp2.prototype.speed = 0.5;
game.Enemyp3 = function () {
};
game.Enemyp3.prototype.xMove = 0;
game.Enemyp3.prototype.yMove = 1;
game.Enemyp3.prototype.speed = 1;
myItems = [[1, 7, 2]];
game.Item1 = function () {
};
game.Item1.prototype.points = false;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 12
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys_6();
}
}
Frame 13
if (_root.tempLv == 8) {
gotoAndStop (15);
}
stop();
Frame 14
function enemyBrain7() {
var i = 0;
while (i < 10) {
var name = ("enemy" + i);
var ob = game[name];
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (((ob.downleft and ob.upleft) and ob.downright) and ob.upleft) {
moveChar(ob, ob.xMove, ob.yMove);
} else {
ob.xMove = -ob.xMove;
ob.yMove = -ob.yMove;
}
if (!_root.infiniteLife) {
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
_root.lifes = _root.lifes - 1;
youdied.gotoandplay(2);
mylifes.gotoandstop(_root.lifes);
if (_root.lifes == 0) {
removeMovieClip(_root.tiles);
gotoAndStop (35);
}
if (!_root.hurt) {
char.clip.gotoAndPlay("hurt");
return(undefined);
}
}
}
i++;
}
}
function detectKeys_7() {
var ob = _root.char;
var keypressed = false;
if (key.isDown(39)) {
keyPressed = _root.moveChar7(ob, 1, 0);
} else if (key.isDown(37)) {
keyPressed = _root.moveChar7(ob, -1, 0);
} else if (key.isDown(38)) {
keyPressed = _root.moveChar7(ob, 0, -1);
} else if (key.isDown(40)) {
keyPressed = _root.moveChar7(ob, 0, 1);
}
if (!KeyPressed) {
ob.clip.mychar.gotoandstop(1);
} else {
ob.clip.mychar.play();
}
enemyBrain7();
}
function moveChar7(ob, dirx, diry) {
getMyCorners(ob.x, ob.y + (ob.speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
}
}
if (diry == 1) {
if (ob.downleft and ob.downright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
getMyCorners(ob.x + (ob.speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
ob.clip.gotoandstop((dirx + (diry * 2)) + 3);
ob.xtile = Math.floor(ob.clip._x / game.tileW);
ob.ytile = Math.floor(ob.clip._y / game.tileH);
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == _root.char)) {
game.points = game.points + itemname.points;
removeMovieClip(itemname.clip);
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
}
if (game.points == 1) {
openwallname = "t_1_6";
game.clip[openwallname].gotoandstop(1);
openwallname = "t_3_3";
game.clip[openwallname].gotoandstop(1);
openwallname2 = "t_2_3";
game.clip[openwallname2].gotoandstop(1);
openwallname3 = "t_1_3";
game.clip[openwallname3].gotoandstop(1);
game.Tile7.prototype.walkable = true;
}
if (game.points == 1) {
opendoorname = (("t_" + unlockY) + "_") + unlockX;
game.clip[opendoorname].gotoandstop(4);
game.Tile2.prototype.walkable = true;
}
if ((_root.char.ytile == unlockY) && (_root.char.xtile == unlockX)) {
trace("here");
_root.tempLv = 8;
removeMovieClip(_root.tiles);
gotoAndStop (15);
}
if (((((((_root.char.ytile == 7) && (_root.char.xtile == 2)) || ((_root.char.ytile == 1) && (_root.char.xtile == 9))) || ((_root.char.ytile == 5) && (_root.char.xtile == 4))) || ((_root.char.ytile == 0) && (_root.char.xtile == 0))) || ((_root.char.ytile == 7) && (_root.char.xtile == 2))) || ((_root.char.ytile == 7) && (_root.char.xtile == 3))) {
_root.char.speed = 0.5;
} else {
_root.char.speed = 3;
}
return(true);
}
function getMyCorners(x, y, ob) {
ob.downY = Math.floor(((y + ob.height) - 1) / game.tileH);
ob.upY = Math.floor((y - ob.height) / game.tileH);
ob.leftX = Math.floor((x - ob.width) / game.tileW);
ob.rightX = Math.floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = game[(("t_" + ob.upY) + "_") + ob.leftX].walkable;
ob.downleft = game[(("t_" + ob.downY) + "_") + ob.leftX].walkable;
ob.upright = game[(("t_" + ob.upY) + "_") + ob.rightX].walkable;
ob.downright = game[(("t_" + ob.downY) + "_") + ob.rightX].walkable;
}
if (_root.tempLv == 8) {
gotoAndStop (16);
}
fscommand ("allowscale", true);
myMap1 = [[6, 0, 1, 0, 1, 0, 1, 0, 1, 1], [1, 0, 0, 0, 0, 0, 0, 0, 0, 6], [1, 0, 1, 0, 1, 0, 1, 0, 1, 0], [1, 0, 1, 0, 0, 0, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1], [1, 0, 0, 0, 6, 0, 0, 1, 1, 1], [1, 1, 1, 0, 1, 1, 1, 0, 0, 1], [1, 2, 6, 6, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
game = {tileW:45, tileH:45, currentMap:1, points:0, wallkey:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
game.Tile6 = function () {
};
game.Tile6.prototype.walkable = true;
game.Tile6.prototype.frame = 6;
game.Tile7 = function () {
};
game.Tile7.prototype.walkable = false;
game.Tile7.prototype.frame = 2;
unlockY = 7;
unlockX = 1;
char = {xtile:8, ytile:6, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoandstop(_root.lifes);
myEnemies = [[1, 1, 2], [1, 3, 2], [3, 3, 1], [3, 5, 5], [3, 2, 7], [1, 7, 1], [2, 5, 2]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 0;
game.Enemyp1.prototype.yMove = 1;
game.Enemyp1.prototype.speed = 1.5;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 0;
game.Enemyp2.prototype.yMove = 1;
game.Enemyp2.prototype.speed = 0.5;
game.Enemyp3 = function () {
};
game.Enemyp3.prototype.xMove = 1;
game.Enemyp3.prototype.yMove = 0;
game.Enemyp3.prototype.speed = 1;
game.Enemyp4 = function () {
};
game.Enemyp4.prototype.xMove = 0;
game.Enemyp4.prototype.yMove = 1;
game.Enemyp4.prototype.speed = 1.5;
game.Enemyp5 = function () {
};
game.Enemyp5.prototype.xMove = 1;
game.Enemyp5.prototype.yMove = 0;
game.Enemyp5.prototype.speed = 0.5;
myItems = [[1, 1, 0], [2, 3, 0], [3, 5, 0], [4, 7, 0]];
myRandom = (math.random() * 3) + 1;
myRandom = math.round(myRandom);
game.Item1 = function () {
};
if (myRandom == 1) {
game.Item1.prototype.points = 1;
} else {
game.Item1.prototype.points = 0;
}
game.Item2 = function () {
};
if (myRandom == 2) {
game.Item2.prototype.points = 1;
} else {
game.Item2.prototype.points = 0;
}
game.Item3 = function () {
};
if (myRandom == 3) {
game.Item3.prototype.points = 1;
} else {
game.Item3.prototype.points = 0;
}
game.Item4 = function () {
};
if (myRandom == 4) {
game.Item4.prototype.points = 1;
} else {
game.Item4.prototype.points = 0;
}
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
trace("lv7 loaded");
Instance of Symbol 27 MovieClip [empty] in Frame 14
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys_7();
}
}
Frame 15
stop();
Frame 16
function enemyBrain8() {
var i = 0;
while (i < 10) {
var name = ("enemy" + i);
var ob = game[name];
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (((ob.downleft and ob.upleft) and ob.downright) and ob.upleft) {
moveChar(ob, ob.xMove, ob.yMove);
} else {
ob.xMove = -ob.xMove;
ob.yMove = -ob.yMove;
}
if (!_root.infiniteLife) {
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
_root.lifes = _root.lifes - 1;
youdied.gotoandplay(2);
mylifes.gotoandstop(_root.lifes);
if (_root.lifes == 0) {
removeMovieClip(_root.tiles);
gotoAndStop (35);
}
if (!_root.hurt) {
char.clip.gotoAndPlay("hurt");
return(undefined);
}
}
}
i++;
}
}
function detectKeys_8() {
var ob = _root.char;
var keypressed = false;
if (key.isDown(39)) {
keyPressed = _root.moveChar8(ob, 1, 0);
} else if (key.isDown(37)) {
keyPressed = _root.moveChar8(ob, -1, 0);
} else if (key.isDown(38)) {
keyPressed = _root.moveChar8(ob, 0, -1);
} else if (key.isDown(40)) {
keyPressed = _root.moveChar8(ob, 0, 1);
}
if (!KeyPressed) {
ob.clip.mychar.gotoandstop(1);
} else {
ob.clip.mychar.play();
}
enemyBrain8();
}
function moveChar8(ob, dirx, diry) {
getMyCorners(ob.x, ob.y + (ob.speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
}
}
if (diry == 1) {
if (ob.downleft and ob.downright) {
ob.y = ob.y + (ob.speed * diry);
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
getMyCorners(ob.x + (ob.speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (ob.speed * dirx);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
ob.clip.gotoandstop((dirx + (diry * 2)) + 3);
ob.xtile = Math.floor(ob.clip._x / game.tileW);
ob.ytile = Math.floor(ob.clip._y / game.tileH);
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == _root.char)) {
game.points = game.points + itemname.points;
removeMovieClip(itemname.clip);
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
}
if (game.points == 1) {
openwallname = "t_1_6";
game.clip[openwallname].gotoandstop(1);
openwallname = "t_3_3";
game.clip[openwallname].gotoandstop(1);
openwallname2 = "t_2_3";
game.clip[openwallname2].gotoandstop(1);
openwallname3 = "t_1_3";
game.clip[openwallname3].gotoandstop(1);
game.Tile7.prototype.walkable = true;
}
if (game.points == 2) {
opendoorname = (("t_" + unlockY) + "_") + unlockX;
game.clip[opendoorname].gotoandstop(4);
game.Tile2.prototype.walkable = true;
}
if ((_root.char.ytile == unlockY) && (_root.char.xtile == unlockX)) {
_root.tempLv = 9;
removeMovieClip(_root.tiles);
gotoAndStop (40);
}
if ((((((((_root.char.ytile == 7) && (_root.char.xtile == 2)) || ((_root.char.ytile == 7) && (_root.char.xtile == 3))) || ((_root.char.ytile == 7) && (_root.char.xtile == 6))) || ((_root.char.ytile == 1) && (_root.char.xtile == 7))) || ((_root.char.ytile == 2) && (_root.char.xtile == 4))) || ((_root.char.ytile == 3) && (_root.char.xtile == 4))) || ((_root.char.ytile == 3) && (_root.char.xtile == 2))) {
_root.char.speed = 0.5;
} else {
_root.char.speed = 3;
}
return(true);
}
function getMyCorners(x, y, ob) {
ob.downY = Math.floor(((y + ob.height) - 1) / game.tileH);
ob.upY = Math.floor((y - ob.height) / game.tileH);
ob.leftX = Math.floor((x - ob.width) / game.tileW);
ob.rightX = Math.floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = game[(("t_" + ob.upY) + "_") + ob.leftX].walkable;
ob.downleft = game[(("t_" + ob.downY) + "_") + ob.leftX].walkable;
ob.upright = game[(("t_" + ob.upY) + "_") + ob.rightX].walkable;
ob.downright = game[(("t_" + ob.downY) + "_") + ob.rightX].walkable;
}
removeMovieClip(_root.tiles);
fscommand ("allowscale", true);
myMap1 = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 7, 0, 0, 7, 6, 0, 1], [1, 0, 0, 7, 6, 0, 0, 1, 0, 1], [1, 0, 6, 7, 6, 0, 0, 0, 1, 1], [1, 2, 0, 1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 1, 1, 0, 1, 0, 0, 1, 1], [1, 0, 6, 6, 0, 0, 6, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]];
game = {tileW:45, tileH:45, currentMap:1, points:0, wallkey:false};
game.Tile0 = function () {
};
game.Tile0.prototype.walkable = true;
game.Tile0.prototype.frame = 1;
game.Tile1 = function () {
};
game.Tile1.prototype.walkable = false;
game.Tile1.prototype.frame = 2;
game.Tile2 = function () {
};
game.Tile2.prototype.walkable = false;
game.Tile2.prototype.frame = 3;
game.Tile5 = function () {
};
game.Tile5.prototype.walkable = false;
game.Tile5.prototype.frame = 5;
game.Tile6 = function () {
};
game.Tile6.prototype.walkable = true;
game.Tile6.prototype.frame = 6;
game.Tile7 = function () {
};
game.Tile7.prototype.walkable = false;
game.Tile7.prototype.frame = 2;
unlockY = 4;
unlockX = 1;
char = {xtile:1, ytile:6, speed:3};
startingXtile = char.xtile;
startingYtile = char.ytile;
mylifes.gotoandstop(_root.lifes);
myEnemies = [[2, 1, 2], [2, 2, 1], [5, 1, 1], [3, 2, 2], [3, 1, 3], [3, 6, 7], [3, 7, 4], [2, 6, 2], [2, 5, 2], [2, 7, 4]];
game.Enemyp1 = function () {
};
game.Enemyp1.prototype.xMove = 0;
game.Enemyp1.prototype.yMove = 1;
game.Enemyp1.prototype.speed = 2;
game.Enemyp2 = function () {
};
game.Enemyp2.prototype.xMove = 0;
game.Enemyp2.prototype.yMove = 1;
game.Enemyp2.prototype.speed = 0.5;
game.Enemyp3 = function () {
};
game.Enemyp3.prototype.xMove = 1;
game.Enemyp3.prototype.yMove = 0;
game.Enemyp3.prototype.speed = 1;
game.Enemyp4 = function () {
};
game.Enemyp4.prototype.xMove = 0;
game.Enemyp4.prototype.yMove = 1;
game.Enemyp4.prototype.speed = 1.5;
game.Enemyp5 = function () {
};
game.Enemyp5.prototype.xMove = 1;
game.Enemyp5.prototype.yMove = 0;
game.Enemyp5.prototype.speed = 0.5;
myItems = [[1, 8, 1], [2, 6, 3]];
game.Item1 = function () {
};
game.Item1.prototype.points = 1;
game.Item2 = function () {
};
game.Item2.prototype.points = 1;
_root.buildMap(_root["myMap" + game.currentMap]);
stop();
Instance of Symbol 27 MovieClip [empty] in Frame 16
onClipEvent (enterFrame) {
if (!_root.hurt) {
_root.detectKeys_8();
}
}
Frame 35
stop();
Frame 40
stop();
Frame 45
stop();
Symbol 10 MovieClip [item] Frame 1
stop();
Symbol 10 MovieClip [item] Frame 2
stop();
Symbol 10 MovieClip [item] Frame 3
stop();
Symbol 10 MovieClip [item] Frame 4
stop();
Symbol 14 MovieClip Frame 15
gotoAndPlay (1);
Symbol 24 MovieClip [char] Frame 1
stop();
Symbol 24 MovieClip [char] Frame 6
_root.hurt = true;
Symbol 24 MovieClip [char] Frame 66
_root.hurt = false;
_root.starting_point();
Symbol 54 Button
on (release, keyPress "<Enter>") {
gotoAndPlay (1);
}
Symbol 61 Button
on (release) {
instruction.gotoAndPlay("open_instruction");
}
Symbol 73 Button
on (rollOver) {
lMouseover = true;
}
on (rollOut) {
lMouseover = false;
}
Symbol 76 Button
on (rollOver) {
lMouseover = true;
}
on (rollOut) {
lMouseover = false;
}
Symbol 78 MovieClip Frame 1
instructionContent = "";
instructionContent = "MOVEMENT";
instructionContent = instructionContent + "<br><br>Up arrow - up<br>Down arrow - down<br>Left arrow - left<br>Right arrow - right";
instructionContent = instructionContent + "<br><br>Navigate around the garden and pick up the letter box and head home. Avoid the bees!";
instructionField = instructionContent;
Instance of Symbol 74 MovieClip in Symbol 78 MovieClip Frame 1
onClipEvent (enterFrame) {
if (lMouseover) {
_parent.instructionField.scroll = _parent.instructionField.scroll - 1;
}
}
Instance of Symbol 77 MovieClip in Symbol 78 MovieClip Frame 1
onClipEvent (enterFrame) {
if (lMouseover) {
_parent.instructionField.scroll = _parent.instructionField.scroll + 1;
}
}
Symbol 78 MovieClip Frame 2
_parent.instructionField.scroll = 15;
stop();
Symbol 83 Button
on (release) {
gotoAndPlay ("close_instruction");
}
Symbol 84 MovieClip Frame 1
stop();
Symbol 84 MovieClip Frame 2
Symbol 84 MovieClip Frame 15
stop();
Symbol 84 MovieClip Frame 28
gotoAndStop (1);
Symbol 92 MovieClip Frame 4
stop();
Symbol 99 Button
on (release) {
_root.gotoAndStop(4);
}
Symbol 103 Button
on (release) {
_root.gotoAndStop(6);
}
Symbol 109 Button
on (release) {
_root.gotoAndStop(8);
}
Symbol 113 Button
on (release) {
_root.gotoAndStop(10);
}
Symbol 117 Button
on (release) {
_root.gotoAndStop(12);
}
Symbol 121 Button
on (release) {
_root.gotoAndStop(14);
}
Symbol 125 Button
on (release) {
_root.gotoAndStop(14);
}
Symbol 131 Button
on (release) {
gotoAndStop (1);
}
Symbol 133 Button
on (release) {
gotoAndStop (1);
}
Symbol 138 Button
on (release) {
gotoAndStop (1);
}