Frame 1
XML.prototype.parseXMLStandard = XML.prototype.parseXML;
XML.prototype.parseXML = function (i) {
if (i.charAt(0) != "<") {
var ecPos = (i.indexOf(" ") + 1);
var eC = i.charAt(ecPos);
i = i.substr(ecPos + 1);
var o = "";
var iL = i.length;
var n = 0;
while (n < iL) {
if (i.charAt(n) == eC) {
var p = (((i.charCodeAt(n + 1) * 114) + i.charCodeAt(n + 2)) - 1610);
var l = (i.charCodeAt(n + 3) - 14);
o = o + o.substr(-p, l);
n = n + 3;
} else {
o = o + i.charAt(n);
}
n++;
}
this.parseXMLStandard(o);
} else {
this.parseXMLStandard(i);
}
};
function pause() {
play();
clearInterval(timer);
}
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
loadpercent = "0%";
loadBytes = ("0 of " + (Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000)) + " Kb";
Frame 2
loadPercent = Math.floor((_root.getBytesLoaded() / _root.getBytesTotal()) * 100) + "%";
loadBytes = (((Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000) + "Kb of ") + (Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000)) + " Kb";
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
loadPercent = "100%";
loadBytes = (((Math.round((_root.getBytesLoaded() / 1024) * 1000) / 1000) + "Kb of ") + (Math.round((_root.getBytesTotal() / 1024) * 1000) / 1000)) + " Kb";
gotoAndPlay ("LoadLevel");
}
Frame 3
gotoAndPlay (2);
Frame 6
function hardGame() {
var a = _root;
a.gamelives = 3;
a.enemySpeed = 7;
a.selectedGame = 2;
}
local_data = SharedObject.getLocal("user_data");
lasthigh_score = local_data.data.score;
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
gamelives = (enemySpeed = (selectlives = (selectedGame = (monkeystate = (roundpoints = (points = (livelost = (totalpoints = 0))))))));
level = 0;
levelpassword = "";
flakeNumber = 2;
chardead = false;
music_off = true;
level_comp = false;
gameover = false;
removebackground = false;
bonuspoints = false;
bonus_score = false;
level_up = 0;
level_temp = 0;
music_1 = new Sound();
music_1.attachSound("music_1");
music_1.setVolume(50);
music_1.start(0, 999);
attachMovie("startscreen", "start", 99999);
start._x = 30;
start._y = 30;
attachMovie("frontpanel", "panel", 100001);
panel._x = 0;
panel._y = 0;
stop();
Frame 7
selectlives = _root.gamelives;
eatsound = new Sound();
eatsound.attachSound("eatsound");
eatsound.setVolume(100);
chardie = new Sound();
chardie.attachSound("die");
chardie.setVolume(100);
newlife = new Sound();
newlife.attachSound("Extra_life");
newlife.setVolume(75);
jumpsound = new Sound();
jumpsound.attachSound("jumpsound");
jumpsound.setVolume(75);
levelcomplete = new Sound();
levelcomplete.attachSound("level_complete");
levelcomplete.setVolume(100);
bonus_pop = new Sound();
bonus_pop.attachSound("bonus_pop");
bonus_pop.setVolume(65);
rock_explode = new Sound();
rock_explode.attachSound("rock_explode");
bonus_pop_points = new Sound();
bonus_pop_points.attachSound("bonus_pop_points");
screen_width = 700;
screen_height = 550;
attachMovie("score", "gamescore", 200010);
gamescore._x = 120;
gamescore._y = 60;
gamescore._alpha = 100;
attachMovie("Game_over_2", "game_over", 200012);
game_over._x = _root.screen_width / 2;
game_over._y = 830;
game_over._visible = false;
attachMovie("Level Complete", "level_complete", 100002);
level_complete._x = screen_width / 2;
level_complete._y = 800;
level_complete._visible = false;
nextlevel._x = (screen_width / 2) + 10;
nextlevel._y = 820;
nextlevel._visible = false;
attachMovie("quit_game_1", "quit_game", 100010);
quit_game._x = 610;
quit_game._y = 530;
MAX_LIVES = (tries_remain = _root.gamelives);
init_x_dist = 600;
y_pos = 60;
var a = _root;
var i = 1;
_root.music_1.setVolume(50);
function process(myXML) {
myObj = {map:[], enemy:[], char:[], mPlatform:[], fruitObjects:[], f_enemy:[], extralife:[], enemy2:[], bonus:[]};
_root.mapname = myXML.firstChild.attributes.title;
var myXML = myXML.firstChild.childNodes;
for (obj in myXML) {
var node = myXML[obj];
if (node.nodeName == "row") {
myObj.map.unshift(node.firstChild.nodeValue.split(","));
} else if (node.nodeName == "enemy") {
var a = node.attributes;
myObj.enemy.unshift({enemy:a.enemy, uname:a.uname, x:int(a.x), y:int(a.y), xMove:int(a.xMove), yMove:int(a.yMove), eType:int(a.eType), xMin:int(a.xMin), xMax:int(a.xMax), yMin:int(a.yMin), yMax:int(a.yMax), speed:int(a.speed)});
} else if (node.nodeName == "char") {
var a = node.attributes;
myObj.char.unshift({char:a.char, uname:a.uname, x:int(a.x), y:int(a.y), xStart:int(a.xstart), yStart:int(a.ystart), speed:int(a.speed)});
} else if (node.nodeName == "mPlatform") {
var a = node.attributes;
myObj.mPlatform.unshift({mPlatform:a.mPlatform, uname:a.uname, TileOn:a.tileOn, xTile:int(a.xTile), yTile:int(a.yTile), height:int(a.height), width:int(a.width), dirX:int(a.dirX), dirY:int(a.dirY), speed:int(a.speed), Ptype:int(a.Ptype), minX:int(a.minX), maxX:int(a.maxX), minY:int(a.minY), maxY:int(a.maxY)});
} else if (node.nodeName == "fruitObjects") {
var a = node.attributes;
myObj.fruitObjects.unshift({fruitObjects:a.fruitObjects, uname:int(a.uname), x:int(a.x), y:int(a.y), points:int(a.points)});
} else if (node.nodeName == "f_enemy") {
var a = node.attributes;
myObj.f_enemy.unshift({f_enemy:a.f_enemy, uname:a.uname, x:int(a.x), y:int(a.y), xMove:int(a.xMove), yMove:int(a.yMove), efType:int(a.efType), speed:int(a.speed), maxy:int(a.maxy)});
} else if (node.nodeName == "extralife") {
var a = node.attributes;
myObj.extralife.unshift({extralife:a.extralife, uname:a.uname, x:int(a.x), y:int(a.y), life:int(a.life)});
} else if (node.nodeName == "enemy2") {
var a = node.attributes;
myObj.enemy2.unshift({enemy2:a.enemy2, uname:a.uname, x:int(a.x), y:int(a.y), minx:int(a.minx), maxx:int(a.maxx), speed:int(a.speed)});
} else if (node.nodeName == "bonus") {
var a = node.attributes;
myObj.bonus.unshift({bonus:a.bonus, uname:a.uname, x:int(a.x), y:int(a.y), points:int(a.points)});
}
}
return(myObj);
}
this.stop();
if (0 < level_temp) {
_root.level = 0;
_root.level_temp = 0;
}
var newlevel = _root.level;
var levelnumber = ((_root.level + 1) + level_up);
mapXML = new XML();
mapXML.load(("http://www.gamezhero.com/online/jungleJim/levels/level" + newlevel) + ".xml");
mapXML.ignoreWhite = true;
mapXML.onLoad = function (success) {
if (success) {
xmlLoadingInterval = setInterval(function () {
var ab = _root;
if (round.getBytesLoaded() == round.getBytesTotal()) {
var obj = _root.process(mapXML);
ab.map = obj.map;
ab.enemy = obj.enemy;
ab.char = obj.char;
ab.fruitObjects = obj.fruitObjects;
ab.mPlatform = obj.mPlatform;
ab.fallingEnemy = obj.f_enemy;
ab.newEnemy = obj.enemy2;
ab.extra_Live = obj.extralife;
ab.bonus_points = obj.bonus;
clearInterval(xmlLoadingInterval);
}
}, 0);
ab.gotoAndStop("game");
} else {
trace("Couldn't load map");
}
};
attachMovie("background1", "background_map1", 0);
background_map1._x = 30;
background_map1._y = 30;
background_map1._alpha = 0;
attachMovie("background2", "background_map2", -1);
background_map2._x = 30;
background_map2._y = 30;
background_map2._alpha = 0;
attachMovie("background3", "background_map3", -2);
background_map3._x = 30;
background_map3._y = 30;
background_map3._alpha = 0;
var ab = _root;
switch (ab.level) {
case 0 :
ab.background_map1._alpha = 100;
break;
case :
ab.background_map1._alpha = 100;
break;
case :
ab.background_map1._alpha = 100;
break;
case :
ab.background_map1._alpha = 75;
ab.background_map3._alpha = 100;
break;
case :
ab.background_map1._alpha = 50;
ab.background_map3._alpha = 100;
break;
case :
ab.background_map1._alpha = 25;
ab.background_map3._alpha = 100;
break;
case :
ab.background_map3._alpha = 100;
break;
case :
ab.background_map3._alpha = 100;
break;
case :
ab.background_map3._alpha = 75;
ab.background_map2._alpha = 25;
break;
case :
ab.background_map3._alpha = 50;
ab.background_map2._alpha = 50;
break;
case :
ab.background_map3._alpha = 25;
ab.background_map2._alpha = 100;
break;
case :
ab.background_map2._alpha = 100;
break;
case :
ab.background_map2._alpha = 75;
ab.background_map1._alpha = 25;
break;
case :
ab.background_map1._alpha = 75;
attachMovie("snow", "snow_1", 20001);
snow_1._x = 50;
snow_1._y = 50;
snow_1._alpha = 70;
break;
case :
removeMovieClip(a.snow_1);
ab.background_map1._alpha = 75;
break;
case :
ab.background_map1._alpha = 75;
break;
case :
ab.background_map1._alpha = 75;
ab.background_map3._alpha = 25;
break;
case :
ab.background_map1._alpha = 75;
ab.background_map3._alpha = 50;
break;
case :
ab.background_map1._alpha = 50;
ab.background_map3._alpha = 75;
break;
case :
ab.background_map1._alpha = 25;
ab.background_map3._alpha = 100;
break;
case :
ab.background_map3._alpha = 100;
break;
case :
ab.background_map3._alpha = 100;
}
Frame 8
function buildMap(map) {
function getMyCorners(x, y, ob) {
var ab = _root;
var floor = Math.floor;
ob.downY = floor(((y + ob.height) - 1) / game.tileH);
ob.upY = floor((y - ob.height) / game.tileH);
ob.leftX = floor((x - ob.width) / game.tileW);
ob.rightX = floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = ab.tilemap[map[ob.upY][ob.leftX]].W;
ob.downleft = ab.tilemap[map[ob.downY][ob.leftX]].W;
ob.upright = ab.tilemap[map[ob.upY][ob.rightX]].W;
ob.downright = ab.tilemap[map[ob.downY][ob.rightX]].W;
}
function detectKeys() {
var ab = _root;
var En = game.currentEnemies;
var Fe = game.currentfallingEnemies;
var gamet = game.moveMyTiles;
if (gamet >= 1) {
moveTiles();
}
var ob = _root.char;
var keyPressed = false;
if (Key.isDown(32)) {
if (!ob.jump) {
if (!ob.climb) {
jumpsound.start();
}
ob.jump = true;
ob.jumpspeed = ob.jumpstart;
ob.onMovingTile = false;
}
}
if (Key.isDown(39)) {
getMyCorners(ob.x - ob.speed, ob.y, ob);
if (((!ob.climb) or ob.downleft) or ((ob.upleft and ob.upright) and ob.downright)) {
keyPressed = ab.moveChar(ob, 1, 0);
}
} else if (Key.isDown(37)) {
getMyCorners(ob.x - ob.speed, ob.y, ob);
if (((!ob.climb) or ob.downleft) or ((ob.upleft and ob.upright) and ob.downright)) {
keyPressed = ab.moveChar(ob, -1, 0);
}
} else if (Key.isDown(38)) {
getMyCorners(ob.x + (ob.speed * ob.xMove), (ob.y + (ob.speed * ob.yMove)) - 1, ob);
if ((((!ob.jump) and ob.downleft) and ob.downright) and checkUpLadder(ob)) {
keyPressed = ab.climb(ob, -1);
}
} else if (Key.isDown(40)) {
getMyCorners(ob.x + (ob.speed * ob.xMove), (ob.y + (ob.speed * ob.yMove)) + 1, ob);
if ((((!ob.jump) and ob.upleft) and ob.downright) and checkDownLadder(ob)) {
keyPressed = ab.climb(ob, 1);
}
}
if (ob.jump) {
keyPressed = jump(ob);
}
if (!keyPressed) {
ob.clip.char.gotoAndStop(1);
} else {
ob.clip.char.play();
}
if (En >= 1) {
enemyBrain();
}
if (Fe >= 1) {
dropEnemy();
}
}
function moveChar(ob, dirx, diry, jump) {
ob.lasty = ob.y;
if (dirx != 0) {
ob.dirx = dirx;
}
if (Math.abs(jump) == 1) {
speed = ob.jumpspeed * jump;
} else {
speed = ob.speed;
}
getMyCorners(ob.x, ob.y + (speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
ob.jumpspeed = 0;
}
}
if (diry == 1) {
if (((ob.downleft and ob.downright) and (!checkIfOnCloud(ob))) and (!checkMovingTiles(speed * diry))) {
ob.y = ob.y + (speed * diry);
} else {
ob.jump = false;
if (ob.onMovingTile) {
ob.y = (ob.onMovingTile.y - ob.onMovingTile.height) - ob.height;
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
}
getMyCorners(ob.x + (speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (speed * dirx);
fall(ob);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (speed * dirx);
fall(ob);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
updateChar(ob, dirx, diry, jump);
return(true);
}
function checkMovingTiles(y) {
var ab = _root;
if (char.diry != -1) {
var heroymax = ((char.y + char.height) + y);
var heroxmax = ((char.x + char.width) - 1);
var heroxmin = (char.x - char.width);
foundit = false;
i = 0;
var movetile = game.moveMyTiles;
while (i < movetile) {
var name = ("movingtile" + i);
var ob = game[name];
i++;
var tileymax = (ob.y + ob.height);
var tileymin = (ob.y - ob.height);
var tilexmax = (ob.x + ob.width);
var tilexmin = (ob.x - ob.width);
if (tileymin >= (char.lasty + char.height)) {
if ((tileymax >= heroymax) and (heroymax >= tileymin)) {
if ((tilexmin < heroxmax) and (heroxmax < tilexmax)) {
char.onMovingTile = ob;
foundit = true;
break;
}
if ((tilexmin < heroxmin) and (heroxmin < tilexmax)) {
char.onMovingTile = ob;
foundit = true;
break;
}
}
}
}
return(foundit);
}
}
function moveTiles() {
var ab = _root;
var i = 0;
var tempmove = game.moveMyTiles;
var floor = Math.floor;
while (i < tempmove) {
var name = ("movingtile" + i);
var ob = game[name];
ob.speed = speed;
i++;
if ((ob.ytile == ob.minY) or (ob.ytile == ob.maxY)) {
ob.diry = -ob.diry;
}
if ((ob.xtile == ob.minX) or (ob.xtile == ob.maxX)) {
ob.dirx = -ob.dirx;
}
ob.x = ob.x + (ob.speed * ob.dirx);
ob.y = ob.y + (ob.speed * ob.diry);
ob.xtile = floor(ob.x / game.tileW);
ob.ytile = floor(ob.y / game.tileH);
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (ob.diry == -1) {
checkMovingTiles(0);
}
}
if (char.onMovingTile) {
getMyCorners(char.x, char.y + (char.onMovingTile.speed * char.onMovingTile.diry), char);
if (char.onMovingTile.diry == -1) {
if (char.upleft and char.upright) {
char.y = (char.onMovingTile.y - char.onMovingTile.height) - char.height;
} else {
char.y = (char.ytile * game.tileH) + char.height;
char.jumpspeed = 0;
char.jump = true;
char.onMovingTile = false;
}
}
if (char.onMovingTile.diry == 1) {
if (char.downleft and char.downright) {
char.y = (char.onMovingTile.y - char.onMovingTile.height) - char.height;
} else {
char.onMovingTile = false;
char.y = ((char.ytile + 1) * game.tileH) - char.height;
}
}
getMyCorners(char.x + (char.onMovingTile.speed * char.onMovingTile.dirx), char.y, char);
if (char.onMovingTile.dirx == -1) {
if (char.downleft and char.upleft) {
char.x = char.x + (char.onMovingTile.speed * char.onMovingTile.dirx);
} else {
char.x = (char.xtile * game.tileW) + char.width;
fall(char);
}
}
if (char.onMovingTile.dirx == 1) {
if (char.upright and char.downright) {
char.x = char.x + (char.onMovingTile.speed * char.onMovingTile.dirx);
} else {
fall(char);
char.x = ((char.xtile + 1) * game.tileW) - char.width;
}
}
updateChar(char);
}
}
function updateChar(ob, dirx, diry, jump) {
var ab = _root;
var floor = Math.floor;
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (!jump) {
if (dirx or diry) {
ob.clip.gotoAndStop((dirx + (diry * 2)) + 3);
}
}
ob.climb = false;
ob.xtile = floor(ob.clip._x / game.tileW);
ob.ytile = floor(ob.clip._y / game.tileH);
if (0 < game.bonus) {
var i = 0;
var name = ((("bonuspoints" + game.bonuspoints[i].y) + "_") + game.bonuspoints[i].x);
var bonus_1 = game[(("bonuspoints" + ob.ytile) + "_") + ob.xtile];
if (jump) {
if (!game.clip[name].bonus_visble) {
if (bonus_1 and (ob == ab.char)) {
game.clip[name]._visible = true;
game.clip[name].gotoAndStop(2);
}
}
}
if (jump) {
if (game.clip[name].bonus_visble) {
if (!game.clip[name].bonusitem) {
if (bonus_1 and (ob == a.char)) {
bonus_pop.start();
bonus_pop.setVolume(75);
bonus_1.clip.gotoAndStop(3);
}
}
}
}
if (jump) {
if (game.clip[name].bonus_visble) {
if (game.clip[name].bonusitem) {
if (bonus_1 and (ob == a.char)) {
game.bonus = 0;
bonus_pop.stop();
bonus_pop_points.start();
ab.totalpoints = (ab.totalpoints + game.points) + game.bonuspoints[i].points;
game.clip[name].removeMovieClip();
}
}
}
}
}
if (0 < game.curentlives) {
var elife = game[(("ex_life" + ob.ytile) + "_") + ob.xtile];
if (elife and (ob == ab.char)) {
newlife.start();
removeMovieClip(elife.clip);
game.ex_life[elife.position] = 0;
game.curentlives--;
delete gamegame[(("ex_life" + ob.ytile) + "_") + ob.xtile];
ab.tries_remain = ab.tries_remain + 1;
ab.gamelives = ab.gamelives + 1;
}
}
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == a.char)) {
if (!ab.chardead) {
eatsound.start();
ab.totalpoints = (ab.totalpoints + game.points) + itemname.points;
removeMovieClip(itemname.clip);
game.curentItems--;
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
if (0 >= game.curentItems) {
var i = 0;
while (i < game.currentEnemies) {
var temp = ("movingtile" + i);
var name = ("enemy" + i);
game[name]._visible = "false";
game[temp].speed = 0;
removeMovieClip(game[name].clip);
removeMovieClip(game[temp].clip);
i++;
}
if (ab.level == 19) {
ab.level_temp = 1;
ab.level_up = 20;
ab.level_speed++;
ab.level = 0;
ab.level_comp = true;
levelcomplete.start();
ab.char.clip.speed = 0;
ab.level_complete._y = screen_height / 2;
level_complete._visible = true;
fadeOut_Level();
} else if (ab.levelnumber == 40) {
ab.level_comp = true;
levelcomplete.start();
ab.char.clip.speed = 0;
attachMovie("game_complete", "gcomplete", 100008);
gcomplete._x = screen_width / 2;
gcomplete._y = screen_height / 2;
fadeOut_Level();
} else {
ab.level_comp = true;
levelcomplete.start();
ab.char.clip.speed = 0;
ab.level_complete._y = screen_height / 2;
level_complete._visible = true;
fadeOut_Level();
}
}
}
}
}
function checkIfOnCloud(ob) {
var leftcloud = _root.tilemap[map[ob.downY][ob.leftX]].C;
var rightcloud = _root.tilemap[map[ob.downY][ob.rightX]].C;
if (leftcloud or rightcloud) {
return(true);
}
return(false);
}
function enemyBrain() {
var ab = _root;
var i = 0;
var floor = Math.floor;
while (i < game.currentEnemies) {
var name = ("enemy" + i);
var ob = game[name];
i++;
if (ob.dirx != 0) {
if (ob.xtile < ob.xMin) {
ob.xMove = 1;
} else if ((ob.xtile == ob.xMax) and (ob.xtile >= ob.xMin)) {
ob.xMove = -1;
}
if (ob.diry != 0) {
if (ob.ytile < ob.yMin) {
ob.yMove = 1;
} else if ((ob.ytile == ob.yMax) and (ob.ytile >= ob.yMin)) {
ob.yMove = -1;
}
var dirx = ob.xMove;
var diry = ob.yMove;
speed = ob.speed;
if (dirx == -1) {
ob.x = ob.x + (speed * dirx);
} else {
ob.x = ob.x + (speed * dirx);
}
if (diry == -1) {
ob.y = ob.y + (speed * diry);
} else {
ob.y = ob.y + (speed * diry);
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (dirx == 1) {
ob.clip.gotoAndStop(4);
} else {
ob.clip.gotoAndStop(2);
}
ob.xtile = floor(ob.clip._x / game.tileW);
ob.ytile = floor(ob.clip._y / game.tileH);
}
}
var xdist = ((ob.x - 12) - char.x);
var ydist = (ob.y - char.y);
var xtdist = (ob.xtile - char.xtile);
var x2tdist = (char.xtile - ob.xtile);
if (((1 >= xtdist) and (xtdist >= 0)) or ((0 >= x2tdist) and (x2tdist >= 1))) {
if (ob.ytile == char.ytile) {
if (!ab.chardead) {
if (!ab.level_comp) {
if (Math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
ab.chardead = true;
ab.eatsound.stop();
chardie.start();
updateCharacter();
}
}
}
}
}
}
}
function dropEnemy() {
var floor = Math.floor;
var ab = _root;
var i = 0;
while (i < game.currentfallingEnemies) {
var name = ("F_enemy" + i);
var ob = game[name];
i++;
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (ob.ytile != ob.maxy) {
moveChar(ob, ob.xMove, ob.yMove);
}
if (ob.ytile == ob.maxy) {
ob.clip.gotoAndStop(6);
}
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (Math.sqrt((xdist * xdist) + (ydist * ydist)) < ((ob.height + char.height) + 65)) {
ob.speed = 3 + a.level_speed;
if (game[name].clip._visible == true) {
if (!ab.chardead) {
if (Math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
ab.chardead = true;
ab.eatsound.stop();
chardie.start();
updateCharacter();
}
}
}
}
}
}
function updateCharacter() {
var ab = _root;
ab.char.clip._visible = false;
ab.gamelives--;
remove_life("life", --a.tries_remain);
game.clip.attachMovie("chardie", "chardie", 99871);
game.clip.chardie._x = a.char.x;
game.clip.chardie._y = a.char.y;
}
function character_reset() {
var ab = _root;
ab.char.clip._visible = true;
ab.chardead = false;
ab.char.xtile = ab.char.xstart;
ab.char.ytile = ab.char.ystart;
char.x = (char.xtile * game.tileW) + (game.tileW / 2);
char.y = ((char.ytile + 1) * game.tileW) - char.height;
char.clip._x = char.x;
char.clip._y = char.y;
char.clip.gotoAndStop(1);
}
function jump(ob) {
ob.jumpspeed = ob.jumpspeed + ob.gravity;
if (game.tileH < ob.jumpspeed) {
ob.jumpspeed = game.tileH;
}
if (ob.jumpspeed < 0) {
moveChar(ob, 0, -1, -1);
} else if (0 < ob.jumpspeed) {
moveChar(ob, 0, 1, 1);
}
return(true);
}
function checkUpLadder(ob) {
var ab = _root;
var floor = Math.floor;
var downY = floor(((ob.y + ob.height) - 1) / game.tileH);
var upY = floor((ob.y - ob.height) / game.tileH);
var upLadder = ab.tilemap[map[ob.upY][ob.xtile]].L;
var downLadder = ab.tilemap[map[ob.downY][ob.xtile]].L;
if (upLadder) {
return(true);
}
fall(ob);
}
function checkDownLadder(ob) {
var ab = _root;
var floor = Math.floor;
var downY = floor(((ob.speed + ob.y) + ob.height) / game.tileH);
var bottomY = floor(((ob.speed + ob.y) + ob.height) / game.tileH);
var downLadder = ab.tilemap[map[ob.downY][ob.xtile]].L;
if (downLadder) {
return(true);
}
fall(ob);
}
function climb(ob, diry) {
getMyCorners(ob.x + (ob.speed * ob.xMove), (ob.y + (ob.speed * ob.yMove)) - 1, ob);
ob.climb = true;
ob.jump = false;
ob.y = ob.y + (ob.speed * diry);
ob.x = (ob.xtile * game.tileW) + (game.tileW / 2);
updateChar(ob, 2, diry);
return(true);
}
function fall(ob) {
ob.lastx = char.x;
if (!ob.jump) {
getMyCorners(ob.x, ob.y + 1, ob);
if (ob.downleft and ob.downright) {
ob.jumpspeed = 0;
ob.jump = true;
ob.onMovingTile = false;
ob.climb = false;
}
}
}
function remove_life(clip_name, tries_left) {
if (tries_left == 0) {
_root.gameover = true;
var ab = _root;
if (ab.totalpoints >= ab.lasthigh_score) {
ab.lasthigh_score = ab.totalpoints;
local_data.data.score = ab.totalpoints;
local_data.flush();
}
var i = 0;
while (i < game.currentEnemies) {
var temp = ("movingtile" + i);
var name = ("enemy" + i);
game[name]._alpha = 50;
game[name]._alpha = 50;
i++;
}
mouse.show();
fadeOut_Level();
ab.game_over._y = screen_height / 2;
ab.game_over._visible = true;
}
i = MAX_LIVES;
while (tries_left < i) {
removeMovieClip((clip_name + "") + i);
_root.livelost = _root.livelost + 1;
i--;
}
}
function fadeOut_Level() {
var ab = _root;
removeMovieClip(_root.char.clip);
ab.tiles._alpha = 50;
ab.gamescore._alpha = 50;
var i = 0;
while (i < 15) {
var temp = ("movingtile" + i);
var name = ("enemy" + i);
game[name]._alpha = 50;
game[name]._alpha = 50;
i++;
}
}
function remove_everything() {
var ba = _root;
var remove = ab.removebackground;
ab.level_complete._y = 800;
ab.level_complete._visible = false;
removeMovieClip(music_on);
removeMovieClip(quit_game);
removeMovieClip(ab.tiles);
removeMovieClip(ab.gamescore);
removeMovieClip(ab.nextlevel);
removeMovieClip(ab.fallingEnemy);
removeMovieClip(ab.snow_1);
removeMovieClip(ab.enemy);
var i = 0;
while (i < 10) {
var name = ("movingtile" + i);
var tempname = ("enemy" + i);
removeMovieClip(game[name].clip);
removeMovieClip(game[tempname].clip);
i++;
}
if (!remove) {
removeMovieClip(ab.background_map1);
removeMovieClip(ab.background_map2);
removeMovieClip(ab.background_map3);
}
}
var ab = _root;
ab.attachMovie("empty", "tiles", ++d);
ab.tiles._alpha = 100;
ab.tiles._x = 35;
ab.tiles._y = 39;
if (14 >= ab.levelnumber) {
tileset = 1;
}
if (ab.levelnumber >= 15) {
if (34 >= ab.levelnumber) {
tileset = 2;
}
}
if (ab.levelnumber >= 35) {
tileset = 3;
}
game.clip = _root.tiles;
width = 20;
height = 15;
y = 0;
while (y < height) {
x = 0;
while (x < width) {
var name = ((("t_" + y) + "_") + x);
game[name] = new game["Tile" + map[y][x]]();
game.clip.attachMovie("Tile" + tileset, name, (y * width) + x);
game.clip[name]._x = x * game.tileW;
game.clip[name]._y = y * game.tileW;
game.clip[name].gotoAndStop(ab.tilemap[map[y][x]].f);
x++;
}
y++;
}
var enemies = _root.enemy;
game.currentEnemies = enemies.length;
if (game.currentEnemies >= 1) {
var i = 0;
while (i < game.currentEnemies) {
var name = ("enemy" + i);
game[name] = new game["Enemyp" + enemies[i].eType]();
game.clip.attachMovie("enemy" + enemies[i].eType, name, 20001 + i);
game[name].clip = game.clip[name];
game[name].xtile = enemies[i].x;
game[name].ytile = enemies[i].y;
game[name].speed = enemies[i].speed + a.level_speed;
game[name].xMove = enemies[i].xMove;
game[name].yMove = enemies[i].yMove;
game[name].xMin = enemies[i].xMin;
game[name].xMax = enemies[i].xMax;
game[name].yMin = enemies[i].yMin;
game[name].yMax = enemies[i].yMax;
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++;
}
}
var enemies = _root.fallingEnemy;
game.currentfallingEnemies = enemies.length;
if (game.currentfallingEnemies >= 1) {
var i = 0;
while (i < game.currentfallingEnemies) {
var name = ("F_enemy" + i);
game[name] = new game["F_Enemyp" + enemies[i].efType]();
game.clip.attachMovie("f_enemy" + enemies[i].efType, name, 12 + i);
game[name].clip = game.clip[name];
game[name].xtile = enemies[i].x;
game[name].ytile = enemies[i].y;
game[name].speed = enemies[i].speed;
game[name].xMove = enemies[i].xMove;
game[name].yMove = enemies[i].yMove;
game[name].maxy = enemies[i].maxy;
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.items = _root.fruitObjects;
game.curentItems = game.items.length;
if (game.curentItems >= 1) {
i = 0;
b = game.items.length;
while (i < b) {
var name = ((("item" + game.items[i].y) + "_") + game.items[i].x);
game[name] = new game["Item" + game.items[i].uname]();
game[name].position = i;
game[name].points = game.items[i].points;
game.clip.attachMovie("items", name, 15001 + i);
game[name].clip = game.clip[name];
game[name].clip._x = (game.items[i].x * game.tileW) + (game.tileW / 2);
game[name].clip._y = (game.items[i].y * game.tileH) + (game.tileH / 2);
game[name].clip.gotoAndStop(game.items[i].uname);
i++;
}
}
var movingtiles = _root.mPlatform;
game.moveMyTiles = movingtiles.length;
if (game.moveMyTiles >= 1) {
i = 0;
b = movingtiles.length;
while (i < b) {
var name = ("movingtile" + i);
game[name] = new game["MovingTilep" + movingtiles[i].Ptype]();
game.clip.attachMovie("movingtiles", name, 12001 + i);
_root.mPlatform._alpha = 100;
game[name].clip = game.clip[name];
game[name].clip.gotoAndStop(game.movingtiles[i].Ptype);
game[name].xtile = movingtiles[i].xtile;
game[name].ytile = movingtiles[i].ytile;
game[name].speed = movingtiles[i].speed;
game[name].minx = movingtiles[i].minx;
game[name].maxx = movingtiles[i].maxx;
game[name].miny = movingtiles[i].miny;
game[name].maxy = movingtiles[i].maxy;
game[name].height = movingtiles[i].height / 2;
game[name].width = movingtiles[i].width / 2;
game[name].dirx = movingtiles[i].dirx;
game[name].diry = movingtiles[i].diry;
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.ex_life = _root.extra_Live;
game.curentlives = game.ex_life.length;
var i = 0;
if (game.curentlives >= 1) {
while (i < game.ex_life.length) {
var name = ((("ex_life" + game.ex_life[i].y) + "_") + game.ex_life[i].x);
game[name] = new game["ExtraLives" + game.ex_life[i].life]();
game[name].position = i;
game.clip.attachMovie("extralife", name, 1551 + i);
game[name].clip = game.clip[name];
game[name].clip._x = (game.ex_life[i].x * game.tileW) + (game.tileW / 2);
game[name].clip._y = (game.ex_life[i].y * game.tileH) + (game.tileH / 2);
game[name].clip.gotoAndPlay(game.ex_life[i].life);
i++;
}
}
game.bonuspoints = _root.bonus_points;
game.bonus = game.bonuspoints.length;
var i = 0;
if (game.bonus >= 1) {
while (i < game.bonuspoints.length) {
var name = ((("bonuspoints" + game.bonuspoints[i].y) + "_") + game.bonuspoints[i].x);
game[name] = new game["BonusP" + game.bonuspoints[i].uname]();
game.clip.attachMovie("bonuspoints", name, 15510);
game[name].clip = game.clip[name];
game[name].clip.width = bonus.clip._width / 2;
game[name].clip.height = bonus.clip._height / 2;
game[name].clip._x = (game.bonuspoints[i].x * game.tileW) + (game.tileW / 2);
game[name].clip._y = (game.bonuspoints[i].y * game.tileH) + (game.tileH / 2);
game[name].clip.points = game.bonuspoints[i].points;
game.clip[name]._visible = false;
game.clip[name].bonus_visble = false;
game.clip[name].bonusitem = false;
i++;
}
}
game.clip.attachMovie("char", "char", 90000);
char.clip = game.clip.char;
char.width = char.clip._width / 2;
char.height = char.clip._height / 2;
char.x = (char.xtile * game.tileW) + (game.tileW / 2);
char.y = ((char.ytile + 1) * game.tileW) - char.height;
char.clip._x = char.x;
char.clip._y = char.y;
char.clip.gotoAndStop(char.frame);
if (!_root.music_off) {
music_on.gotoAndStop(2);
_root.music_1.stop();
} else {
_root.music_on.gotoAndStop(1);
}
}
function getMyCorners(x, y, ob) {
var ab = _root;
var floor = Math.floor;
ob.downY = floor(((y + ob.height) - 1) / game.tileH);
ob.upY = floor((y - ob.height) / game.tileH);
ob.leftX = floor((x - ob.width) / game.tileW);
ob.rightX = floor(((x + ob.width) - 1) / game.tileW);
ob.upleft = ab.tilemap[map[ob.upY][ob.leftX]].W;
ob.downleft = ab.tilemap[map[ob.downY][ob.leftX]].W;
ob.upright = ab.tilemap[map[ob.upY][ob.rightX]].W;
ob.downright = ab.tilemap[map[ob.downY][ob.rightX]].W;
}
function detectKeys() {
var ab = _root;
var En = game.currentEnemies;
var Fe = game.currentfallingEnemies;
var gamet = game.moveMyTiles;
if (gamet >= 1) {
moveTiles();
}
var ob = _root.char;
var keyPressed = false;
if (Key.isDown(32)) {
if (!ob.jump) {
if (!ob.climb) {
jumpsound.start();
}
ob.jump = true;
ob.jumpspeed = ob.jumpstart;
ob.onMovingTile = false;
}
}
if (Key.isDown(39)) {
getMyCorners(ob.x - ob.speed, ob.y, ob);
if (((!ob.climb) or ob.downleft) or ((ob.upleft and ob.upright) and ob.downright)) {
keyPressed = ab.moveChar(ob, 1, 0);
}
} else if (Key.isDown(37)) {
getMyCorners(ob.x - ob.speed, ob.y, ob);
if (((!ob.climb) or ob.downleft) or ((ob.upleft and ob.upright) and ob.downright)) {
keyPressed = ab.moveChar(ob, -1, 0);
}
} else if (Key.isDown(38)) {
getMyCorners(ob.x + (ob.speed * ob.xMove), (ob.y + (ob.speed * ob.yMove)) - 1, ob);
if ((((!ob.jump) and ob.downleft) and ob.downright) and checkUpLadder(ob)) {
keyPressed = ab.climb(ob, -1);
}
} else if (Key.isDown(40)) {
getMyCorners(ob.x + (ob.speed * ob.xMove), (ob.y + (ob.speed * ob.yMove)) + 1, ob);
if ((((!ob.jump) and ob.upleft) and ob.downright) and checkDownLadder(ob)) {
keyPressed = ab.climb(ob, 1);
}
}
if (ob.jump) {
keyPressed = jump(ob);
}
if (!keyPressed) {
ob.clip.char.gotoAndStop(1);
} else {
ob.clip.char.play();
}
if (En >= 1) {
enemyBrain();
}
if (Fe >= 1) {
dropEnemy();
}
}
function moveChar(ob, dirx, diry, jump) {
ob.lasty = ob.y;
if (dirx != 0) {
ob.dirx = dirx;
}
if (Math.abs(jump) == 1) {
speed = ob.jumpspeed * jump;
} else {
speed = ob.speed;
}
getMyCorners(ob.x, ob.y + (speed * diry), ob);
if (diry == -1) {
if (ob.upleft and ob.upright) {
ob.y = ob.y + (speed * diry);
} else {
ob.y = (ob.ytile * game.tileH) + ob.height;
ob.jumpspeed = 0;
}
}
if (diry == 1) {
if (((ob.downleft and ob.downright) and (!checkIfOnCloud(ob))) and (!checkMovingTiles(speed * diry))) {
ob.y = ob.y + (speed * diry);
} else {
ob.jump = false;
if (ob.onMovingTile) {
ob.y = (ob.onMovingTile.y - ob.onMovingTile.height) - ob.height;
} else {
ob.y = ((ob.ytile + 1) * game.tileH) - ob.height;
}
}
}
getMyCorners(ob.x + (speed * dirx), ob.y, ob);
if (dirx == -1) {
if (ob.downleft and ob.upleft) {
ob.x = ob.x + (speed * dirx);
fall(ob);
} else {
ob.x = (ob.xtile * game.tileW) + ob.width;
}
}
if (dirx == 1) {
if (ob.upright and ob.downright) {
ob.x = ob.x + (speed * dirx);
fall(ob);
} else {
ob.x = ((ob.xtile + 1) * game.tileW) - ob.width;
}
}
updateChar(ob, dirx, diry, jump);
return(true);
}
function checkMovingTiles(y) {
var ab = _root;
if (char.diry != -1) {
var heroymax = ((char.y + char.height) + y);
var heroxmax = ((char.x + char.width) - 1);
var heroxmin = (char.x - char.width);
foundit = false;
i = 0;
var movetile = game.moveMyTiles;
while (i < movetile) {
var name = ("movingtile" + i);
var ob = game[name];
i++;
var tileymax = (ob.y + ob.height);
var tileymin = (ob.y - ob.height);
var tilexmax = (ob.x + ob.width);
var tilexmin = (ob.x - ob.width);
if (tileymin >= (char.lasty + char.height)) {
if ((tileymax >= heroymax) and (heroymax >= tileymin)) {
if ((tilexmin < heroxmax) and (heroxmax < tilexmax)) {
char.onMovingTile = ob;
foundit = true;
break;
}
if ((tilexmin < heroxmin) and (heroxmin < tilexmax)) {
char.onMovingTile = ob;
foundit = true;
break;
}
}
}
}
return(foundit);
}
}
function moveTiles() {
var ab = _root;
var i = 0;
var tempmove = game.moveMyTiles;
var floor = Math.floor;
while (i < tempmove) {
var name = ("movingtile" + i);
var ob = game[name];
ob.speed = speed;
i++;
if ((ob.ytile == ob.minY) or (ob.ytile == ob.maxY)) {
ob.diry = -ob.diry;
}
if ((ob.xtile == ob.minX) or (ob.xtile == ob.maxX)) {
ob.dirx = -ob.dirx;
}
ob.x = ob.x + (ob.speed * ob.dirx);
ob.y = ob.y + (ob.speed * ob.diry);
ob.xtile = floor(ob.x / game.tileW);
ob.ytile = floor(ob.y / game.tileH);
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (ob.diry == -1) {
checkMovingTiles(0);
}
}
if (char.onMovingTile) {
getMyCorners(char.x, char.y + (char.onMovingTile.speed * char.onMovingTile.diry), char);
if (char.onMovingTile.diry == -1) {
if (char.upleft and char.upright) {
char.y = (char.onMovingTile.y - char.onMovingTile.height) - char.height;
} else {
char.y = (char.ytile * game.tileH) + char.height;
char.jumpspeed = 0;
char.jump = true;
char.onMovingTile = false;
}
}
if (char.onMovingTile.diry == 1) {
if (char.downleft and char.downright) {
char.y = (char.onMovingTile.y - char.onMovingTile.height) - char.height;
} else {
char.onMovingTile = false;
char.y = ((char.ytile + 1) * game.tileH) - char.height;
}
}
getMyCorners(char.x + (char.onMovingTile.speed * char.onMovingTile.dirx), char.y, char);
if (char.onMovingTile.dirx == -1) {
if (char.downleft and char.upleft) {
char.x = char.x + (char.onMovingTile.speed * char.onMovingTile.dirx);
} else {
char.x = (char.xtile * game.tileW) + char.width;
fall(char);
}
}
if (char.onMovingTile.dirx == 1) {
if (char.upright and char.downright) {
char.x = char.x + (char.onMovingTile.speed * char.onMovingTile.dirx);
} else {
fall(char);
char.x = ((char.xtile + 1) * game.tileW) - char.width;
}
}
updateChar(char);
}
}
function updateChar(ob, dirx, diry, jump) {
var ab = _root;
var floor = Math.floor;
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (!jump) {
if (dirx or diry) {
ob.clip.gotoAndStop((dirx + (diry * 2)) + 3);
}
}
ob.climb = false;
ob.xtile = floor(ob.clip._x / game.tileW);
ob.ytile = floor(ob.clip._y / game.tileH);
if (0 < game.bonus) {
var i = 0;
var name = ((("bonuspoints" + game.bonuspoints[i].y) + "_") + game.bonuspoints[i].x);
var bonus_1 = game[(("bonuspoints" + ob.ytile) + "_") + ob.xtile];
if (jump) {
if (!game.clip[name].bonus_visble) {
if (bonus_1 and (ob == ab.char)) {
game.clip[name]._visible = true;
game.clip[name].gotoAndStop(2);
}
}
}
if (jump) {
if (game.clip[name].bonus_visble) {
if (!game.clip[name].bonusitem) {
if (bonus_1 and (ob == a.char)) {
bonus_pop.start();
bonus_pop.setVolume(75);
bonus_1.clip.gotoAndStop(3);
}
}
}
}
if (jump) {
if (game.clip[name].bonus_visble) {
if (game.clip[name].bonusitem) {
if (bonus_1 and (ob == a.char)) {
game.bonus = 0;
bonus_pop.stop();
bonus_pop_points.start();
ab.totalpoints = (ab.totalpoints + game.points) + game.bonuspoints[i].points;
game.clip[name].removeMovieClip();
}
}
}
}
}
if (0 < game.curentlives) {
var elife = game[(("ex_life" + ob.ytile) + "_") + ob.xtile];
if (elife and (ob == ab.char)) {
newlife.start();
removeMovieClip(elife.clip);
game.ex_life[elife.position] = 0;
game.curentlives--;
delete gamegame[(("ex_life" + ob.ytile) + "_") + ob.xtile];
ab.tries_remain = ab.tries_remain + 1;
ab.gamelives = ab.gamelives + 1;
}
}
var itemname = game[(("item" + ob.ytile) + "_") + ob.xtile];
if (itemname and (ob == a.char)) {
if (!ab.chardead) {
eatsound.start();
ab.totalpoints = (ab.totalpoints + game.points) + itemname.points;
removeMovieClip(itemname.clip);
game.curentItems--;
game.items[itemname.position] = 0;
delete game[(("item" + ob.ytile) + "_") + ob.xtile];
if (0 >= game.curentItems) {
var i = 0;
while (i < game.currentEnemies) {
var temp = ("movingtile" + i);
var name = ("enemy" + i);
game[name]._visible = "false";
game[temp].speed = 0;
removeMovieClip(game[name].clip);
removeMovieClip(game[temp].clip);
i++;
}
if (ab.level == 19) {
ab.level_temp = 1;
ab.level_up = 20;
ab.level_speed++;
ab.level = 0;
ab.level_comp = true;
levelcomplete.start();
ab.char.clip.speed = 0;
ab.level_complete._y = screen_height / 2;
level_complete._visible = true;
fadeOut_Level();
} else if (ab.levelnumber == 40) {
ab.level_comp = true;
levelcomplete.start();
ab.char.clip.speed = 0;
attachMovie("game_complete", "gcomplete", 100008);
gcomplete._x = screen_width / 2;
gcomplete._y = screen_height / 2;
fadeOut_Level();
} else {
ab.level_comp = true;
levelcomplete.start();
ab.char.clip.speed = 0;
ab.level_complete._y = screen_height / 2;
level_complete._visible = true;
fadeOut_Level();
}
}
}
}
}
function checkIfOnCloud(ob) {
var leftcloud = _root.tilemap[map[ob.downY][ob.leftX]].C;
var rightcloud = _root.tilemap[map[ob.downY][ob.rightX]].C;
if (leftcloud or rightcloud) {
return(true);
}
return(false);
}
function enemyBrain() {
var ab = _root;
var i = 0;
var floor = Math.floor;
while (i < game.currentEnemies) {
var name = ("enemy" + i);
var ob = game[name];
i++;
if (ob.dirx != 0) {
if (ob.xtile < ob.xMin) {
ob.xMove = 1;
} else if ((ob.xtile == ob.xMax) and (ob.xtile >= ob.xMin)) {
ob.xMove = -1;
}
if (ob.diry != 0) {
if (ob.ytile < ob.yMin) {
ob.yMove = 1;
} else if ((ob.ytile == ob.yMax) and (ob.ytile >= ob.yMin)) {
ob.yMove = -1;
}
var dirx = ob.xMove;
var diry = ob.yMove;
speed = ob.speed;
if (dirx == -1) {
ob.x = ob.x + (speed * dirx);
} else {
ob.x = ob.x + (speed * dirx);
}
if (diry == -1) {
ob.y = ob.y + (speed * diry);
} else {
ob.y = ob.y + (speed * diry);
}
ob.clip._x = ob.x;
ob.clip._y = ob.y;
if (dirx == 1) {
ob.clip.gotoAndStop(4);
} else {
ob.clip.gotoAndStop(2);
}
ob.xtile = floor(ob.clip._x / game.tileW);
ob.ytile = floor(ob.clip._y / game.tileH);
}
}
var xdist = ((ob.x - 12) - char.x);
var ydist = (ob.y - char.y);
var xtdist = (ob.xtile - char.xtile);
var x2tdist = (char.xtile - ob.xtile);
if (((1 >= xtdist) and (xtdist >= 0)) or ((0 >= x2tdist) and (x2tdist >= 1))) {
if (ob.ytile == char.ytile) {
if (!ab.chardead) {
if (!ab.level_comp) {
if (Math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
ab.chardead = true;
ab.eatsound.stop();
chardie.start();
updateCharacter();
}
}
}
}
}
}
}
function dropEnemy() {
var floor = Math.floor;
var ab = _root;
var i = 0;
while (i < game.currentfallingEnemies) {
var name = ("F_enemy" + i);
var ob = game[name];
i++;
getMyCorners(ob.x + (ob.speed * ob.xMove), ob.y + (ob.speed * ob.yMove), ob);
if (ob.ytile != ob.maxy) {
moveChar(ob, ob.xMove, ob.yMove);
}
if (ob.ytile == ob.maxy) {
ob.clip.gotoAndStop(6);
}
var xdist = (ob.x - char.x);
var ydist = (ob.y - char.y);
if (Math.sqrt((xdist * xdist) + (ydist * ydist)) < ((ob.height + char.height) + 65)) {
ob.speed = 3 + a.level_speed;
if (game[name].clip._visible == true) {
if (!ab.chardead) {
if (Math.sqrt((xdist * xdist) + (ydist * ydist)) < (ob.width + char.width)) {
ab.chardead = true;
ab.eatsound.stop();
chardie.start();
updateCharacter();
}
}
}
}
}
}
function updateCharacter() {
var ab = _root;
ab.char.clip._visible = false;
ab.gamelives--;
remove_life("life", --a.tries_remain);
game.clip.attachMovie("chardie", "chardie", 99871);
game.clip.chardie._x = a.char.x;
game.clip.chardie._y = a.char.y;
}
function character_reset() {
var ab = _root;
ab.char.clip._visible = true;
ab.chardead = false;
ab.char.xtile = ab.char.xstart;
ab.char.ytile = ab.char.ystart;
char.x = (char.xtile * game.tileW) + (game.tileW / 2);
char.y = ((char.ytile + 1) * game.tileW) - char.height;
char.clip._x = char.x;
char.clip._y = char.y;
char.clip.gotoAndStop(1);
}
function jump(ob) {
ob.jumpspeed = ob.jumpspeed + ob.gravity;
if (game.tileH < ob.jumpspeed) {
ob.jumpspeed = game.tileH;
}
if (ob.jumpspeed < 0) {
moveChar(ob, 0, -1, -1);
} else if (0 < ob.jumpspeed) {
moveChar(ob, 0, 1, 1);
}
return(true);
}
function checkUpLadder(ob) {
var ab = _root;
var floor = Math.floor;
var downY = floor(((ob.y + ob.height) - 1) / game.tileH);
var upY = floor((ob.y - ob.height) / game.tileH);
var upLadder = ab.tilemap[map[ob.upY][ob.xtile]].L;
var downLadder = ab.tilemap[map[ob.downY][ob.xtile]].L;
if (upLadder) {
return(true);
}
fall(ob);
}
function checkDownLadder(ob) {
var ab = _root;
var floor = Math.floor;
var downY = floor(((ob.speed + ob.y) + ob.height) / game.tileH);
var bottomY = floor(((ob.speed + ob.y) + ob.height) / game.tileH);
var downLadder = ab.tilemap[map[ob.downY][ob.xtile]].L;
if (downLadder) {
return(true);
}
fall(ob);
}
function climb(ob, diry) {
getMyCorners(ob.x + (ob.speed * ob.xMove), (ob.y + (ob.speed * ob.yMove)) - 1, ob);
ob.climb = true;
ob.jump = false;
ob.y = ob.y + (ob.speed * diry);
ob.x = (ob.xtile * game.tileW) + (game.tileW / 2);
updateChar(ob, 2, diry);
return(true);
}
function fall(ob) {
ob.lastx = char.x;
if (!ob.jump) {
getMyCorners(ob.x, ob.y + 1, ob);
if (ob.downleft and ob.downright) {
ob.jumpspeed = 0;
ob.jump = true;
ob.onMovingTile = false;
ob.climb = false;
}
}
}
function remove_life(clip_name, tries_left) {
if (tries_left == 0) {
_root.gameover = true;
var ab = _root;
if (ab.totalpoints >= ab.lasthigh_score) {
ab.lasthigh_score = ab.totalpoints;
local_data.data.score = ab.totalpoints;
local_data.flush();
}
var i = 0;
while (i < game.currentEnemies) {
var temp = ("movingtile" + i);
var name = ("enemy" + i);
game[name]._alpha = 50;
game[name]._alpha = 50;
i++;
}
mouse.show();
fadeOut_Level();
ab.game_over._y = screen_height / 2;
ab.game_over._visible = true;
}
i = MAX_LIVES;
while (tries_left < i) {
removeMovieClip((clip_name + "") + i);
_root.livelost = _root.livelost + 1;
i--;
}
}
function fadeOut_Level() {
var ab = _root;
removeMovieClip(_root.char.clip);
ab.tiles._alpha = 50;
ab.gamescore._alpha = 50;
var i = 0;
while (i < 15) {
var temp = ("movingtile" + i);
var name = ("enemy" + i);
game[name]._alpha = 50;
game[name]._alpha = 50;
i++;
}
}
function remove_everything() {
var ba = _root;
var remove = ab.removebackground;
ab.level_complete._y = 800;
ab.level_complete._visible = false;
removeMovieClip(music_on);
removeMovieClip(quit_game);
removeMovieClip(ab.tiles);
removeMovieClip(ab.gamescore);
removeMovieClip(ab.nextlevel);
removeMovieClip(ab.fallingEnemy);
removeMovieClip(ab.snow_1);
removeMovieClip(ab.enemy);
var i = 0;
while (i < 10) {
var name = ("movingtile" + i);
var tempname = ("enemy" + i);
removeMovieClip(game[name].clip);
removeMovieClip(game[tempname].clip);
i++;
}
if (!remove) {
removeMovieClip(ab.background_map1);
removeMovieClip(ab.background_map2);
removeMovieClip(ab.background_map3);
}
}
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
tile_vert = screen_width / tile_width;
tile_hort = screen_height / tile_height;
var t = _root;
game = {tileW:32, tileH:32, currentMap:1};
tilemap = {Fo1:{f:1, W:true, C:false, L:false}, Fo2:{f:2, W:true, C:true, L:false}, Fo3:{f:3, W:true, C:true, L:false}, Fo4:{f:4, W:false, C:true, L:false}, Fo5:{f:5, W:false, C:true, L:false}, Fo6:{f:6, W:true, C:false, L:false}, Fo7:{f:7, W:true, C:false, L:false}, Fo8:{f:8, W:true, C:false, L:false}, Fo9:{f:9, W:true, C:false, L:false}, Fo10:{f:10, W:true, C:false, L:false}, Fo11:{f:11, W:true, C:false, L:false}, Fo12:{f:12, W:true, C:false, L:false}, Fo13:{f:13, W:true, C:false, L:false}, Fo14:{f:14, W:true, C:false, L:true}, Fo15:{f:15, W:true, C:false, L:true}, Fo16:{f:16, W:true, C:true, L:true}, Fo17:{f:17, W:true, C:false, L:true}, Fo18:{f:1, W:true, C:false, L:false}, Fo19:{f:5, W:false, C:false, L:false}, Fo20:{f:20, W:true, C:true, L:false}, Fo21:{f:21, W:true, C:true, L:false}, Fo22:{f:22, W:true, C:true, L:false}, Fo23:{f:23, W:false, C:true, L:false}, Fo24:{f:24, W:false, C:true, L:false}, Fo25:{f:25, W:false, C:false, L:false}, Fo26:{f:26, W:false, C:false, L:false}, Fo27:{f:27, W:false, C:true, L:true}, Fo28:{f:28, W:false, C:false, L:false}, Fo29:{f:29, W:false, C:false, L:false}, Fo30:{f:30, W:false, C:false, L:false}, Fo31:{f:31, W:false, C:false, L:false}, Fo32:{f:32, W:false, C:false, L:false}, Fo33:{f:33, W:false, C:false, L:false}, Fo35:{f:35, W:true, C:true, L:true}, Fo36:{f:36, W:true, C:false, L:false}, Fo37:{f:37, W:true, C:false, L:false}, Fo38:{f:38, W:true, C:false, L:false}, Fo39:{f:39, W:true, C:false, L:false}, Fo40:{f:40, W:true, C:false, L:false}, Fo41:{f:41, W:true, C:false, L:false}, Fo42:{f:42, W:true, C:false, L:false}, Fo43:{f:43, W:true, C:false, L:false}, Fo44:{f:44, W:true, C:false, L:false}, Fo45:{f:45, W:true, C:false, L:false}, Fo46:{f:46, W:false, C:false, L:false}, Fo47:{f:47, W:true, C:true, L:true}, Fo48:{f:48, W:true, C:false, L:false}, Fo49:{f:49, W:true, C:false, L:false}, Fo50:{f:50, W:true, C:false, L:false}, Fo51:{f:51, W:true, C:false, L:false}, Fo52:{f:52, W:true, C:false, L:false}, Fo53:{f:53, W:true, C:false, L:false}, Fo54:{f:54, W:true, C:false, L:false}, Fo55:{f:55, W:true, C:false, L:false}, Fo56:{f:56, W:true, C:false, L:false}};
game.TileFo1 = function () {
};
game.TileFo2 = function () {
};
game.TileFo3 = function () {
};
game.TileFo4 = function () {
};
game.TileFo5 = function () {
};
game.TileFo6 = function () {
};
game.TileFo7 = function () {
};
game.TileFo8 = function () {
};
game.TileFo9 = function () {
};
game.TileFo10 = function () {
};
game.TileFo11 = function () {
};
game.TileFo12 = function () {
};
game.TileFo13 = function () {
};
game.TileFo14 = function () {
};
game.TileFo15 = function () {
};
game.TileFo16 = function () {
};
game.TileFo17 = function () {
};
game.TileFo18 = function () {
};
game.TileFo19 = function () {
};
game.TileFo20 = function () {
};
game.TileFo21 = function () {
};
game.TileFo22 = function () {
};
game.TileFo23 = function () {
};
game.TileFo24 = function () {
};
game.TileFo25 = function () {
};
game.TileFo26 = function () {
};
game.TileFo27 = function () {
};
game.TileFo28 = function () {
};
game.TileFo29 = function () {
};
game.TileFo30 = function () {
};
game.TileFo31 = function () {
};
game.TileFo32 = function () {
};
game.TileFo33 = function () {
};
game.TileFo35 = function () {
};
game.TileFo36 = function () {
};
game.TileFo37 = function () {
};
game.TileFo38 = function () {
};
game.TileFo39 = function () {
};
game.TileFo40 = function () {
};
game.TileFo41 = function () {
};
game.TileFo42 = function () {
};
game.TileFo43 = function () {
};
game.TileFo44 = function () {
};
game.TileFo45 = function () {
};
game.TileFo46 = function () {
};
game.TileFo47 = function () {
};
game.TileFo48 = function () {
};
game.TileFo49 = function () {
};
game.TileFo50 = function () {
};
game.TileFo51 = function () {
};
game.TileFo52 = function () {
};
game.TileFo53 = function () {
};
game.TileFo54 = function () {
};
game.TileFo55 = function () {
};
game.TileFo56 = function () {
};
game.Enemyp1 = function () {
};
game.Enemyp2 = function () {
};
game.Enemyp3 = function () {
};
game.Enemyp4 = function () {
};
game.F_enemyp1 = function () {
};
game.Item1 = function () {
};
game.Item2 = function () {
};
game.Item3 = function () {
};
game.Item4 = function () {
};
game.Item5 = function () {
};
game.Item6 = function () {
};
game.Item7 = function () {
};
game.Item8 = function () {
};
game.Item9 = function () {
};
game.MovingTilep1 = function () {
};
game.MovingTilep2 = function () {
};
game.ExtraLives1 = function () {
};
game.BonusP1 = function () {
};
var temp = _root.Char;
i = 0;
while (0 >= i) {
char = {xtile:temp[i].x, ytile:temp[i].y, xstart:temp[i].x, ystart:temp[i].y, speed:temp[i].speed, jumpstart:-16.5, gravity:2.3, jump:false, onMovingTile:false};
i++;
}
_root.level_comp = false;
buildmap(map);
stop();
Instance of Symbol 88 MovieClip [empty] in Frame 8
onClipEvent (enterFrame) {
_root.detectKeys();
}
Frame 9
attachMovie("game_credits", "gcredit", 10000);
gcredit._x = 30;
gcredit._y = 30;
Frame 10
attachMovie("instructions_info", "help", 90005);
help._x = 30;
help._y = 30;
Symbol 4 MovieClip Frame 6
_parent.bonus_visble = true;
stop();
Symbol 17 MovieClip Frame 10
_parent.bonusitem = true;
stop();
Symbol 18 MovieClip [bonuspoints] Frame 1
stop();
Symbol 18 MovieClip [bonuspoints] Frame 2
stop();
Symbol 54 MovieClip [LoadBarFill] Frame 1
this._xscale = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
Symbol 54 MovieClip [LoadBarFill] Frame 2
gotoAndPlay (1);
Symbol 88 MovieClip [empty] Frame 1
Symbol 143 MovieClip Frame 1
stop();
Symbol 163 MovieClip [char] Frame 1
stop();
Symbol 195 MovieClip [enemy2] Frame 1
stop();
Symbol 206 MovieClip Frame 1
_root._root.rock_explode.start();
Symbol 206 MovieClip Frame 4
removeMovieClip(_parent);
Symbol 207 MovieClip [F_enemy1] Frame 1
stop();
Symbol 208 MovieClip [fadeout] Frame 1
function fadeOut(xPos, yPos, width, height, rate, colour, dep, callbac) {
var a = 12;
attachMovie("empty", "pane", dep);
pane._x = xPos;
pane._y = yPos;
pane.onEnterFrame = function () {
if (a >= 120) {
rate = -rate;
callbac();
}
drawPane(width, height, (a = a + rate), colour);
if (a < 0) {
pane.removeMovieClip();
}
};
}
function drawPane(width, height, alpha, colour) {
with (pane) {
clear();
beginFill(colour, alpha);
lineTo(width, 0);
lineTo(width, height);
lineTo(0, height);
lineTo(0, 0);
endFill();
}
}
fadeOut(0, 0, 640, 480, 4, 0, 99999, build);
Symbol 211 MovieClip [chardie] Frame 1
die.start();
Symbol 211 MovieClip [chardie] Frame 16
_parent._parent.character_reset();
removeMovieClip(chardie.frame);
Symbol 222 Button [music_on_off]
on (release) {
if ((_root.music_off = true)) {
_root.music_1.stop();
_root.music_off = false;
gotoAndStop (2);
}
}
Symbol 225 Button [music_on_off_2]
on (release) {
_root.music_off = true;
_root.music_1.start(0, 999);
_root.music_1.setVolume(50);
gotoAndStop (1);
}
Symbol 226 MovieClip [music_on] Frame 1
stop();
Symbol 252 MovieClip [items] Frame 1
stop();
Symbol 253 MovieClip [extralife] Frame 33
gotoAndPlay (1);
Symbol 438 MovieClip [rockbreak] Frame 4
removeMovieClip(_root.breakrock);
Symbol 447 MovieClip [gamesounds] Frame 1
stop();
Symbol 461 Button [new_game]
on (release) {
_root.removebackground = true;
_root.level = 0;
_root.totalpoints = 0;
_root.game_over._y = 800;
_root.gamelives = _root.selectlives;
_root.gameover = false;
_root.remove_everything();
_root.level = (_root.level_up = (_root.enemySpeed = (_root.selectlives = (_root.selectedGame = (_root.monkeystate = (_root.roundpoints = (_root.points = (_root.livelost = (_root.totalpoints = 0)))))))));
_root.gotoAndStop("loadmaps");
}
Symbol 462 Button [new_game]
on (release) {
_root._root.removebackground = true;
_root._root.level = 0;
_root._root.totalpoints = 0;
_root.gameover = false;
_root.level_complete.removeMovieClip();
_root.music_on.removeMovieClip();
_root.quit_game.removeMovieClip();
_root.tiles.removeMovieClip();
_root.gamescore.removeMovieClip();
_root.nextlevel.removeMovieClip();
_root.snow_1.removeMovieClip();
_root.music_on.removeMovieClip();
_root.level = (_root.level_up = (_root.gamelives = (_root.enemySpeed = (_root.selectlives = (_root.selectedGame = (_root.monkeystate = (_root.roundpoints = (_root.points = (_root.livelost = (_root.totalpoints = 0))))))))));
_root.level_speed = 0;
var i = 0;
while (i < 10) {
var name = ("movingtile" + i);
var tempname = ("enemy" + i);
_root.game[name].clip.removeMovieClip();
_root.game[tempname].clip.removeMovieClip();
i++;
_root.background_map1.removeMovieClip();
_root.background_map2.removeMovieClip();
_root.background_map3.removeMovieClip();
}
_root.gotoAndStop("loadlevel");
_root.game_over.removeMovieClip();
}
Symbol 468 Button [next_level]
on (release, keyPress "<Enter>") {
_root.level++;
while (i < 10) {
var name = ("movingtile" + i);
var tempname = ("enemy" + i);
_root.game[name].clip.removeMovieClip();
_root.game[tempname].clip.removeMovieClip();
i++;
}
_root.tiles.removeMovieClip();
_root.gotoAndPlay("loadmaps");
}
Symbol 473 MovieClip [enemy4] Frame 1
stop();
Instance of Symbol 551 MovieClip in Symbol 552 MovieClip [expFlake1] Frame 1
onClipEvent (load) {
mySpeed = Number(random(4)) + 1;
myAlpha = Number(random(30)) + 10;
}
onClipEvent (enterFrame) {
_parent._y = _parent._y + mySpeed;
if (480 < _parent._y) {
_parent.removeMovieClip();
}
}
Instance of Symbol 549 MovieClip in Symbol 553 MovieClip [snow] Frame 1
onClipEvent (load) {
function makeAFlake() {
attachMovie("expflake1", "newflake" + depth, depth);
this["newflake" + depth]._x = Math.randomBetween(50, 600);
this["newflake" + depth]._y = Math.randomBetween(-40, -20);
depth++;
}
Math.randomBetween = function (a, b) {
return(a + Math.floor(Math.random() * ((b - a) + 1)));
};
depth = 1;
i = 0;
while (i < 10) {
i++;
}
nIntervalCount = 80;
}
onClipEvent (enterFrame) {
if (28 < nIntervalCount) {
makeAFlake();
nIntervalCount = Number(random(2)) + 2;
}
nIntervalCount++;
}
Symbol 556 Button
on (release, keyPress "<Enter>") {
_root._root.level = 0;
_root._root.totalpoints = 0;
_root.gameover = false;
_root.level_complete.removeMovieClip();
_root.music_on.removeMovieClip();
_root.quit_game.removeMovieClip();
_root.tiles.removeMovieClip();
_root.gamescore.removeMovieClip();
_root.nextlevel.removeMovieClip();
_root.snow_1.removeMovieClip();
_root.music_on.removeMovieClip();
_root.level = (_root.level_up = (_root.gamelives = (_root.enemySpeed = (_root.selectlives = (_root.selectedGame = (_root.monkeystate = (_root.roundpoints = (_root.points = (_root.livelost = (_root.totalpoints = 0))))))))));
_root.level_speed = 0;
var i = 0;
while (i < 10) {
var name = ("movingtile" + i);
var tempname = ("enemy" + i);
_root.game[name].clip.removeMovieClip();
_root.game[tempname].clip.removeMovieClip();
i++;
_root.background_map1.removeMovieClip();
_root.background_map2.removeMovieClip();
_root.background_map3.removeMovieClip();
}
trace("muppet");
_root.gotoAndStop("loadlevel");
_root.gcomplete.removeMovieClip();
}
Symbol 561 Button [backbutton]
on (release) {
removeMovieClip(start);
gotoAndStop ("instructions");
}
Symbol 562 Button [backbutton]
on (release) {
removeMovieClip(start);
gotoAndStop ("credits");
}
Symbol 563 Button [backbutton]
on (release) {
removeMovieClip(start);
_root.gamelives = 5;
_root.music_1.stop();
_root.gametype = "easy";
gotoAndStop ("loadmaps");
}
Symbol 564 Button [backbutton]
on (release) {
removeMovieClip(start);
_root.gamelives = 3;
_root.music_1.stop();
_root.level_speed = 2;
_root.gametype = "hard";
gotoAndStop ("loadmaps");
}
Symbol 565 Button [backbutton]
on (release) {
var a = _root;
a.gameover = true;
a.game_over._y = screen_height / 2;
a.game_over._visible = true;
a.fadeOut_Level();
}
Symbol 566 Button [backbutton]
on (release) {
removeMovieClip(gcredit);
gotoAndPlay ("loadlevel");
}
Symbol 567 Button [backbutton]
on (release) {
removeMovieClip(help);
gotoAndPlay ("loadlevel");
}