Frame 1
stop();
Instance of Symbol 154 MovieClip "mcLoader" in Frame 1
onClipEvent (load) {
_root.stop();
}
onClipEvent (enterFrame) {
i = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
txtPercentLoaded = i;
trace((((i + " getBytesLoaded:") + _root.getBytesLoaded()) + " getBytesTotal:") + _root.getBytesTotal());
if (i >= 100) {
this.gotoAndStop(2);
}
}
Frame 84
function setDefaultKeys() {
keyQualityToggle = 81;
keyMusicOnOff = 77;
keyPauseGame = 80;
trace("setting default keys");
key_pLMoveRight = 39;
key_pLMoveLeft = 37;
key_pLMoveForward = 38;
key_pLMoveBack = 40;
key_pLJump = 32;
key_pLFire = 17;
}
function displayKeyAssignments() {
arrKeyCodeValue = new Array();
arrKeyCodeValue[8] = "Backspace";
arrKeyCodeValue[9] = "Tab";
arrKeyCodeValue[12] = "Clear";
arrKeyCodeValue[13] = "Enter";
arrKeyCodeValue[16] = "Shift";
arrKeyCodeValue[17] = "Control";
arrKeyCodeValue[18] = "Alt";
arrKeyCodeValue[20] = "Caps Lock";
arrKeyCodeValue[27] = "Esc";
arrKeyCodeValue[32] = "Spacebar";
arrKeyCodeValue[33] = "Page Up";
arrKeyCodeValue[34] = "Page Down";
arrKeyCodeValue[35] = "End";
arrKeyCodeValue[36] = "Home";
arrKeyCodeValue[37] = "Left Arrow";
arrKeyCodeValue[38] = "Up Arrow";
arrKeyCodeValue[39] = "Right Arrow";
arrKeyCodeValue[40] = "Down Arrow";
arrKeyCodeValue[45] = "Insert";
arrKeyCodeValue[46] = "Delete";
arrKeyCodeValue[47] = "Help";
arrKeyCodeValue[48] = "0";
arrKeyCodeValue[49] = "1";
arrKeyCodeValue[50] = "2";
arrKeyCodeValue[51] = "3";
arrKeyCodeValue[52] = "4";
arrKeyCodeValue[53] = "5";
arrKeyCodeValue[54] = "6";
arrKeyCodeValue[55] = "7";
arrKeyCodeValue[56] = "8";
arrKeyCodeValue[57] = "9";
arrKeyCodeValue[65] = "A";
arrKeyCodeValue[66] = "B";
arrKeyCodeValue[67] = "C";
arrKeyCodeValue[68] = "D";
arrKeyCodeValue[69] = "E";
arrKeyCodeValue[70] = "F";
arrKeyCodeValue[71] = "G";
arrKeyCodeValue[72] = "H";
arrKeyCodeValue[73] = "I";
arrKeyCodeValue[74] = "J";
arrKeyCodeValue[75] = "K";
arrKeyCodeValue[76] = "L";
arrKeyCodeValue[77] = "M";
arrKeyCodeValue[78] = "N";
arrKeyCodeValue[79] = "O";
arrKeyCodeValue[80] = "P";
arrKeyCodeValue[81] = "Q";
arrKeyCodeValue[82] = "R";
arrKeyCodeValue[83] = "S";
arrKeyCodeValue[84] = "T";
arrKeyCodeValue[85] = "U";
arrKeyCodeValue[86] = "V";
arrKeyCodeValue[87] = "W";
arrKeyCodeValue[88] = "X";
arrKeyCodeValue[89] = "Y";
arrKeyCodeValue[90] = "Z";
arrKeyCodeValue[96] = "Numpad 0";
arrKeyCodeValue[97] = "Numpad 1";
arrKeyCodeValue[98] = "Numpad 2";
arrKeyCodeValue[99] = "Numpad 3";
arrKeyCodeValue[100] = "Numpad 4";
arrKeyCodeValue[101] = "Numpad 5";
arrKeyCodeValue[102] = "Numpad 6";
arrKeyCodeValue[103] = "Numpad 7";
arrKeyCodeValue[104] = "Numpad 8";
arrKeyCodeValue[105] = "Numbpad 9";
arrKeyCodeValue[106] = "Numpad Multiply";
arrKeyCodeValue[107] = "Numpad Add";
arrKeyCodeValue[108] = "Numpad Enter";
arrKeyCodeValue[109] = "Numpad Subtract";
arrKeyCodeValue[110] = "Numpad Decimal";
arrKeyCodeValue[111] = "Numpad Divide";
arrKeyCodeValue[112] = "F1";
arrKeyCodeValue[113] = "F2";
arrKeyCodeValue[114] = "F3";
arrKeyCodeValue[115] = "F4";
arrKeyCodeValue[116] = "F5";
arrKeyCodeValue[117] = "F6";
arrKeyCodeValue[118] = "F7";
arrKeyCodeValue[119] = "F8";
arrKeyCodeValue[120] = "F9";
arrKeyCodeValue[121] = "F10";
arrKeyCodeValue[122] = "F11";
arrKeyCodeValue[123] = "F12";
arrKeyCodeValue[124] = "F13";
arrKeyCodeValue[125] = "F14";
arrKeyCodeValue[126] = "F15";
arrKeyCodeValue[144] = "Num Lock";
arrKeyCodeValue[186] = ";";
arrKeyCodeValue[187] = "=";
arrKeyCodeValue[189] = "-";
arrKeyCodeValue[191] = "/";
arrKeyCodeValue[192] = "`";
arrKeyCodeValue[219] = "[";
arrKeyCodeValue[220] = "\\";
arrKeyCodeValue[221] = "]";
arrKeyCodeValue[222] = "'";
menuWindowMC.keyRotateLeftMC.txtKey = arrKeyCodeValue[keyRotateLeft];
menuWindowMC.keyRotateRightMC.txtKey = arrKeyCodeValue[keyRotateRight];
menuWindowMC.keyThrustOnMC.txtKey = arrKeyCodeValue[keyThrustOn];
menuWindowMC.keyQualityToggleMC.txtKey = arrKeyCodeValue[keyQualityToggle];
menuWindowMC.keyMusicOnOffMC.txtKey = arrKeyCodeValue[keyMusicOnOff];
trace("displaying key " + arrKeyCodeValue[221]);
trace("displaying key " + arrKeyCodeValue[221]);
}
function displayKeyValue(obj) {
obj.status = "none";
obj.txtKey = _root.arrKeyCodeValue[_root[obj._name]];
}
function setKeyValue(obj) {
if (obj.status == "selected") {
obj.status = "none";
_root[obj._name] = Key.getCode();
obj.txtKey = _root.arrKeyCodeValue[_root[obj._name]];
}
obj.gotoAndStop(1);
}
function highlightKey(obj) {
if (obj.hitTest(_root._xmouse, _root._ymouse, 1)) {
obj.status = "selected";
obj.gotoAndStop(2);
} else {
obj.status = "none";
obj.gotoAndStop(1);
}
}
function getAngle2toAngle1direction(angle1, angle2) {
angleDiff = angle1 - angle2;
if ((angle1 * angle2) < 0) {
if (angle1 < 0) {
angle1 = angle1 + 180;
angleDiff = -(angle1 - angle2);
} else {
angle2 = angle2 + 180;
angleDiff = -(angle1 - angle2);
}
}
if (angleDiff > 0) {
return(1);
}
return(-1);
}
function updateTimer(time) {
time = time + default_start_time;
temp10h = int(time / 36000);
time = time - (temp10h * 36000);
temp1h = int(time / 3600);
time = time - (temp1h * 3600);
temp10m = int(time / 600);
time = time - (temp10m * 600);
temp1m = int(time / 60);
time = time - (temp1m * 60);
temp10s = int(time / 10);
time = time - (temp10s * 10);
temp1s = int(time);
displayDigit("time_10h_MC", temp10h);
displayDigit("time_1h_MC", temp1h);
displayDigit("time_10m_MC", temp10m);
displayDigit("time_1m_MC", temp1m);
displayDigit("time_10s_MC", temp10s);
displayDigit("time_1s_MC", temp1s);
}
function displayDigit(numericDigit, value) {
if (value == 0) {
eval ("statusWindowMC." + numericDigit).gotoAndStop(10);
} else {
eval ("statusWindowMC." + numericDigit).gotoAndStop(value);
}
}
function getHighestMCdepth() {
if ((highestDepth < 10000) || (highestDepth > 12000)) {
highestDepth = 10000;
} else {
highestDepth++;
}
return(highestDepth);
}
function playSound(sndOwner, sndOwnerMC, soundType, percentToPlay) {
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
trace((((("PLAYING SOUND: sndOwner: " + sndOwner) + " soundType: ") + soundType) + " sndOwnerMC: ") + sndOwnerMC);
if (Math_random() < percentToPlay) {
arrNo = soundArr.length;
while ((arrNo--) > 0) {
soundObj = soundArr[arrNo];
if ((sndOwner == soundObj.owner) && (soundType == soundObj.soundType)) {
if (soundObj.noOfSounds > 1) {
soundNo = 1 + int(soundObj.noOfSounds * Math_random());
} else {
soundNo = "";
}
sndOwnerMC = new Sound();
sndOwnerMC.attachSound(soundObj.soundName + soundNo);
sndOwnerMC.start(0.1, 1);
trace((("PLAYING SOUND: soundObj.soundName + soundNo: " + soundObj.soundName) + soundNo) + "~~");
}
}
}
}
function gameMusicPlay(musicSndNo) {
trace((("playGameMusic: " + playGameMusic) + " :: musicSndNo: ") + musicSndNo);
if (playGameMusic) {
if (musicSndNo > 0) {
gameMusicStop();
musicSnd = new Sound();
musicSnd.attachSound("music" + musicSndNo);
musicSnd.start(0, 10000);
} else {
musicSnd.start(0, 10000);
}
}
g.musicSndNo = musicSndNo;
}
function gameMusicStop() {
musicSnd.stop("music" + g.musicSndNo);
}
Abs = Math.abs;
GetTimer = getTimer;
Math_random = Math.random;
function bgndObj(type, distance, doorSide) {
this.type = type;
this.distance = distance;
this.doorSide = doorSide;
}
function removeAttachedMCs() {
removeMovieClip("game_attachMC.pL_MC");
}
function displayMessage(message) {
statusWindowMC.txtMessage = message;
displayMessageFr = 2 * FPS;
}
function game_reset() {
g_missionNo = 1;
total_time = 0;
default_start_time = 42780;
game_failed_time = 43200;
level_finish_time = 0;
pause_start_time = 0;
startTime = 0;
}
function game_nextLevel() {
game_start();
}
function gotoMainMenu() {
gameMusicStop();
menuWindowMC.gotoAndStop("main_menu");
}
function game_start() {
_level0.createEmptyMovieClip("game_attachMC", 100);
game_attachMC.createEmptyMovieClip("Street_MC", 1);
pL = new Player(100, 100);
pL_checkHealth();
Map = [];
bgndArr = [];
bgndNo = 1;
currentArr = [];
bubbleArr = [];
enemyArr = [];
tempEnemyArr = [];
projectileArr = [];
pickUpItemArr = [];
fadeAwayArr = [];
trace(eval (game_attachMC));
switch (g_missionNo) {
case 1 :
createEnemy("Boss1_Witch", 100, 0, 50, "path1");
lineColor = 3355443 /* 0x333333 */;
fillColor = 6710886 /* 0x666666 */;
break;
case 2 :
createEnemy("Boss2_Death", 100, 0, 50, "path3");
lineColor = 3355443 /* 0x333333 */;
fillColor = 10040064 /* 0x993300 */;
break;
case 3 :
createEnemy("Boss3_Santa", 100, 0, 50, "path5");
lineColor = 3355443 /* 0x333333 */;
fillColor = 16711680 /* 0xFF0000 */;
createEnemy("Volcano", 150, 0, 1800, "");
createEnemy("Volcano", 150, 0, 1200, "");
createEnemy("Volcano", 150, 0, 600, "");
break;
}
setPosition(pL, 150, 0, 1950);
createPlantArea(0, 0, 300, 2000);
setMapBoundary(50, 0, 200, 2000);
switch (g_missionNo) {
case 1 :
break;
case 2 :
break;
case 3 :
break;
}
g_stat = "play";
_quality = game_quality;
menuWindowMC.gotoAndStop("game_start");
onEnterFrame = onEnterFrame_game;
onMouseDown = onMouseDown_game;
onMouseUp = onMouseUp_game;
createEmptyMovieClip("_keyListener", 1);
Key.addListener(_keyListener);
_keyListener.onKeyDown = onKeyDown_game;
gameCoverMC.swapDepths(1200);
menuWindowMC.swapDepths(1100);
statusWindowMC.swapDepths(1010);
Mouse.hide();
game_FrNo = 0;
startTime = startTime + (getTimer() - level_finish_time);
levelCompleteCounter = 0;
statusWindowMC.missionMessageMC._visible = false;
statusWindowMC.missionMessageMC.gotoAndStop(1);
statusWindowMC.EnemyStatusMC._visible = false;
statusWindowMC.EnemyStatusMC.heathMC.barMC._xscale = 100;
displayMessage("");
trace("=============================================================");
trace("levelAllowedTime " + levelAllowedTime);
trace("g_missionNo: " + g_missionNo);
game_MC.bgnd_MC.gotoAndStop("mission_" + g_missionNo);
gameMusicPlay(1);
}
function game_over(status) {
_quality = "HIGH";
removeAttachedMCs();
delete onEnterFrame;
delete onMouseDown;
delete onMouseUp;
delete _keyListener;
menuWindowMC._visible = true;
Mouse.show();
switch (status) {
case "missionComplete" :
levelCodeArr[g_missionNo][g_taskNo].unlocked = true;
menuWindowMC.cutScenesMC.txtLevelCode = levelCodeArr[g_missionNo][g_taskNo].code;
if (g_taskNo >= levelCodeArr[g_missionNo].length) {
g_missionNo++;
} else {
g_taskNo++;
}
if (g_missionNo <= g.noOfMissions) {
menuWindowMC.gotoAndStop("missionComplete");
} else {
menuWindowMC.gotoAndStop("game_complete");
}
return;
case "pL_dead" :
case "timeIsUp" :
case "FailedToSaveAll" :
menuWindowMC._visible = true;
menuWindowMC.gotoAndStop("pL_dies");
return;
}
}
function Player(health, layerDepth) {
this.fullHealth = (this.health = health);
this.rad = 10;
this.h = 20;
this.walkSpeed = 60 / FPS;
this.jumpSpeed = 100 / FPS;
this.layerDepth = layerDepth;
this.reloadFr = (this.defaultReloadFr = FPS / 2);
this.weaponReload = 1;
this.attackDamage = 1;
this.weaponLevel = 1;
this.proj_v = 90 / FPS;
game_attachMC.attachMovie("Player", "pL_MC", getHighestMCdepth());
game_attachMC.attachMovie("Shadow", "pL_shadowMC", getHighestMCdepth());
this.target = "game_attachMC.pL_MC";
pL_MC = eval (this.target);
this.shadow = [];
this.shadow.type = "Shadow";
this.shadow.target = "game_attachMC.pL_shadowMC";
}
function Plant(target, x, y, z, rad, contactDamage) {
trace((target + " ") + x);
this.type = "plant";
this.target = target;
this.x = x;
this.y = y;
this.z = z;
this.rad = rad;
this.contactDamage = contactDamage;
}
function setPosition(tempObj, x, y, z) {
tempObj.x = x;
tempObj.y = y;
tempObj.z = z;
}
function pLGetsHurt(damage) {
pL.health = pL.health - damage;
playSound("pL", tempObj.target, "getsHurt", 100);
pL_checkHealth();
x = pL.x + (pL.rad * (0.5 - Math_Random()));
y = pL.y + (2 * pL.rad);
z = pL.z + (pL.rad * (0.5 - Math_Random()));
}
function enemyGetsHurt(tempObj, damage) {
tempObj.health = tempObj.health - damage;
if (tempObj.health <= 0) {
tempObj.alpha = 100;
fadeAwayArr.push(tempObj);
enemyArr.splice(tempObj.arrayNo, 1);
switch (enemyObj.type) {
case "Boss1_Witch" :
case "Boss2_Death" :
case "Boss3_Santa" :
statusWindowMC.EnemyStatusMC.heathMC.barMC._xscale = 0;
trace((("enemyGetsHurt: " + enemyObj.type) + " :: enemyObj.health: ") + enemyObj.health);
startLevelCompleteCountdown("missionComplete");
displayMessage("Saved Boss");
break;
default :
if ((g.savedEnemyNo++) >= 2) {
g.savedEnemyNo = 0;
createPickUpItem(tempObj.x, 0, tempObj.z - 2);
}
displayMessage("Saved " + enemyObj.type);
}
playSound("enemy", tempObj.target, "saved", 100);
eval (tempObj.target).gotoAndStop("dies");
statusWindowMC.EnemyStatusMC._visible = false;
} else {
statusWindowMC.EnemyStatusMC._visible = true;
switch (enemyObj.type) {
case "Boss1_Witch" :
case "Boss2_Death" :
case "Boss3_Santa" :
statusWindowMC.EnemyStatusMC.gotoAndStop("boss");
break;
default :
statusWindowMC.EnemyStatusMC.gotoAndStop("none");
}
playSound("enemy", tempObj.target, "getsHurt", 100);
statusWindowMC.EnemyStatusMC.heathMC.barMC._xscale = (100 * enemyObj.health) / enemyObj.fullHealth;
}
}
function pL_checkHealth() {
if (pL.health > 100) {
pL.health = 100;
} else if (pL.health < 0) {
pL.health = 0;
game_over("pL_dead");
}
statusWindowMC.pL_heathMC.barMC._xscale = pL.health;
}
function createPickUpItem(x, y, z) {
tempObj = [];
randomNo = Math.random();
if (randomNo < 0.33) {
type = "health";
quantity = 25;
} else if (randomNo < 0.66) {
type = "weaponLevel";
quantity = 1;
} else {
type = "weaponReload";
quantity = 1;
}
tempObj.type = type;
tempObj.x = x;
tempObj.y = y;
tempObj.z = z;
tempObj.quantity = quantity;
tempObj.rad = 10;
tempObj.timer = 4 * FPS;
bgndNo++;
game_attachMC.attachMovie("pickUpItem", type + bgndNo, getHighestMCdepth());
tempObj.target = ("game_attachMC." + type) + bgndNo;
eval (tempObj.target).gotoAndStop(type);
pickUpItemArr.push(tempObj);
}
function createPlantArea(area_x, area_y, area_w, area_h) {
plantSpacingZ = 150;
var j = 0;
while (j < (area_h / plantSpacingZ)) {
bgndNo++;
if (g_missionNo == 1) {
type = "Plant";
} else if (g_missionNo == 2) {
type = "Crypt";
} else if (g_missionNo == 3) {
type = "HellFlame";
}
game_attachMC.attachMovie(type, type + bgndNo, getHighestMCdepth());
target = ("game_attachMC." + type) + bgndNo;
eval (target).gotoAndPlay(int(eval (target)._totalframes * Math_Random()));
x = area_x - int(Math.random() * 20);
y = 0;
zLeft = (j * plantSpacingZ) + area_y;
zRight = zLeft + int((plantSpacingZ / 2) * Math.random());
rad = 5;
contactDamage = 1;
bgndArr.push(new Plant(target, x, y, zLeft, rad, contactDamage));
bgndNo++;
game_attachMC.attachMovie(type, type + bgndNo, getHighestMCdepth());
target = ("game_attachMC." + type) + bgndNo;
eval (target).gotoAndPlay(int(eval (target)._totalframes * Math_Random()));
bgndArr.push(new Plant(target, x + area_w, y, zRight, rad, contactDamage));
if ((((j * plantSpacingZ) + area_y) > 250) && ((j * plantSpacingZ) < (area_h - 250))) {
switch (g_missionNo) {
case 1 :
if (Math.random() > 0.5) {
enemyType = "Mummy";
} else {
enemyType = "Frankie";
}
if (Math.random() > 0.5) {
x = (area_x + 80) + int(Math.random() * 50);
pathName = "path1";
} else {
x = ((area_x + area_w) - 80) - int(Math.random() * 50);
pathName = "path2";
}
break;
case 2 :
if (Math.random() > 0.5) {
enemyType = "Skellie";
} else {
enemyType = "Zombie";
}
if (Math.random() > 0.5) {
x = (area_x + 80) + int(Math.random() * 50);
pathName = "path1";
} else {
x = ((area_x + area_w) - 80) - int(Math.random() * 50);
pathName = "path2";
}
break;
case 3 :
if (Math.random() > 0.5) {
enemyType = "Ghost";
} else {
enemyType = "DevilChild";
}
if (Math.random() > 0.5) {
x = (area_x + 80) + int(Math.random() * 100);
pathName = "pL_follow";
} else {
x = ((area_x + area_w) - 80) - int(Math.random() * 50);
pathName = "path2";
}
break;
}
y = 0;
z = (j * plantSpacingZ) + area_y;
createEnemy(enemyType, x, y, z, pathName);
}
j++;
}
}
function setMapBoundary(area_x, area_y, area_w, area_h) {
Map.xmin = area_x;
Map.xmax = area_x + area_w;
Map.zmin = area_y;
Map.zmax = area_y + area_h;
}
function setCurrentArea(area_x, area_y, area_w, area_h, vx, vz) {
currentObj = [];
currentObj.xmin = area_x;
currentObj.xmax = area_x + area_w;
currentObj.zmin = area_y;
currentObj.zmax = area_y + area_h;
currentObj.vx = vx;
currentObj.vz = vz;
currentArr.push(currentObj);
}
function createEnemy(type, x, y, z, pathName) {
trace((((type + " :: ") + x) + " :: ") + z);
bgndNo++;
game_attachMC.attachMovie(type, type + bgndNo, getHighestMCdepth());
tempObj = [];
tempObj.x = x;
tempObj.y = y;
tempObj.z = z;
tempObj.type = type;
tempObj.target = ("game_attachMC." + type) + bgndNo;
tempObj.pathName = pathName;
trace("here");
setObjectPath(tempObj);
if (type == "Volcano") {
tempObj.nextAttackFr = 0.5 * FPS;
tempObj.projectile = [];
tempObj.projectile.vxMax = 160 / FPS;
tempObj.projectile.vyMax = 100 / FPS;
tempObj.projectile.vzMax = 160 / FPS;
} else if (type == "Mummy") {
tempObj.v = 20 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 2;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 50 / FPS;
tempObj.projType = "proj_PaperBall";
} else if (type == "Frankie") {
tempObj.v = 20 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 2;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 50 / FPS;
tempObj.projType = "proj_Pin";
} else if (type == "Zombie") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 4;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 70 / FPS;
tempObj.projType = "proj_Spit";
} else if (type == "Skellie") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 4;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 70 / FPS;
tempObj.projType = "proj_Bone";
} else if (type == "Ghost") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 5;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 100 / FPS;
tempObj.projType = "proj_Circles";
} else if (type == "DevilChild") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 5;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 100 / FPS;
tempObj.projType = "proj_Flame";
} else if (type == "Boss1_Witch") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 15;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 100 / FPS;
tempObj.projType = "proj_Flame";
} else if (type == "Boss2_Death") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 15;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1 * FPS);
tempObj.proj_v = 100 / FPS;
tempObj.projType = "proj_Swoosh";
} else if (type == "Boss3_Santa") {
tempObj.v = 50 / FPS;
tempObj.rad = 7;
tempObj.h = 30;
tempObj.health = 15;
tempObj.contactDamage = 3;
tempObj.currAttackFr = (tempObj.nextAttackFr = 1.5 * FPS);
tempObj.proj_v = 100 / FPS;
tempObj.projType = "proj_Box";
}
tempObj.fullHealth = tempObj.health;
tempEnemyArr.push(tempObj);
}
function setObjectPath(tempObj) {
if ((tempObj.pathName != "pL_follow") && (tempObj.pathName != "")) {
tempObj.checkPointPathArr = [];
tempPathArr = eval (("checkPoint" + tempObj.pathName) + "_arr");
i = 0;
while (i < tempPathArr.length) {
tempObj.checkPointPathArr[i] = [];
tempObj.checkPointPathArr[i].x = tempObj.x + tempPathArr[i].x;
tempObj.checkPointPathArr[i].z = tempObj.z + tempPathArr[i].z;
trace((((i + " :: ") + tempPathArr[i].x) + " :: ") + tempObj.checkPointPathArr[i].x);
i++;
}
tempObj.checkPointArrNo = 0;
tempObj.x = tempObj.checkPointPathArr[tempObj.checkPointArrNo].x;
tempObj.z = tempObj.checkPointPathArr[tempObj.checkPointArrNo].z;
tempObj.nextCheckPointX = tempObj.checkPointPathArr[tempObj.checkPointArrNo + 1].x;
tempObj.nextCheckPointZ = tempObj.checkPointPathArr[tempObj.checkPointArrNo + 1].z;
}
}
function createProjectile(projOwner, type, x, y, z, vx, vy, vz, attackDamage) {
bgndNo++;
tempObj = [];
game_attachMC.attachMovie(type, type + bgndNo, getHighestMCdepth());
tempObj.owner = projOwner;
tempObj.type = type;
tempObj.target = ("game_attachMC." + type) + bgndNo;
tempObj.x = x;
tempObj.y = y;
tempObj.z = z;
tempObj.vx = vx;
tempObj.vy = vy;
tempObj.vz = vz;
tempObj.attackDamage = attackDamage;
tempObj.timer = 1 * FPS;
tempObj.rad = 5;
switch (projObj.type) {
case "proj_Box" :
tempObj.rad = 7;
break;
case "proj_Swoosh" :
tempObj.rad = 14;
case "proj_Bone" :
break;
}
bgndNo++;
game_attachMC.attachMovie("Shadow", (type + bgndNo) + "shadowMC", getHighestMCdepth());
tempObj.shadow = [];
tempObj.shadow.type = "Shadow";
tempObj.shadow.target = (("game_attachMC." + type) + bgndNo) + "shadowMC";
projectileArr.push(tempObj);
}
function updatePerspective(tempObj) {
tempMC = eval (tempObj.target);
x = tempObj.x - Camera.x;
y = tempObj.y - Camera.y;
z = Camera.z - tempObj.z;
if (z < (-Camera.cutoffdistance)) {
tempMC._visible = false;
} else {
tempMC._visible = true;
perspective_ratio = D / (D + z);
perspective_x = x * perspective_ratio;
perspective_y = y * perspective_ratio;
tempMC._x = origin_x + perspective_x;
tempMC._y = origin_y - perspective_y;
if ((tempMC._x > -20) && (tempMC._x < (sw + 20))) {
tempMC._xscale = (tempMC._yscale = 100 * perspective_ratio);
if (z > 250) {
tempMC._visible = 0;
} else if (z < 200) {
tempMC._alpha = 100;
} else {
tempMC._alpha = 100;
}
tempMC.swapDepths(int(-z));
} else {
tempMC._visible = false;
}
}
}
function nextCP(tempEnemyObj) {
temp_checkPointArrNo = tempEnemyObj.checkPointArrNo;
tempEnemyObj.checkPointArrNo++;
tempPathArr = tempEnemyObj.checkPointPathArr;
if (tempEnemyObj.checkPointArrNo >= tempPathArr.length) {
tempEnemyObj.checkPointArrNo = 0;
}
foundNextCP = false;
while (!foundNextCP) {
tempEnemyObj.checkPointArrNo = int(Math.random() * tempPathArr.length);
if (temp_checkPointArrNo != tempEnemyObj.checkPointArrNo) {
foundNextCP = true;
}
}
tempEnemyObj.nextCheckPointX = tempPathArr[tempEnemyObj.checkPointArrNo].x;
tempEnemyObj.nextCheckPointZ = tempPathArr[tempEnemyObj.checkPointArrNo].z;
}
function calculatePointPersp(temp_x, temp_y, temp_z) {
x = temp_x - Camera.x;
y = temp_y - Camera.y;
z = Camera.z - temp_z;
perspective_ratio = D / (D + z);
perspective_x = x * perspective_ratio;
perspective_y = y * perspective_ratio;
pointObj = [];
pointObj.x = origin_x + perspective_x;
pointObj.y = origin_y - perspective_y;
return(pointObj);
}
trace("=====================================================================");
trace((("xtype: " + xtype) + " :: xtype: ") + xtype);
i = 1;
while (i < 10) {
trace("multiPartObj.: " + multiPartObj);
i++;
}
if (firstTimeToLoad == undefined) {
firstTimeToLoad = false;
setDefaultKeys();
FPS = 24;
sw = 440;
sh = 320;
PI = 3.1415;
g = [];
g.grav = (200 / FPS) / FPS;
g.noOfMissions = 3;
Camera = [];
Camera.cutoffdistance = 100;
origin_x = sw / 2;
origin_y = 130;
D = 150;
checkPointPath1_arr = [];
currCheckPointPath_arr = checkPointPath1_arr;
currCheckPointPath_arr.push({x:0, y:0, z:0});
currCheckPointPath_arr.push({x:100, y:0, z:0});
checkPointPath2_arr = [];
currCheckPointPath_arr = checkPointPath2_arr;
currCheckPointPath_arr.push({x:0, y:0, z:0});
currCheckPointPath_arr.push({x:-100, y:0, z:0});
checkPointPath3_arr = [];
currCheckPointPath_arr = checkPointPath3_arr;
currCheckPointPath_arr.push({x:0, y:0, z:0});
currCheckPointPath_arr.push({x:80, y:0, z:0});
currCheckPointPath_arr.push({x:80, y:0, z:50});
currCheckPointPath_arr.push({x:0, y:0, z:50});
checkPointPath5_arr = [];
currCheckPointPath_arr = checkPointPath5_arr;
currCheckPointPath_arr.push({x:0, y:0, z:0});
currCheckPointPath_arr.push({x:25, y:0, z:-20});
currCheckPointPath_arr.push({x:50, y:0, z:0});
currCheckPointPath_arr.push({x:25, y:0, z:20});
reachedCheckPointDist = 5;
soundArr = [];
soundArr.push({owner:"pL", soundType:"attack", noOfSounds:1, soundName:"pLattack"});
soundArr.push({owner:"pL", soundType:"getsHurt", noOfSounds:2, soundName:"hit"});
soundArr.push({owner:"enemy", soundType:"saved", noOfSounds:1, soundName:"enemySaved"});
soundArr.push({owner:"enemy", soundType:"getsHurt", noOfSounds:2, soundName:"hit"});
soundArr.push({owner:"pickUpItem", soundType:"pickup", noOfSounds:1, soundName:"pickup"});
playGameMusic = true;
}
function onEnterFrame_game() {
game_FrNo++;
if (Key.isDown(key_pLMoveLeft)) {
pL.vx = -pL.walkSpeed;
xDir = "L";
} else if (Key.isDown(key_pLMoveRight)) {
pL.vx = pL.walkSpeed;
xDir = "R";
} else {
pL.vx = 0;
xDir = "F";
}
if (Key.isDown(key_pLMoveForward)) {
pL.vz = -pL.walkSpeed;
} else if (Key.isDown(key_pLMoveBack)) {
pL.vz = pL.walkSpeed;
} else {
pL.vz = 0;
}
if (Key.isDown(key_pLJump) && (!pL.jumping)) {
pL.vy = pL.jumpSpeed;
pL.jumping = true;
}
pL.currReloadFr--;
if (Key.isDown(key_pLFire) && (pL.currReloadFr < 0)) {
pL.currReloadFr = pL.reloadFr;
if (pL.vx == 0) {
proj_vx = 0;
} else {
proj_vx = (pL.walkSpeed * pL.vx) / Abs(pL.vx);
}
proj_vz = -pL.proj_v;
playSound("pL", pL_MC, "attack", 100);
if (pL.weaponLevel == 1) {
createProjectile("pL", "Seed", pL.x, pL.y + pL.rad, pL.z - pL.rad, proj_vx, 0, proj_vz, pL.attackDamage);
} else if (pL.weaponLevel == 2) {
createProjectile("pL", "Seed", pL.x - 5, pL.y + pL.rad, pL.z - pL.rad, proj_vx - 0.6, 0, proj_vz, pL.attackDamage);
createProjectile("pL", "Seed", pL.x + 5, pL.y + pL.rad, pL.z - pL.rad, proj_vx + 0.6, 0, proj_vz, pL.attackDamage);
} else if (pL.weaponLevel == 3) {
createProjectile("pL", "Seed", pL.x, pL.y + pL.rad, pL.z - (2 * pL.rad), proj_vx, 0, proj_vz, pL.attackDamage);
createProjectile("pL", "Seed", pL.x - 5, pL.y + pL.rad, pL.z - pL.rad, proj_vx - 0.6, 0, proj_vz, pL.attackDamage);
createProjectile("pL", "Seed", pL.x + 5, pL.y + pL.rad, pL.z - pL.rad, proj_vx + 0.6, 0, proj_vz, pL.attackDamage);
}
}
if (pL.y < 0) {
pL.y = 0;
pL.vy = pL.vy * 0.5;
pL.jumping = false;
}
pL_MC.gotoAndStop(xDir + zDir);
if (pL.x < Map.xmin) {
pL.x = Map.xmin;
} else if (pL.x > Map.xmax) {
pL.x = Map.xmax;
}
if (pL.z < Map.zmin) {
pL.z = Map.zmin;
} else if (pL.z > Map.zmax) {
pL.z = Map.zmax;
}
pL.x = pL.x + (pL.vx + g.current_vx);
pL.y = pL.y + ((pL.vy = pL.vy - g.grav));
pL.z = pL.z + (pL.vz + g.current_vz);
if (pL.z < g.z_LevelComplete) {
trace("2 g.missionFinishedReason " + g.missionFinishedReason);
trace("pL.z " + pL.z);
trace("g.z_LevelComplete " + g.z_LevelComplete);
}
Camera.x = pL.x;
Camera.y = pL.y + 80;
Camera.z = pL.z - 20;
perspective_ratio = D / ((D + Camera.z) - pL.z);
perspective_x = (pL.x - Camera.x) * perspective_ratio;
perspective_y = (pL.y - Camera.y) * perspective_ratio;
pL_MC._x = origin_x + perspective_x;
pL_MC._y = origin_y - perspective_y;
pL_MC._xscale = (pL_MC._yscale = 100 * perspective_ratio);
pL_MC._alpha = 100 * perspective_ratio;
pL_MC.swapDepths(int(-(Camera.z - pL.z)));
pL.shadow.x = pL.x;
pL.shadow.y = 0;
pL.shadow.z = pL.z - 1;
updatePerspective(pL.shadow);
arrNo = bgndArr.length;
while ((arrNo--) > 0) {
bgndObj = bgndArr[arrNo];
temp_dx = pL.x - bgndObj.x;
temp_dz = pL.z - bgndObj.z;
if ((bgndObj.type == "plant") || (bgndObj.type == "Shell")) {
temp_dist = bgndObj.rad + pL.rad;
if (((temp_dx * temp_dx) + (temp_dz * temp_dz)) < (temp_dist * temp_dist)) {
pLGetsHurt(bgndObj.contactDamage);
pL.x = pL.x - pL.vx;
pL.z = pL.z - pL.vz;
pL.vx = pL.vx * -1;
pL.vz = pL.vz * -1;
pL_MC.swapDepths(int(-(Camera.z - pL.z)));
}
}
updatePerspective(bgndObj);
}
bgndMC = game_attachMC.Street_MC;
bgndObj = [];
bgndObj.xmin = 50;
bgndObj.xmax = 250;
bgndObj.zmin = 0;
bgndObj.zmax = (0 + Camera.z) + 100;
bgndObj.perspXminZmin = calculatePointPersp(bgndObj.xmin, 0, bgndObj.zmin);
bgndObj.perspXmaxZmin = calculatePointPersp(bgndObj.xmax, 0, bgndObj.zmin);
bgndObj.perspXminZmax = calculatePointPersp(bgndObj.xmin, 0, bgndObj.zmax);
bgndObj.perspXmaxZmax = calculatePointPersp(bgndObj.xmax, 0, bgndObj.zmax);
bgndMC.clear();
bgndMC.lineStyle(1, lineColor, 100);
bgndMC.beginFill(fillColor);
bgndMC.moveTo(bgndObj.perspXminZmin.x, bgndObj.perspXminZmin.y);
bgndMC.lineTo(bgndObj.perspXmaxZmin.x, bgndObj.perspXmaxZmin.y);
bgndMC.lineTo(bgndObj.perspXmaxZmax.x, bgndObj.perspXmaxZmax.y);
bgndMC.lineTo(bgndObj.perspXminZmax.x, bgndObj.perspXminZmax.y);
bgndMC.lineTo(bgndObj.perspXminZmin.x, bgndObj.perspXminZmin.y);
bgndMC.endFill();
bgndMC.swapDepths(int(-(Camera.z - 0)));
arrNo = tempEnemyArr.length;
while ((arrNo--) > 0) {
tempEnemyObj = tempEnemyArr[arrNo];
if (tempEnemyObj.z > (pL.z - 150)) {
enemyArr.push(tempEnemyObj);
tempEnemyArr.splice(arrNo, 1);
switch (tempEnemyObj.type) {
case "Boss1_Witch" :
case "Boss2_Death" :
case "Boss3_Santa" :
gameMusicPlay(2);
if ((g_missionNo == 1) || (g_missionNo == 2)) {
noOfNonSaveables = 0;
} else if (g_missionNo == 3) {
noOfNonSaveables = 3;
}
if (enemyArr.length > (1 + noOfNonSaveables)) {
startLevelCompleteCountdown("FailedToSaveAll");
} else {
Map.zmax = 150 + tempEnemyObj.z;
Map.zmin = 100 + tempEnemyObj.z;
statusWindowMC.EnemyStatusMC._visible = true;
}
}
}
}
arrNo = enemyArr.length;
while ((arrNo--) > 0) {
enemyObj = enemyArr[arrNo];
if (pL.z > (enemyObj.z - Camera.cutoffdistance)) {
switch (enemyObj.type) {
case "Volcano" :
if ((enemyObj.currAttackFr--) < 0) {
enemyObj.currAttackFr = enemyObj.nextAttackFr;
proj_vx = enemyObj.projectile.vxMax * (0.5 - Math_random());
proj_vy = enemyObj.projectile.vyMax * (0.5 + (0.5 * Math_random()));
proj_vz = enemyObj.projectile.vzMax * (0.5 - Math_random());
createProjectile("enemy", "Volcano_rock", enemyObj.x, enemyObj.y + 5, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 15);
}
break;
case "Mummy" :
case "Frankie" :
case "Zombie" :
case "Skellie" :
case "Ghost" :
case "DevilChild" :
case "Boss1_Witch" :
case "Boss2_Death" :
case "Boss3_Santa" :
if (enemyObj.pathName == "pL_follow") {
enemyCP_dx = pL.x - enemyObj.x;
enemyCP_dz = pL.z - enemyObj.z;
} else {
enemyCP_dx = enemyObj.nextCheckPointX - enemyObj.x;
enemyCP_dz = enemyObj.nextCheckPointZ - enemyObj.z;
if (Abs(enemyCP_dx) < reachedCheckPointDist) {
if (Abs(enemyCP_dz) < reachedCheckPointDist) {
nextCP(enemyObj);
}
}
}
enemyCP_dist = Math.sqrt((enemyCP_dx * enemyCP_dx) + (enemyCP_dz * enemyCP_dz));
enemyCP_ux = enemyCP_dx / enemyCP_dist;
enemyCP_uz = enemyCP_dz / enemyCP_dist;
enemyObj.vx = enemyCP_ux * enemyObj.v;
enemyObj.vz = enemyCP_uz * enemyObj.v;
enemyObj.x = enemyObj.x + enemyObj.vx;
enemyObj.z = enemyObj.z + enemyObj.vz;
if (enemyObj.z > pL.z) {
eval (enemyObj.target).gotoAndStop("F");
} else {
eval (enemyObj.target).gotoAndStop("B");
}
temp_dx = pL.x - enemyObj.x;
temp_dz = pL.z - enemyObj.z;
temp_dist_rad = enemyObj.rad + pL.rad;
temp_dist = Math.sqrt((temp_dx * temp_dx) + (temp_dz * temp_dz));
if (temp_dist < temp_dist_rad) {
pLGetsHurt(enemyObj.contactDamage);
pL.x = enemyObj.x + ((temp_dist_rad * temp_dx) / temp_dist);
pL.z = enemyObj.z + ((temp_dist_rad * temp_dz) / temp_dist);
pL.vx = pL.vx * (-1);
pL.vz = pL.vz * (-1);
pL_MC.swapDepths(int(-(Camera.z - pL.z)));
}
switch (enemyObj.type) {
case "Mummy" :
case "Frankie" :
case "Zombie" :
case "Skellie" :
case "Ghost" :
case "DevilChild" :
if ((enemyObj.currAttackFr--) < 0) {
enemyObj.currAttackFr = enemyObj.nextAttackFr;
enemyPL_dx = pL.x - enemyObj.x;
enemyPL_dz = pL.z - enemyObj.z;
enemyPL_dist = Math.sqrt((enemyPL_dx * enemyPL_dx) + (enemyPL_dz * enemyPL_dz));
enemyPL_ux = enemyPL_dx / enemyPL_dist;
enemyPL_uz = enemyPL_dz / enemyPL_dist;
if (pL.z < (Map.zmax / 2)) {
proj_vCoeff = 1.5;
} else {
proj_vCoeff = 1;
}
proj_vx = (proj_vCoeff * enemyObj.proj_v) * enemyPL_ux;
proj_vy = (proj_vCoeff * enemyObj.proj_v) * 0;
proj_vz = (proj_vCoeff * enemyObj.proj_v) * enemyPL_uz;
if (g_missionNo == 1) {
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 10);
} else if (g_missionNo == 2) {
createProjectile("enemy", enemyObj.projType, enemyObj.x - 5, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx - 0.4, proj_vy, proj_vz, 10);
createProjectile("enemy", enemyObj.projType, enemyObj.x + 5, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx + 0.4, proj_vy, proj_vz, 10);
} else if (g_missionNo == 3) {
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 10);
createProjectile("enemy", enemyObj.projType, enemyObj.x - 5, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx - 0.6, proj_vy, proj_vz, 10);
createProjectile("enemy", enemyObj.projType, enemyObj.x + 5, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx + 0.6, proj_vy, proj_vz, 10);
}
}
break;
case "Boss1_Witch" :
if ((enemyObj.currAttackFr--) < 0) {
enemyObj.currAttackFr = enemyObj.nextAttackFr;
enemyPL_dx = pL.x - enemyObj.x;
enemyPL_dz = pL.z - enemyObj.z;
enemyPL_dist = Math.sqrt((enemyPL_dx * enemyPL_dx) + (enemyPL_dz * enemyPL_dz));
enemyPL_ux = enemyPL_dx / enemyPL_dist;
enemyPL_uz = enemyPL_dz / enemyPL_dist;
proj_vx = enemyObj.proj_v * enemyPL_ux;
proj_vy = enemyObj.proj_v * 0;
proj_vz = enemyObj.proj_v * enemyPL_uz;
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 5);
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx - 0.6, proj_vy, proj_vz, 5);
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx + 0.6, proj_vy, proj_vz, 5);
}
break;
case "Boss2_Death" :
if ((enemyObj.currAttackFr--) < 0) {
enemyObj.currAttackFr = enemyObj.nextAttackFr;
enemyPL_dx = pL.x - enemyObj.x;
enemyPL_dz = pL.z - enemyObj.z;
enemyPL_dist = Math.sqrt((enemyPL_dx * enemyPL_dx) + (enemyPL_dz * enemyPL_dz));
enemyPL_ux = enemyPL_dx / enemyPL_dist;
enemyPL_uz = enemyPL_dz / enemyPL_dist;
proj_vx = enemyObj.proj_v * enemyPL_ux;
proj_vy = enemyObj.proj_v * 0;
proj_vz = enemyObj.proj_v * enemyPL_uz;
if (enemyObj.attackNo == 1) {
enemyObj.attackNo = 2;
} else {
enemyObj.attackNo = 1;
}
if (enemyObj.attackNo == 1) {
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 15);
createProjectile("enemy", enemyObj.projType, enemyObj.x - 10, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx - 0.6, proj_vy, proj_vz, 15);
createProjectile("enemy", enemyObj.projType, enemyObj.x + 10, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx + 0.6, proj_vy, proj_vz, 15);
} else {
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + 18, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 15);
createProjectile("enemy", enemyObj.projType, enemyObj.x - 10, enemyObj.y + 18, enemyObj.z + 2, proj_vx - 0.6, proj_vy, proj_vz, 15);
createProjectile("enemy", enemyObj.projType, enemyObj.x + 10, enemyObj.y + 18, enemyObj.z + 2, proj_vx + 0.6, proj_vy, proj_vz, 15);
}
}
break;
case "Boss3_Santa" :
if ((enemyObj.currAttackFr--) >= 0) {
break;
}
enemyObj.currAttackFr = enemyObj.nextAttackFr;
enemyPL_dx = pL.x - enemyObj.x;
enemyPL_dz = pL.z - enemyObj.z;
enemyPL_dist = Math.sqrt((enemyPL_dx * enemyPL_dx) + (enemyPL_dz * enemyPL_dz));
enemyPL_ux = enemyPL_dx / enemyPL_dist;
enemyPL_uz = enemyPL_dz / enemyPL_dist;
proj_vx = enemyObj.proj_v * enemyPL_ux;
proj_vy = enemyObj.proj_v * 0;
proj_vz = enemyObj.proj_v * enemyPL_uz;
if (enemyObj.attackNo == 1) {
enemyObj.attackNo = 2;
} else {
enemyObj.attackNo = 1;
}
if (enemyObj.attackNo == 1) {
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 20);
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx - 0.6, proj_vy, proj_vz, 20);
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + enemyObj.rad, enemyObj.z + 2, proj_vx + 0.6, proj_vy, proj_vz, 20);
} else {
createProjectile("enemy", enemyObj.projType, enemyObj.x, enemyObj.y + 18, enemyObj.z + 2, proj_vx, proj_vy, proj_vz, 20);
createProjectile("enemy", enemyObj.projType, enemyObj.x - 10, enemyObj.y + 18, enemyObj.z + 2, proj_vx - 0.6, proj_vy, proj_vz, 20);
createProjectile("enemy", enemyObj.projType, enemyObj.x - 20, enemyObj.y + 18, enemyObj.z + 2, proj_vx - 1.2, proj_vy, proj_vz, 20);
createProjectile("enemy", enemyObj.projType, enemyObj.x + 10, enemyObj.y + 18, enemyObj.z + 2, proj_vx + 0.6, proj_vy, proj_vz, 20);
createProjectile("enemy", enemyObj.projType, enemyObj.x + 20, enemyObj.y + 18, enemyObj.z + 2, proj_vx + 1.2, proj_vy, proj_vz, 20);
}
}
break;
}
}
updatePerspective(enemyObj);
}
if (projectileArr.length > 0) {
projectileNo = projectileArr.length;
while ((projectileNo--) > 0) {
projObj = projectileArr[projectileNo];
projectileMC = eval (projObj.target);
projExplode = false;
switch (projObj.type) {
case "Volcano_rock" :
projObj.vy = projObj.vy - g.grav;
break;
case "Seed" :
break;
}
projObj.x = projObj.x + projObj.vx;
projObj.y = projObj.y + projObj.vy;
projObj.z = projObj.z + projObj.vz;
updatePerspective(projObj);
projObj.shadow.x = projObj.x;
projObj.shadow.y = 0;
projObj.shadow.z = projObj.z - 1;
updatePerspective(projObj.shadow);
projCollision = false;
if (projObj.owner == "pL") {
arrNo = enemyArr.length;
while ((arrNo--) > 0) {
enemyObj = enemyArr[arrNo];
if (Abs(enemyObj.x - projObj.x) < (enemyObj.rad + projObj.rad)) {
if (Abs(enemyObj.z - projObj.z) < (enemyObj.rad + projObj.rad)) {
if ((projObj.y > enemyObj.y) && (projObj.y < (enemyObj.y + enemyObj.h))) {
enemyObj.arrayNo = arrNo;
enemyGetsHurt(enemyObj, projObj.attackDamage);
projExplode = true;
}
}
}
}
} else if (tempObj.owner == "enemy") {
if (Abs(pL.x - projObj.x) < (pL.rad + projObj.rad)) {
if (Abs(pL.z - projObj.z) < (pL.rad + projObj.rad)) {
if ((projObj.y > pL.y) && (projObj.y < (pL.y + pL.h))) {
pLGetsHurt(projObj.attackDamage);
projExplode = true;
}
}
}
}
if ((--projObj.timer) < 0) {
projExplode = true;
}
if (projObj.y < 0) {
projExplode = true;
}
if (projExplode) {
temp_x = projectileMC._x;
temp_y = projectileMC._y;
temp_scale = projectileMC._xscale;
game_attachMC.createEmptyMovieClip("expMC", eval (projObj.shadow.target).getDepth());
game_attachMC.createEmptyMovieClip("expMC", projectileMC.getDepth());
game_attachMC.expMC.attachMovie("Volcano_rock_exp", "expMC", 1);
game_attachMC.expMC.expMC._x = temp_x;
game_attachMC.expMC.expMC._y = temp_y;
game_attachMC.expMC.expMC._xscale = (game_attachMC.expMC.expMC._yscale = temp_scale);
projectileArr.splice(projectileNo, 1);
}
}
}
i = 0;
while (i < pickUpItemArr.length) {
itemObj = pickUpItemArr[i];
updatePerspective(itemObj);
itemExplode = false;
if (pL.z > (itemObj.z - Camera.cutoffdistance)) {
if (Abs(pL.x - itemObj.x) < (pL.rad + itemObj.rad)) {
if (Abs(pL.z - itemObj.z) < (pL.rad + itemObj.rad)) {
if ((itemObj.y > pL.y) && (itemObj.y < (pL.y + pL.h))) {
switch (itemObj.type) {
case "health" :
pL.health = pL.health + itemObj.quantity;
pL_checkHealth();
message = "health";
break;
case "weaponLevel" :
if ((pL.weaponLevel++) >= 3) {
pL.weaponLevel = 3;
}
message = "ammo";
break;
case "weaponReload" :
if ((pL.weaponReload++) >= 3) {
pL.weaponReload = 3;
}
message = "weapon reload";
pL.reloadFr = pL.defaultReloadFr / pL.weaponReload;
}
itemExplode = true;
displayMessage("Picked up " + message);
playSound("pickUpItem", itemObj.target, "pickup", 100);
}
}
}
}
if ((--itemObj.timer) < 0) {
itemExplode = true;
}
if (itemExplode) {
itemObj.alpha = 100;
fadeAwayArr.push(itemObj);
pickUpItemArr.splice(i, 1);
}
i++;
}
arrNo = fadeAwayArr.length;
while ((arrNo--) > 0) {
fadeAwayObj = fadeAwayArr[arrNo];
fadeAwayObj.y = fadeAwayObj.y + 2;
updatePerspective(fadeAwayObj);
eval (fadeAwayObj.target)._alpha = (fadeAwayObj.alpha = fadeAwayObj.alpha - 5);
if (fadeAwayObj.alpha <= 0) {
eval (fadeAwayObj.target).removeMovieClip();
fadeAwayArr.splice(arrNo, 1);
}
}
if ((displayMessageFr--) < 0) {
statusWindowMC.txtMessage = "";
}
if (levelCompleteCounter > 0) {
levelCompleteCounter--;
trace("almost level complete " + levelCompleteCounter);
if (levelCompleteCounter == 0) {
game_over(g.missionFinishedReason);
}
} else {
currentTime = int((getTimer() - startTime) / 1000);
updateTimer(currentTime);
if ((default_start_time + currentTime) >= game_failed_time) {
startLevelCompleteCountdown("timeIsUp");
}
}
}
function startLevelCompleteCountdown(reason) {
statusWindowMC.missionMessageMC._visible = true;
statusWindowMC.missionMessageMC.gotoAndStop(reason);
g.missionFinishedReason = reason;
trace("g.missionFinishedReason " + g.missionFinishedReason);
if (!(reason === "missionComplete")) {
}
levelCompleteCounter = 2 * FPS;
missionMessageMC._visible = true;
level_finish_time = getTimer();
}
trace((("projectileMC: " + projectileMC) + " :: enemyMC: ") + enemyMC);
onKeyDown_game = function () {
currKey = Key.getCode();
if (testing_only) {
if (currKey == 17) {
pL.x = _xmouse;
pL.y = _ymouse;
}
}
if (currKey == keyQualityToggle) {
if (_quality == "HIGH") {
_quality = "MEDIUM";
} else if (_quality == "LOW") {
_quality = "HIGH";
} else if (_quality == "MEDIUM") {
_quality = "LOW";
}
mcQualityStatus.gotoAndPlay(2);
displayMessage("QUALITY: " + _quality);
mcQualityStatus.txtQuality = (game_quality = _quality);
}
if (g_stat == "play") {
if (Key.isDown(key_pLNextWeapon)) {
pL_changeWeapon(1);
} else if (Key.isDown(key_pLPrevWeapon)) {
pL_changeWeapon(-1);
} else if (Key.isDown(key_pLUse)) {
trace("PRESSED: USE KEY");
i = 0;
while (i < doorArr.length) {
doorObj = doorArr[i];
if (doorObj.roomNo == g_roomNo) {
doorID = "door_" + doorObj.type;
doorBgndID = doorID + "_bgnd";
if ((Abs(pL.x - doorObj.x) < 15) && (Abs(doorObj.y - pL.y) < 5)) {
pL.currDoor = doorObj;
pL.currDoor.target = doorObj.target;
pL.currDoor.usage = "enter";
pL.x = doorObj.x;
pL.y = doorObj.y;
pL.currDoor.target.gotoAndPlay("open");
}
}
i++;
}
} else if (currKey == keyMusicOnOff) {
if (playGameMusic) {
playGameMusic = false;
gameMusicStop();
} else {
playGameMusic = true;
gameMusicPlay(g.musicSndNo);
}
} else if (currKey == keyPauseGame) {
tempOnEnterFrame = onEnterFrame;
tempOnMouseDown = onMouseDown;
tempOnMouseUp = onMouseUp;
g_stat = "paused";
Mouse.show();
menuWindowMC.gotoAndStop("pause");
pause_start_time = getTimer();
delete onEnterFrame;
delete onMouseDown;
delete onMouseUp;
}
} else if (g_stat == "paused") {
if (currKey == keyPauseGame) {
onEnterFrame = tempOnEnterFrame;
onMouseDown = tempOnMouseDown;
onMouseUp = tempOnMouseUp;
g_stat = "play";
menuWindowMC.gotoAndStop("game_start");
startTime = startTime + (getTimer() - pause_start_time);
Mouse.hide();
}
}
};
onMouseDown_game = function () {
};
onMouseUp_game = function () {
};
Frame 85
stop();
Symbol 10 MovieClip [Shell] Frame 1
Symbol 14 MovieClip [HellFlame] Frame 1
gotoAndPlay(int(Math.random() * _totalframes) + 1);
Symbol 17 MovieClip [Crypt] Frame 1
gotoAndStop(int(Math.random() * _totalframes) + 1);
Symbol 20 MovieClip [Plant] Frame 1
gotoAndStop(int(Math.random() * _totalframes) + 1);
Symbol 24 Button
on (release) {
_root.g_missionNo = buttonNo;
_root.showCutScenes();
}
Symbol 28 MovieClip [missionButton] Frame 1
stop();
Symbol 29 Button [missionButton]
on (release) {
_root.levelNo = idNo;
_root.g.practiceMode = true;
trace((_parent.idNo + " : ") + idNo);
_root.levelInit();
_parent.gotoAndStop("game_start");
_parent.removePracticeLevelButtons();
}
Symbol 49 MovieClip Frame 1
stop();
Symbol 52 MovieClip [Volcano_rock_exp] Frame 2
this.removeMovieClip();
Symbol 54 MovieClip [proj_Flame] Frame 1
stop();
Symbol 54 MovieClip [proj_Flame] Frame 4
this.removeMovieClip();
Symbol 56 MovieClip [proj_Circles] Frame 1
stop();
Symbol 56 MovieClip [proj_Circles] Frame 4
this.removeMovieClip();
Symbol 58 MovieClip [proj_Bone] Frame 1
_rotation = int(360 * Math.random());
stop();
Symbol 58 MovieClip [proj_Bone] Frame 4
this.removeMovieClip();
Symbol 60 MovieClip [proj_Pin] Frame 1
stop();
Symbol 60 MovieClip [proj_Pin] Frame 4
this.removeMovieClip();
Symbol 63 MovieClip [proj_Swoosh] Frame 1
stop();
Symbol 63 MovieClip [proj_Swoosh] Frame 4
this.removeMovieClip();
Symbol 66 MovieClip [proj_Box] Frame 1
_rotation = (90 * (0.5 - Math.random()));
noOfBoxes = 2;
gotoAndStop(int(Math.random() * noOfBoxes) + 1);
Symbol 66 MovieClip [proj_Box] Frame 5
this.removeMovieClip();
Symbol 68 MovieClip [proj_PaperBall] Frame 1
stop();
Symbol 68 MovieClip [proj_PaperBall] Frame 4
this.removeMovieClip();
Symbol 70 MovieClip [proj_Spit] Frame 1
stop();
Symbol 70 MovieClip [proj_Spit] Frame 4
this.removeMovieClip();
Symbol 72 MovieClip [Seed] Frame 1
_rotation = int(180 * Math.random());
stop();
Symbol 72 MovieClip [Seed] Frame 4
this.removeMovieClip();
Symbol 84 MovieClip [Boss3_Santa] Frame 1
stop();
Symbol 90 MovieClip [Boss2_Death] Frame 1
stop();
Symbol 94 MovieClip [Boss1_Witch] Frame 1
stop();
Symbol 98 MovieClip [Player] Frame 1
stop();
Symbol 102 MovieClip [Shadow] Frame 1
Symbol 107 MovieClip [DevilChild] Frame 1
stop();
Symbol 114 MovieClip [Ghost] Frame 1
stop();
Symbol 118 MovieClip [Skellie] Frame 1
stop();
Symbol 123 MovieClip [Zombie] Frame 1
stop();
Symbol 132 MovieClip [Frankie] Frame 1
stop();
Symbol 137 MovieClip [Mummy] Frame 1
stop();
Symbol 139 MovieClip [Volcano_rock] Frame 1
stop();
Symbol 139 MovieClip [Volcano_rock] Frame 4
this.removeMovieClip();
Symbol 141 MovieClip [Volcano] Frame 1
stop();
Symbol 153 Button
on (release) {
_root.play();
}
Symbol 154 MovieClip Frame 1
stop();
Symbol 154 MovieClip Frame 2
Symbol 159 Button
on (release) {
getURL ("http://www.io3creations.com", "_blank");
}
Symbol 200 MovieClip Frame 1
stop();
Symbol 201 MovieClip Frame 1
stop();
Symbol 211 MovieClip Frame 1
stop();
Symbol 222 MovieClip Frame 1
stop();
Symbol 237 MovieClip Frame 1
stop();
Symbol 251 MovieClip Frame 1
stop();
Symbol 254 Button
on (release) {
g_levelNo = (txt_levelNo = 0);
}
Symbol 256 Button
on (release) {
_root.game_reset();
_root.game_start();
}
Symbol 259 Button
on (release) {
gotoAndStop (4);
_root.displayKeyAssignments();
}
Symbol 265 Button
on (release) {
gotoAndStop (5);
}
Symbol 268 Button
on (release) {
gotoAndStop (3);
}
Symbol 292 Button
on (release) {
gotoAndStop (1);
}
Symbol 299 MovieClip Frame 1
stop();
Symbol 299 MovieClip Frame 2
stop();
Symbol 317 Button
on (release) {
_root.game_nextLevel();
}
Symbol 319 Button
on (release) {
_root.gotoMainMenu();
}
Symbol 325 MovieClip Frame 1
Mouse.show();
_quality = "HIGH";
stopAllSounds();
stop();
Symbol 325 MovieClip Frame 3
_root.displayUnlockedLevels();
Instance of Symbol 299 MovieClip "key_pLMoveLeft" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "key_pLMoveRight" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "key_pLMoveForward" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "keyQualityToggle" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "keyMusicOnOff" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "keyPauseGame" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "key_pLMoveBack" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "key_pLFire" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}
Instance of Symbol 299 MovieClip "key_pLJump" in Symbol 325 MovieClip Frame 4
onClipEvent (load) {
_root.displayKeyValue(this);
}
onClipEvent (keyUp) {
_root.setKeyValue(this);
}
onClipEvent (mouseUp) {
_root.highlightKey(this);
}