Combined Code
frame 1 {
function goArmor() {
getURL('http://armorgames.com/', '_blank');
}
function dist(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
stop();
var myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
_root.menu = myMenu;
k = 0;
onEnterFrame = function () {
var v2 = Math.floor(framesLoaded / 4) - 1;
afw._x -= 0.3 * ((afw._x - _root['b' + v2]._x) / 2);
afw._y -= 0.3 * ((afw._y - _root['b' + v2]._y) / 2);
cat.removeMovieClip();
createEmptyMovieClip('cat', k++);
cat.lineStyle(1, 15132390, 100);
loaded = _root.getBytesLoaded();
total = _root.getBytesTotal();
framesLoaded = Math.ceil((loaded / total) * 100);
if (framesLoaded >= 100 && playMe.act == false) {
playMe.act = true;
playMe.play();
}
perDisp = framesLoaded + '%';
i = 0;
while (i < 25) {
if (framesLoaded >= i * 4) {
_root['b' + i]._alpha -= 0.08 * ((_root['b' + i]._alpha - 100) / 2);
_root['b' + i]._x -= 0.3 * ((_root['b' + i]._x - _root['b' + i].mainX) / 2);
_root['b' + i]._y -= 0.3 * ((_root['b' + i]._y - _root['b' + i].mainY) / 2);
if (i != 0) {
cat.moveTo(_root['b' + i]._x, _root['b' + i]._y);
cat.lineTo(_root['b' + (i - 1)]._x, _root['b' + (i - 1)]._y);
}
}
base = 1.5;
if (_root['b' + i].hitTest(_xmouse, _ymouse)) {
if (_xmouse - _root['b' + i]._x > 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._x -= base / (t + 1);
_root['b' + (i + t)]._x -= base / (t + 1);
++t;
}
} else {
if (_xmouse - _root['b' + i]._x <= 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._x += base / (t + 1);
_root['b' + (i + t)]._x += base / (t + 1);
++t;
}
}
}
if (_ymouse - _root['b' + i]._y > 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._y -= base / (t + 1);
_root['b' + (i + t)]._y -= base / (t + 1);
++t;
}
} else {
if (_ymouse - _root['b' + i]._y <= 0) {
t = 0;
while (t < 25) {
_root['b' + (i - t)]._y += base / (t + 1);
_root['b' + (i + t)]._y += base / (t + 1);
++t;
}
}
}
}
++i;
}
};
i = 0;
while (i < 25) {
_root['b' + i].mainX = _root['b' + i]._x;
_root['b' + i].mainY = _root['b' + i]._y;
_root['b' + i]._x = random(Stage.width);
_root['b' + i]._y = random(Stage.height);
_root['b' + i]._alpha = 0;
_root['b' + i].act = true;
++i;
}
}
movieClip 8 {
}
button 10 {
on (release) {
getURL('http://www.armorgames.com/', '_blank');
}
}
movieClip 12 {
}
// unknown tag 88 length 63
movieClip 15 {
}
// unknown tag 88 length 83
button 21 {
on (release) {
_root.killAd();
_root.play();
}
}
movieClip 22 {
frame 1 {
stop();
act = false;
}
frame 10 {
stop();
}
}
// unknown tag 88 length 231
// unknown tag 88 length 104
movieClip 29 {
}
frame 2 {
play();
}
// unknown tag 88 length 60
movieClip 35 {
}
movieClip 39 {
}
movieClip 40 {
frame 1 {
stop();
}
}
movieClip 41 boomCannon {
}
movieClip 43 bulletTrail {
frame 3 {
this.removeMovieClip();
}
}
movieClip 45 {
}
movieClip 46 {
}
movieClip 47 cashFly {
frame 30 {
this.removeMovieClip();
}
}
movieClip 49 {
}
movieClip 52 {
}
movieClip 53 {
frame 1 {
stop();
}
frame 10 {
stop();
}
}
movieClip 55 ElevatorShade {
}
movieClip 58 {
}
movieClip 66 {
}
movieClip 69 {
frame 1 {
stop();
}
}
movieClip 76 {
}
movieClip 82 {
frame 16 {
_parent.removeMovieClip();
}
}
movieClip 83 enemy0 {
frame 1 {
stop();
}
}
movieClip 85 {
}
movieClip 96 {
}
movieClip 108 {
}
movieClip 114 {
frame 19 {
_parent.removeMovieClip();
}
}
movieClip 115 enemy1 {
frame 1 {
stop();
}
}
movieClip 116 {
}
movieClip 119 {
frame 1 {
stop();
}
}
movieClip 122 {
}
movieClip 123 Elevator {
}
movieClip 125 {
}
movieClip 133 {
}
movieClip 141 {
}
movieClip 147 {
frame 19 {
_parent.removeMovieClip();
}
}
movieClip 148 enemy2 {
frame 1 {
stop();
}
}
movieClip 151 {
}
movieClip 158 {
}
movieClip 177 {
}
movieClip 186 {
frame 28 {
_parent.removeMovieClip();
}
}
movieClip 187 enemy3 {
frame 1 {
stop();
}
}
movieClip 189 {
}
// unknown tag 88 length 241
button 197 {
on (release) {
_root.gotoMenu();
}
}
button 201 {
on (release) {
_root.gotoMenu();
}
}
button 205 {
on (release) {
getURL('http://armorgames.com/', '_blank');
}
}
movieClip 207 {
frame 1 {
survived.text = 'You survived ' + _root.level + ' days.';
}
}
movieClip 208 gameOver {
frame 140 {
stop();
}
}
movieClip 209 {
}
movieClip 212 {
}
movieClip 214 {
}
movieClip 216 {
frame 1 {
dar.text = 'You have managed to survive all 15 waves and kill ' + _root.commaSnob(_root.kills) + ' bad guys.';
}
}
movieClip 218 {
}
movieClip 221 {
}
button 226 {
on (release) {
_root.gotoMenu();
}
}
movieClip 228 gameWin {
frame 1538 {
stop();
}
}
movieClip 237 {
frame 1 {
stop();
}
}
movieClip 238 {
}
movieClip 249 {
}
movieClip 256 {
}
movieClip 260 {
}
movieClip 265 {
}
movieClip 269 {
}
movieClip 271 {
}
movieClip 273 {
frame 1 {
stop();
}
}
movieClip 275 {
}
movieClip 276 {
}
movieClip 286 {
}
movieClip 287 {
frame 1 {
stop();
}
}
movieClip 290 {
}
movieClip 291 sideMessage {
}
movieClip 299 {
frame 1 {
stop();
}
}
movieClip 300 machineGun {
}
movieClip 304 {
frame 1 {
stop();
}
}
movieClip 305 turretGun {
}
movieClip 308 {
frame 1 {
stop();
}
}
movieClip 309 rocketLauncher {
}
movieClip 313 {
frame 1 {
stop();
}
}
movieClip 314 laserGun {
}
movieClip 317 {
}
movieClip 318 {
frame 40 {
stop();
}
}
button 322 {
on (release) {
_root.addWeapon(this._parent, 'turretGun', true, 1);
}
on (rollOver) {
if (_root.cStatus == 2) {
_parent.swapDepths(_root.k++);
}
}
}
button 326 {
on (release) {
_root.addWeapon(this._parent, 'machineGun', true, 1);
}
on (rollOver) {
if (_root.cStatus == 2) {
_parent.swapDepths(_root.k++);
}
}
}
button 329 {
on (release) {
_root.addWeapon(this._parent, 'boomCannon', true, 1);
}
on (rollOver) {
if (_root.cStatus == 2) {
_parent.swapDepths(_root.k++);
}
}
}
button 332 {
on (release) {
_root.addWeapon(this._parent, 'rocketLauncher', true, 1);
}
on (rollOver) {
if (_root.cStatus == 2) {
_parent.swapDepths(_root.k++);
}
}
}
button 335 {
on (release) {
_root.addWeapon(this._parent, 'laserGun', true, 1);
}
on (rollOver) {
if (_root.cStatus == 2) {
_parent.swapDepths(_root.k++);
}
}
}
movieClip 340 {
}
movieClip 341 {
frame 35 {
stop();
}
}
movieClip 342 infoBox {
}
movieClip 344 {
frame 1 {
survivalTime.text = 'Survived Day ' + (_root.level + 1);
}
}
movieClip 345 initReadyStore {
frame 180 {
_root.initStore();
this.removeMovieClip();
}
}
movieClip 347 {
frame 1 {
survivalTime.text = 'Day ' + (_root.level + 1);
}
}
movieClip 348 {
}
movieClip 349 initReadyGame {
frame 110 {
if (_root.level == 1) {
messageFrame.gotoAndStop(1);
}
if (_root.level == 2) {
messageFrame.gotoAndStop(2);
}
if (_root.level == 3) {
messageFrame.gotoAndStop(3);
}
if (_root.level > 3) {
gotoAndPlay(399);
}
}
frame 401 {
_root.initLevel(this);
}
frame 430 {
this.removeMovieClip();
}
}
movieClip 351 infoPopUp {
}
movieClip 355 message1 {
}
movieClip 359 message0 {
}
movieClip 362 message2 {
}
movieClip 365 {
}
movieClip 374 rocket {
frame 1 {
stop();
}
frame 16 {
this.removeMovieClip();
}
}
button 382 {
on (release) {
if (_root.cStatus == 2) {
_root.cStatus = 3;
_root.initReadyGame();
}
}
}
movieClip 385 {
}
button 386 {
on (release) {
_root.addElevator(true);
}
}
movieClip 387 {
}
movieClip 388 {
frame 50 {
stop();
}
}
movieClip 390 upgrade {
}
movieClip 392 {
frame 1 {
stop();
}
}
frame 3 {
var mainSong = new Sound(this);
mainSong.attachSound('mainSong');
mainSong.start(0, 99999);
fromStart = true;
}
frame 3 {
stop();
}
movieClip 398 {
}
button 400 {
on (press) {
getURL('http://www.armorgames.com', '_blank');
}
}
// unknown tag 88 length 269
// unknown tag 88 length 131
movieClip 404 {
}
movieClip 405 {
frame 1 {
gotoAndPlay(2);
}
frame 177 {
_root.play();
}
}
frame 4 {
stop();
}
// unknown tag 88 length 98
movieClip 408 {
}
movieClip 410 {
}
movieClip 412 {
}
movieClip 413 {
frame 1 {
gotoAndPlay(2);
}
frame 101 {
_root.play();
}
}
frame 5 {
function gotoMenu() {
stopAllSounds();
killSwitch();
clearBitmap();
gotoAndStop('menu');
}
function getFireRate(weap) {
return _root[weap.type + 'Stats']['level' + weap.level].fireRate;
}
function getDamage(weap) {
return _root[weap.type + 'Stats']['level' + weap.level].damage;
}
function killSwitch() {
onEnterFrame = null;
for (var v2 in _root) {
if (typeof _root[v2] == 'movieclip') {
_root[v2].removeMovieClip();
}
}
}
stop();
clearBitmap();
var turretGunStats = new Object();
turretGunStats.level1 = new Object();
turretGunStats.level1.fireRate = 10;
turretGunStats.level1.damage = 5;
turretGunStats.level2 = new Object();
turretGunStats.level2.fireRate = 10;
turretGunStats.level2.damage = 6;
turretGunStats.level3 = new Object();
turretGunStats.level3.fireRate = 9;
turretGunStats.level3.damage = 7;
turretGunStats.level4 = new Object();
turretGunStats.level4.fireRate = 9;
turretGunStats.level4.damage = 8;
turretGunStats.level5 = new Object();
turretGunStats.level5.fireRate = 8;
turretGunStats.level5.damage = 10;
var machineGunStats = new Object();
machineGunStats.level1 = new Object();
machineGunStats.level1.fireRate = 1;
machineGunStats.level1.damage = 1;
machineGunStats.level2 = new Object();
machineGunStats.level2.fireRate = 1;
machineGunStats.level2.damage = 1.1;
machineGunStats.level3 = new Object();
machineGunStats.level3.fireRate = 1;
machineGunStats.level3.damage = 1.2;
machineGunStats.level4 = new Object();
machineGunStats.level4.fireRate = 1;
machineGunStats.level4.damage = 1.3;
machineGunStats.level5 = new Object();
machineGunStats.level5.fireRate = 1;
machineGunStats.level5.damage = 1.4;
var boomCannonStats = new Object();
boomCannonStats.level1 = new Object();
boomCannonStats.level1.fireRate = 60;
boomCannonStats.level1.damage = 1;
boomCannonStats.level2 = new Object();
boomCannonStats.level2.fireRate = 60;
boomCannonStats.level2.damage = 1;
boomCannonStats.level3 = new Object();
boomCannonStats.level3.fireRate = 50;
boomCannonStats.level3.damage = 1;
boomCannonStats.level4 = new Object();
boomCannonStats.level4.fireRate = 50;
boomCannonStats.level4.damage = 1;
boomCannonStats.level5 = new Object();
boomCannonStats.level5.fireRate = 40;
boomCannonStats.level5.damage = 1;
var rocketLauncherStats = new Object();
rocketLauncherStats.level1 = new Object();
rocketLauncherStats.level1.fireRate = 60;
rocketLauncherStats.level1.damage = 10;
rocketLauncherStats.level2 = new Object();
rocketLauncherStats.level2.fireRate = 60;
rocketLauncherStats.level2.damage = 10;
rocketLauncherStats.level3 = new Object();
rocketLauncherStats.level3.fireRate = 55;
rocketLauncherStats.level3.damage = 12;
rocketLauncherStats.level4 = new Object();
rocketLauncherStats.level4.fireRate = 55;
rocketLauncherStats.level4.damage = 12;
rocketLauncherStats.level5 = new Object();
rocketLauncherStats.level5.fireRate = 50;
rocketLauncherStats.level5.damage = 14;
var laserGunStats = new Object();
laserGunStats.level1 = new Object();
laserGunStats.level1.fireRate = 80;
laserGunStats.level1.damage = 10;
laserGunStats.level2 = new Object();
laserGunStats.level2.fireRate = 80;
laserGunStats.level2.damage = 10;
laserGunStats.level3 = new Object();
laserGunStats.level3.fireRate = 70;
laserGunStats.level3.damage = 12;
laserGunStats.level4 = new Object();
laserGunStats.level4.fireRate = 70;
laserGunStats.level4.damage = 12;
laserGunStats.level5 = new Object();
laserGunStats.level5.fireRate = 60;
laserGunStats.level5.damage = 14;
var elevatorBaseCost = 1000;
var playerGunDamage = new Array(5, 10, 15, 20, 25);
var playerGunCost = new Array(10000, 20000, 30000, 40000, 50000);
var turretGunCost = new Array(100, 400, 800, 1600, 3200, 6400);
var machineGunCost = new Array(400, 800, 1600, 3200, 6400, 12800);
var boomCannonCost = new Array(1000, 2000, 4000, 8000, 16000, 32000);
var rocketLauncherCost = new Array(2000, 4000, 8000, 16000, 32000, 64000);
var laserGunCost = new Array(4000, 8000, 16000, 32000, 64000, 128000);
var elevatorCost = new Array(500, 700, 2000, 4000, 8000, 16000, 32000, 64000, 128000);
var set1 = new Array([0, 'm', 0, 0, false]);
var set2 = new Array([0, 'f', 0, 0, false]);
var set3 = new Array([0, 'm', 0, 0, true]);
var set4 = new Array([1, 's', 0, 0, false], [0, 's', 0, 0, false]);
var set5 = new Array([1, 'm', 0, 0, false]);
var set6 = new Array([1, 'f', 0, 0, false]);
var set7 = new Array([2, 'm', 0, 0, false]);
var set8 = new Array([2, 'f', 0, 0, false]);
var set9 = new Array([2, 'm', 0, 0, true]);
var set10 = new Array([2, 's', 0, 0, false], [0, 'm', 0, 0, false]);
var set11 = new Array([2, 's', 0, 0, false], [1, 'm', 0, 0, false]);
var set12 = new Array([2, 's', 0, 0, false], [1, 's', 0, 0, false], [0, 's', 0, 0, false]);
var set13 = new Array([3, 's', 0, 0, false]);
var set14 = new Array([3, 'm', 0, 0, false]);
var set15 = new Array([3, 'f', 0, 0, false]);
var set16 = new Array([3, 's', 0, 0, false], [2, 'm', 0, 0, false], [0, 'm', 0, 0, false]);
var set17 = new Array([3, 's', 0, 0, false], [2, 's', 0, 0, false], [1, 's', 0, 0, false], [0, 's', 0, 0, false]);
var set18 = new Array([3, 'm', 0, 0, false], [2, 'm', 0, 0, false], [1, 's', 0, 0, false], [0, 's', 0, 0, false]);
var set19 = new Array([3, 'm', 0, 0, false], [2, 'm', 0, 0, false], [1, 'm', 0, 0, false], [0, 'm', 0, 0, false]);
var set20 = new Array([3, 'm', 0, 0, false], [2, 'm', 0, 0, false], [1, 'f', 0, 0, false], [0, 'f', 0, 0, false]);
var set21 = new Array([3, 'f', 0, 0, false], [2, 'f', 0, 0, false], [1, 'f', 0, 0, false], [0, 'f', 0, 0, false]);
var set50 = new Array([0, 's', 0, 0, false], [0, 'm', 0, 0, false], [0, 'f', 0, 0, false]);
var set51 = new Array([1, 's', 0, 0, false], [1, 'm', 0, 0, false], [1, 'f', 0, 0, false]);
var set52 = new Array([2, 's', 0, 0, false], [2, 'm', 0, 0, false], [2, 'f', 0, 0, false]);
var set53 = new Array([3, 's', 0, 0, false], [3, 'm', 0, 0, false], [3, 'f', 0, 0, false]);
var set54 = new Array([0, 's', 0, 0, true], [0, 'm', 0, 0, true], [0, 'f', 0, 0, true]);
var set55 = new Array([1, 's', 0, 0, true], [1, 'm', 0, 0, true], [1, 'f', 0, 0, true]);
var set56 = new Array([2, 's', 0, 0, true], [2, 'm', 0, 0, true], [2, 'f', 0, 0, true]);
var set57 = new Array([3, 's', 0, 0, true], [3, 'm', 0, 0, true], [3, 'f', 0, 0, true]);
var set80 = new Array([3, 'f', 0, 0, true], [2, 'f', 0, 0, true], [1, 'f', 0, 0, true], [0, 'f', 0, 0, true]);
var act = new Array();
act.push([0, 0, 0, 1, 0, 0, 0, 5]);
act.push([0, 0, 0, 2, 0, 0, 0, 10]);
act.push([0, 1, 0, 1, 0, 0, 0, 20]);
act.push([0, 3, 0, 3, 0, 0, 0, 20]);
act.push([0, 2, 0, 4, 2, 0, 0, 25]);
act.push([0, 4, 0, 4, 6, 0, 0, 25]);
act.push([3, 7, 0, 2, 2, 0, 0, 30]);
act.push([3, 6, 0, 8, 8, 0, 0, 30]);
act.push([5, 7, 0, 3, 8, 0, 6, 35]);
act.push([4, 7, 0, 8, 14, 0, 6, 35]);
act.push([5, 4, 0, 14, 12, 13, 14, 40]);
act.push([12, 15, 0, 50, 15, 50, 14, 45]);
act.push([10, 9, 51, 12, 15, 8, 13, 50]);
act.push([14, 15, 13, 18, 52, 12, 17, 55]);
act.push([50, 21, 80, 20, 9, 8, 20, 60]);
}
button 420 {
on (release) {
nextFrame();
}
}
button 427 {
on (release) {
getURL('http://twitter.com/ArmorGames', '_blank');
}
}
movieClip 428 {
}
movieClip 429 {
frame 46 {
stop();
}
}
frame 6 {
function loadIt(mcm) {}
function pauseHandler() {
pausedGame = !pausedGame;
if (pausedGame) {
pausedGameIndicator.swapDepths(k++);
pausedGameIndicator._visible = true;
pausedGameIndicator._x = 0;
pausedGameIndicator._y = 0;
} else {
pausedGameIndicator.swapDepths(k++);
pausedGameIndicator._visible = false;
pausedGameIndicator._x = 10000;
pausedGameIndicator._y = 0;
}
}
function muteHandler() {
mute = !mute;
if (mute) {
s.setVolume(0);
} else {
s.setVolume(100);
}
}
function handleDrawArea() {
if (redrawLater) {
redrawLater = false;
} else {
drawArea.clear();
}
}
function readyElevators() {
activeFloors.splice(0, activeFloors.length);
floors.splice(0, floors.length);
i = 0;
while (i < 7) {
curNum = act[level][i];
curFloor = _root['floor' + i];
curFloor.type = curNum;
curFloor.num = Number(curFloor._name.substr(5, 1));
curFloor.floorIndicator.curNum.text = curFloor.num * level + 1;
curFloor.enemies = new Array();
j = 0;
while (j < 3) {
if (j == 0) {
curFloor['light' + j]._x = random(200) + 170;
curFloor['door' + j]._x = random(100) + 250;
curFloor['vent' + j]._x = random(100) + 250;
} else {
curFloor['light' + j]._x = curFloor['light' + (j - 1)]._x + random(200) + 50;
curFloor['door' + j]._x = curFloor['door' + (j - 1)]._x + random(200) + 50;
curFloor['vent' + j]._x = curFloor['vent' + (j - 1)]._x + random(200) + 50;
}
curFloor['light' + j].magicNumber = random(200);
curFloor['light' + j].hit = false;
curFloor['light' + j].gotoAndStop(1);
++j;
}
floors.push(curFloor);
if (curNum > 0) {
activeFloors.push(curFloor);
curFloor.floorBlock._visible = false;
} else {
curFloor.floorBlock._visible = true;
}
++i;
}
trace('ACTIVE FLOORS = ' + activeFloors.length);
}
function initLevel(fff) {
player.health = 100;
if (level < 3) {
trace('WEF');
levelMessage = attachMovie('message' + level, 'levelMessage', k++);
shaft.swapDepths(k++);
few = 0;
while (few < elevators.length) {
elevators[few].swapDepths(k++);
++few;
}
}
readyElevators();
i = 0;
while (i < elevators.length) {
elevators[i].infoBox.removeMovieClip();
++i;
}
player._visible = true;
clearBitmap();
timeCounter = 0;
up.removeMovieClip();
cStatus = 1;
dayCompleted = false;
fff.swapDepths(k++);
}
function initStore() {
levelMessage.removeMovieClip();
cStatus = 2;
++level;
player._visible = false;
attachMovie('upgrade', 'up', k++);
readyElevators();
shaft.swapDepths(k++);
i = 0;
while (i < elevators.length) {
elevators[i].attachMovie('infoBox', 'infoBox', k++);
elevators[i].swapDepths(k++);
++i;
}
}
function initReadyStore() {
if (level == 14) {
triggerWin();
} else {
cStatus = 3;
attachMovie('initReadyStore', 'initReadyStore', k++);
shaft.swapDepths(k++);
fre = 0;
while (fre < elevators.length) {
elevators[fre].swapDepths(k++);
++fre;
}
}
}
function triggerWin() {
gamePaused = true;
stopAllSounds();
cStatus = 10;
attachMovie('gameWin', 'gameWin', k++);
}
function initReadyGame() {
cStatus = 3;
attachMovie('initReadyGame', 'readyGame' + k, k++);
}
function handleMeta() {
dayDisp.text = 'DAY ' + (1 + level);
cashDisp.text = 'CASH: $' + cashSnob(cash);
killsDisp.text = commaSnob(kills) + ' KILLS';
++timeCounter;
timeGoal = act[level][7] * 50;
dayLeftBar.gotoAndStop(100 - Math.ceil(100 * (timeCounter / timeGoal)));
if (timeCounter > timeGoal) {
dayCompleted = true;
}
if (dayCompleted) {
ready = true;
i = 0;
while (i < activeFloors.length) {
if (activeFloors[i].enemies.length != 0) {
ready = false;
}
++i;
}
if (ready) {
initReadyStore();
}
}
}
function clearBitmap() {
trace('BitmapCleared!');
bmp1.fillRect(new Rectangle(0, 0, 700, 550), 4294967295.0);
}
function drawThis(mc, xP, yP, rot) {
mc.inside._rotation = rot;
var v1 = new flash.geom.Matrix();
v1.translate(xP, yP);
var v2 = new flash.geom.ColorTransform();
var v3 = 'normal';
bmp1.draw(mc, v1, v2, v3);
}
function initPlayer() {
player.xVel = 0;
player.xMax = 5;
player.xF = 0.8;
player.acc = 1;
player.health = 100;
player.healthMax = 100;
player.curElevator = elevators[0];
player.curFloor = null;
player._x = curElevator._x;
player._y = curElevator._y;
player.swapDepths(k++);
}
function handleShaft() {
shaftHealthBar.gotoAndStop(100 - Math.ceil(100 * (shaftHealth / shaftMaxHealth)));
if (cStatus != 10 && shaftHealth <= 0) {
triggerGameOver('shaft');
}
if (cStatus == 2 || cStatus == 3) {
++shaftHealth;
if (shaftHealth > shaftMaxHealth) {
shaftHealth = shaftMaxHealth;
}
}
}
function triggerGameOver(how) {
stopAllSounds();
cStatus = 10;
attachMovie('gameOver', 'gameOver', k++);
}
function handlePlayer() {
player.healthBar.gotoAndStop(100 - Math.ceil(100 * (player.health / player.healthMax)));
if (player.health < 0) {
triggerGameOver(health);
}
if (Key.isDown(37) || Key.isDown(65)) {
player.gotoAndStop(2);
player.body._xscale = -100;
player.xVel -= player.acc;
} else {
if (Key.isDown(39) || Key.isDown(68)) {
player.gotoAndStop(2);
player.body._xscale = 100;
player.xVel += player.acc;
} else {
player.gotoAndStop(1);
if (player.xVel < 0) {
player.body._xscale = -100;
} else {
player.body._xscale = 100;
}
}
}
if (player.xVel > player.xMax) {
player.xVel = player.xMax;
}
if (player.xVel < -player.xMax) {
player.xVel = -player.xMax;
}
player.xVel *= player.xF;
player._x += player.xVel;
if (player.curElevator != null) {
player._y = player.curElevator._y;
if (player._x < player.curElevator._x + 10) {
player._x = player.curElevator._x + 10;
player.xVel *= -1;
}
if (player._x > player.curElevator._x + player.curElevator._width - 10) {
if (player.curElevator.moveStage > 0) {
player._x = player.curElevator._x + player.curElevator._width - 10;
player.xVel *= -1;
} else {
trace('Now on floor ' + player.curElevator.destination);
player.curFloor = player.curElevator.destination;
player.curElevator = null;
}
}
} else {
player._y = player.curFloor._y;
if (player._x > 690) {
player._x = 690;
player.xVel *= -1;
}
if ((player.curFloor.elevator == null || player.curFloor.elevator != null && player.curFloor.elevator.moveStage != 0) && player._x < elevators[0]._x + elevators[0]._width - 10) {
player._x = elevators[0]._x + elevators[0]._width - 10;
player.xVel *= -1;
} else {
if (player._x < player.curFloor.elevator._x + player.curFloor.elevator._width - 10) {
if (player.curFloor.elevator.moveStage > 0) {
player._x = player.curElevator._x + player.curElevator._width - 10;
player.xVel *= -1;
} else {
trace('Now on elevator ' + player.curFloor.elevator);
player.curElevator = player.curFloor.elevator;
player.curFloor = null;
}
}
}
}
if (_xmouse > player._x) {
player.arm._rotation = -90;
if (player.body._xscale > 0) {
player.arm.gotoAndStop(2);
} else {
player.arm.gotoAndStop(1);
}
} else {
player.arm._rotation = 90;
if (player.body._xscale > 0) {
player.arm.gotoAndStop(2);
} else {
player.arm.gotoAndStop(1);
}
}
}
function handleEnemies() {
i = 0;
while (i < activeFloors.length) {
curFloor = activeFloors[i];
curSet = _root['set' + curFloor.type];
j = 0;
while (j < curSet.length) {
curEneCall = curSet[j];
++curEneCall[2];
if (curEneCall[2] > curEneCall[3]) {
if (curEneCall[4] == true) {
spawn(curFloor, curEneCall[0]);
spawn(curFloor, curEneCall[0]);
} else {
spawn(curFloor, curEneCall[0]);
}
curEneCall[2] = 0;
if (curEneCall[1] == 's') {
modi = 0.7;
}
if (curEneCall[1] == 'm') {
modi = 0.4;
}
if (curEneCall[1] == 'f') {
modi = 0;
}
curEneCall[3] = spawnRates[curEneCall[0]] * (Math.random() * 0.5 + 0.6 + modi);
}
++j;
}
j = 0;
while (j < curFloor.enemies.length) {
ene = curFloor.enemies[j];
if (ene._x < 110) {
ene.xVel = 0;
ene.gotoAndStop(2);
if (curFloor.elevator != null && curFloor.elevator.moveStage == 0) {
curFloor.elevator.health -= ene.damage;
curFloor.elevator.eBackground.play();
} else {
shaft.healthFlash.play();
shaftHealth -= ene.damage;
}
}
ene._x -= ene.xVel;
ene.xVel += ene.acc;
if (ene.xVel > ene.xMax) {
ene.xVel = ene.xMax;
}
ene.healthBar.gotoAndStop(100 - Math.ceil(100 * (ene.health / ene.maxHealth)));
if (ene.health <= 0) {
if (ene.type > 1) {
drawThis(splat2, ene._x + random(10) - 5, ene._y - random(ene.body._height), random(10) - 5);
} else {
drawThis(splat, ene._x + random(10) - 5, ene._y - random(ene.body._height), random(10) - 5);
}
cash += ene.bounty;
shel = attachMovie('cashFly', 'c' + k, k++);
shel._x = ene._x;
shel._y = ene._y;
shel.inside.inside.cashDisp.text = '$' + ene.bounty;
ene.gotoAndStop('explode');
curFloor.enemies.splice(j, 1);
++kills;
}
++j;
}
++i;
}
}
function handleWeapons() {
i = 0;
while (i < rockets.length) {
targetKill = false;
curRocket = rockets[i];
++curRocket.xVel;
curRocket._x += curRocket.xVel;
elasticY(curRocket, curRocket.src, 0.2, 0.2);
bb = 0;
while (bb < curRocket.flr.enemies.length) {
curEne = curRocket.flr.enemies[bb];
if (curRocket.hitTest(curEne)) {
targetX = curRocket._x;
targetY = curRocket._y;
targetSrc = curRocket.src;
curRocket.play();
curRocket._rotation = random(360);
rockets.splice(i, 1);
targetKill = true;
break;
}
++bb;
}
if (targetKill) {
bb = 0;
while (bb < curRocket.flr.enemies.length) {
curEne = curRocket.flr.enemies[bb];
if (dist(curEne._x, curEne._y, targetX, targetY) < 100) {
curEne.health -= getDamage(targetSrc);
drawThis(splat, curEne._x + random(10) - 5, curEne._y - random(curEne.body._height), random(10) - 5);
}
++bb;
}
}
++i;
}
i = 0;
while (i < elevators.length) {
curE = elevators[i];
j = 0;
while (j < curE.weapons.length) {
curW = curE.weapons[j];
curF = curE.destination;
if (curW.aCounter == null) {
curW.aCounter = random(20);
}
if (curE.moveStage == 0 && curF.enemies.length > 0) {
++curW.aCounter;
if (curW.aCounter > getFireRate(curW)) {
curW.aCounter = 0;
curW.attack.play();
if (curW.type == 'turretGun' || curW.type == 'machineGun') {
specNum = random(200);
fg = 0;
while (fg < 3) {
if (curFloor['light' + fg].magicNumber == specNum && !curFloor['light' + fg].hit) {
curFloor['light' + fg].hit = true;
curFloor['light' + fg].play();
}
++fg;
}
var v1 = findClosestEnemy(curF);
v1.health -= getDamage(curW);
drawThis(splat, v1._x + random(10) - 5, v1._y - random(v1.body._height), random(10) - 5);
}
if (curW.type == 'laserGun') {
tempDamage = getDamage(curW);
bb = 0;
while (bb < curF.enemies.length) {
curF.enemies[bb].health -= tempDamage;
++bb;
}
}
if (curW.type == 'rocketLauncher') {
fe = attachMovie('rocket', 'rocket' + k, k++);
fe._x = curW._x + 20 + curF._x;
fe._y = curW._y - 20 + curF._y;
fe.src = curW;
fe.type = 'rocketLauncher';
fe.level = curW.level;
fe.flr = curF;
fe.xVel = 5;
rockets.push(fe);
}
if (curW.type == 'boomCannon') {
bb = 0;
while (bb < curF.enemies.length) {
curF.enemies[bb].xVel -= 1;
++bb;
}
}
}
}
++j;
}
++i;
}
}
function findClosestEnemy(tempMC) {
closest = tempMC.enemies[0];
bb = 0;
while (bb < tempMC.enemies.length) {
if (tempMC.enemies[bb]._x < closest._x) {
closest = tempMC.enemies[bb];
}
++bb;
}
if (closest._x < 650) {
return closest;
} else {
return null;
}
}
function parseName(str) {
switch (str) {
case 'turretGun':
return 'Turret Gun';
case 'machineGun':
return 'Machine Gun';
case 'boomCannon':
return 'Power Blast Cannon';
case 'rocketLauncher':
return 'Rocket Launcher';
case 'laserGun':
return 'Laser Cannon';
}
}
function returnRed(str) {
return '<font color=\'#FF0000\'>' + str + '</font>';
}
function returnGray(str) {
return '<font color=\'#999999\'>' + str + '</font>';
}
function handleUpgradeScreen() {
if (cStatus == 2) {
up.survivalTime.text = 'Survived Day ' + level;
up.daysLeftDisp.text = 15 - level + ' Days Left';
up.cashDisp.text = 'Cash: $' + cashSnob(cash);
if (activeFloors.length > elevators.length) {
if (elevatorCost[elevators.length] > cash) {
up.buyEleButton._visible = false;
up.buyEle.htmlText = returnGray('Cannot afford extra elevator ($' + elevatorCost[elevators.length] + ')');
} else {
up.buyEleButton._visible = true;
up.buyEle.text = 'Buy an Additonal Elevator for $' + elevatorCost[elevators.length];
}
} else {
up.buyEleButton._visible = false;
up.buyEle.htmlText = returnGray('Cannot buy extra elevator (out of room)');
}
tempNum = 0;
i = 0;
while (i < 7) {
if (act[level][i] > 0) {
++tempNum;
}
++i;
}
if (tempNum > 1) {
up.howManyFloors.text = '(Next Level has ' + tempNum + ' Floors)';
} else {
up.howManyFloors.text = '(Next Level has ' + tempNum + ' Floor)';
}
foundSomething = false;
}
foundSomethings = false;
i = 0;
while (i < elevators.length) {
curE = elevators[i];
if (cStatus == 2) {
j = 0;
while (j < weaponNames.length) {
curName = weaponNames[j];
tempCost = _root[curName + 'Cost'][0];
if (tempCost > cash) {
curE.infoBox[curName + 'Cost'].htmlText = returnGray('$' + tempCost);
} else {
curE.infoBox[curName + 'Cost'].text = '$' + tempCost;
}
++j;
}
}
if (cStatus == 1 || cStatus == 2) {
j = 0;
while (j < curE.weapons.length) {
curWeapon = curE.weapons[j];
if (curWeapon.hitTest(_xmouse, _ymouse)) {
uro._x = _xmouse;
uro._y = _ymouse;
uro.infoT.text = 'Level ' + curWeapon.level + ' ' + parseName(curWeapon.type);
if (Key.isDown(16)) {
tempNum = _root[curWeapon.type + 'Cost'][0];
va = 1;
while (va < curWeapon.level) {
tempNum += _root[curWeapon.type + 'Cost'][curWeapon.level - 1];
++va;
}
uro.subTotal = tempNum / 2;
uro.upgradeT.htmlText = returnRed('Click to Sell for $' + cashSnob(uro.subTotal));
} else {
if (curWeapon.level < 5) {
thisAmount = _root[curWeapon.type + 'Cost'][curWeapon.level];
if (thisAmount <= cash) {
uro.upgradeT.text = 'Click to Upgrade for $' + cashSnob(thisAmount);
} else {
uro.upgradeT.htmlText = returnGray('Cannot Afford Upgrade ($' + cashSnob(thisAmount) + ')');
}
} else {
uro.upgradeT.htmlText = returnGray('Fully upgraded');
}
}
uro.curWeapon = curWeapon;
uro.upgradeAmount = _root[curWeapon.type + 'Cost'][curWeapon.level];
weaponIndicator.swapDepths(k++);
uro.swapDepths(k++);
v = 0;
while (v < 5) {
uro['n' + v].gotoAndStop(1);
++v;
}
v = 0;
while (v < curWeapon.level) {
uro['n' + v].gotoAndStop(2);
++v;
}
weaponIndicator._visible = true;
weaponIndicator._x = curWeapon._x + curE._x;
weaponIndicator._y = curWeapon._y + curE._y;
foundSomethings = true;
}
++j;
}
}
++i;
}
if (!foundSomethings || cStatus == 3) {
uro._y = -1000;
weaponIndicator._visible = false;
}
}
function spawn(ele, type) {
if (dayCompleted) {
return undefined;
}
mov = attachMovie('enemy' + type, 'e' + k, k++);
mov._x = 750 + random(50);
mov._y = ele._y;
mov.type = type;
if (type == 0 || type == 's') {
mov.xMax = 2;
mov.xVel = mov.xMax;
mov.yVel = 0;
mov.acc = 0.1;
mov.health = 20;
mov.maxHealth = mov.health;
mov.damage = 0.05;
mov.bounty = 25;
}
if (type == 1 || type == 'm') {
mov.xMax = 1;
mov.xVel = mov.xMax;
mov.yVel = 0;
mov.acc = 0.1;
mov.health = 50;
mov.maxHealth = mov.health;
mov.damage = 0.07000000000000001;
mov.bounty = 50;
}
if (type == 2 || type == 'l') {
mov.xMax = 0.5;
mov.xVel = mov.xMax;
mov.yVel = 0;
mov.acc = 0.1;
mov.health = 100;
mov.maxHealth = mov.health;
mov.damage = 0.1;
mov.bounty = 100;
}
if (type == 3 || type == 'xl') {
mov.xMax = 0.25;
mov.xVel = mov.xMax;
mov.yVel = 0;
mov.acc = 0.1;
mov.health = 200;
mov.maxHealth = mov.health;
mov.damage = 0.2;
mov.bounty = 250;
}
ele.enemies.push(mov);
}
function handleElevators() {
j = 0;
while (j < elevators.length) {
curE = elevators[j];
curE.healthBar.gotoAndStop(100 - Math.ceil(100 * (curE.health / 100)));
if (cStatus == 2 || cStatus == 3) {
++curE.health;
if (curE.health > 100) {
curE.health = 100;
}
}
if (curE.health <= 0 && curE.moveStage != -1) {
curE.dead = true;
curE.moveStage = -1;
curE.yVel = 0;
eleSound.start(0, 1);
trace(curE.destination.elevator);
curE.destination.elevator = null;
trace(curE.destination.elevator);
curE.moveE = false;
}
if (curE.moveStage == -1) {
curE.yVel += 1;
curE._y += curE.yVel;
if (curE._y > 600) {
if (player.curElevator == curE) {
triggerGameOver('shaft');
}
curE.removeMovieClip();
elevators.splice(j, 1);
trace('removeElevator!');
}
}
if (curE.moveE) {
copy._y = _ymouse;
i = 0;
while (i < activeFloors.length) {
if (activeFloors[i].hitTest(copy._x, copy._y)) {
copy.floorDisp.text = 'L' + (1 + activeFloors[i].num);
copy._y = activeFloors[i]._y;
copy.curTarget = activeFloors[i];
if (copy.curTarget.elevator != null) {
if (copy.curTarget.elevator == curE) {
resetColour(copy);
} else {
if (copy.curTarget.elevator.moveStage != 0) {
setColour(copy, 255, 0, 0, 50);
}
}
} else {
resetColour(copy);
copy._alpha = 50;
}
}
++i;
}
} else {
if (curE.moveStage == 1) {
if (curE.door._currentframe == 10) {
curE.moveStage = 2;
curE.typeCounter = 0;
}
}
if (curE.moveStage == 2) {
elasticY(curE, curE.destination._y, 0.5, 0.4);
if (Math.abs(curE._y - curE.destination._y) < 1) {
++curE.typeCounter;
if (curE.typeCounter > 10) {
curE.moveStage = 3;
curE._y = curE.destination._y;
curE.door.play();
dingSound.start(0, 1);
openSound.start(0, 1);
}
}
}
if (curE.moveStage == 3) {
if (curE.door._currentframe == 1) {
curE.moveStage = 0;
curE.ready = true;
}
}
}
++j;
}
}
function playerShoot(fromMouseDown) {
if (myMouseDown) {
--gunCounter;
}
if (cStatus == 1 && gunCounter < 0) {
gunCounter = 8;
angl = (180 + rotateTo(player._x, player._y, _xmouse, _ymouse)) * 0.0174532925199433;
shell = attachMovie('bulletTrail', 'bulletTrail' + k, k++);
shell._x = player._x + player.arm._x - 1 * Math.cos(angl);
shell._y = player._y + player.arm._y - 1 * Math.sin(angl);
shell._rotation = player.arm._rotation + 90;
player.arm.gun.gotoAndPlay(2);
flr = null;
if (player.curFloor != null) {
flr = player.curFloor;
}
if (player.curElevator != null && player.curElevator.moveStage == 0) {
flr = player.curElevator.destination;
}
if (flr != null) {
closest = null;
shortDist = 100000;
jj = 0;
while (jj < flr.enemies.length) {
curEnemy = flr.enemies[jj];
tempD = curEnemy._x - player._x;
if (Math.abs(tempD) < shortDist) {
if (curEnemy.hitTest(shell) && (tempD < 0 && player.arm._rotation == 90 || tempD > 0 && player.arm._rotation == -90)) {
shortDist = Math.abs(tempD);
closest = curEnemy;
}
}
++jj;
}
if (closest != null) {
redrawLater = true;
drawArea.lineStyle(2, 0, 100);
drawArea.moveTo(shell._x, shell._y);
drawArea.lineTo(closest._x, closest._y - random(closest._height));
shell.removeMovieClip();
closest.health -= playerGunDamage[gunLevel];
drawThis(splat, closest._x + random(10) - 5, closest._y - random(closest.body._height), random(10) - 5);
} else {
jj = 0;
while (jj < 3) {
++jj;
}
}
}
}
}
function removeWeapon(curEle, weap) {
ff = 0;
while (ff < curEle.weapons.length) {
if (curEle.weapons[ff] == weap) {
curEle.weapons.splice(ff, 1);
weap.removeMovieClip();
break;
}
++ff;
}
arrangeWeapons(curEle);
}
function addElevator(atCost) {
if (atCost) {
if (cash >= elevatorCost[elevators.length]) {
cash -= elevatorCost[elevators.length];
} else {}
}
mov = attachMovie('Elevator', 'ele' + k, k++);
mov.moveE = false;
mov.num = floorCounter++;
mov.numberSpace.disp.text = mov.num;
mov.active = true;
mov.typeCounter = 0;
mov.moveStage = 2;
mov.health = 100;
mov.door.gotoAndStop(10);
f = 0;
while (f < activeFloors.length) {
if (activeFloors[f].elevator == null) {
mov.destination = activeFloors[f];
activeFloors[f].elevator = mov;
break;
}
++f;
}
mov._x = shaft._x;
mov._y = -100;
mov.weapons = new Array();
loadIt(mov);
if (atCost) {
mov.attachMovie('infoBox', 'infoBox', k++);
}
elevators.push(mov);
}
function addWeapon(elev, typeOf, toCharge, lev) {
if (elev.weapons.length == 3) {
trace('NO WAY');
return undefined;
}
if (toCharge) {
costArr = _root[typeOf + 'Cost'];
thisCost = costArr[0];
if (thisCost > cash) {
return undefined;
} else {
cash -= thisCost;
}
}
nW = elev.attachMovie(typeOf, typeOf + k, k++);
nW.type = typeOf;
nW.level = lev;
nW.elevator = elev;
nW.numberSpace.disp.text = nW.level;
elev.weapons.push(nW);
arrangeWeapons(elev);
}
function arrangeWeapons(ele) {
t = 0;
while (t < ele.weapons.length) {
ele.weapons[t]._x = ele['wLoc' + t]._x;
ele.weapons[t]._y = ele['wLoc' + t]._y;
ele.weapons[t]._xscale = ele['wLoc' + t]._xscale;
ele.weapons[t]._yscale = ele['wLoc' + t]._yscale;
if (t == 3) {
ele.weapons[t]._rotation = 180;
ele.weapons[t]._xscale = -100;
ele.weapons[t].numberSpace._xscale = -100;
} else {
ele.weapons[t]._rotation = 0;
ele.weapons[t]._yscale = ele['wLoc' + t]._yscale;
}
++t;
}
}
function getFloorType(num) {
return act[level][num];
}
function cashSnob(num) {
if (num == Math.floor(num)) {
return commaSnob(num) + '.00';
} else {
if (Math.floor((num - Math.floor(num)) * 100) == 0) {
return commaSnob(Math.floor(num)) + '.' + Math.floor((num - Math.floor(num)) * 100) + '0';
} else {
return commaSnob(Math.floor(num)) + '.' + Math.floor((num - Math.floor(num)) * 100);
}
}
}
function dist(x1, y1, x2, y2) {
return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
function commaSnob(num) {
if (num < 1000) {
return String(num);
}
var v3 = (String(num)).length;
var v4 = new Array();
var v1 = 0;
while (v1 < v3) {
v4.push((String(num)).charAt(v3 - 1 - v1));
++v1;
}
var v2 = new String();
v1 = 0;
while (v1 < v3) {
if (v1 % 3 == 0 && v1 != 0) {
v2 = v4[v1] + ',' + v2;
} else {
v2 = v4[v1] + v2;
}
++v1;
}
return v2;
}
function setMCColour(mc, c) {
altColor = new Color(mc);
altColor.setRGB(c);
}
function setColour(mc, rC, gC, bC, aC) {
var v2 = new flash.geom.ColorTransform(rC / 255, gC / 255, bC / 255, aC / 100, 0, 0, 0, 0);
var v1 = new flash.geom.Transform(mc);
v1.colorTransform = v2;
}
function resetColour(mc) {
var v2 = new flash.geom.ColorTransform();
var v3 = new flash.geom.Transform(mc);
mc.transform.colorTransform = new flash.geom.ColorTransform();
}
function rotateTo(x1, y1, x2, y2) {
return -Math.atan2(x2 - x1, y2 - y1) * 180 / Math.PI;
}
function drawCircle(mc, x, y, r) {
mc.moveTo(x + r, y);
mc.curveTo(r + x, 0.4142135623730951 * r + y, Math.SQRT1_2 * r + x, Math.SQRT1_2 * r + y);
mc.curveTo(0.4142135623730951 * r + x, r + y, x, r + y);
mc.curveTo(-0.4142135623730951 * r + x, r + y, -Math.SQRT1_2 * r + x, Math.SQRT1_2 * r + y);
mc.curveTo(-r + x, 0.4142135623730951 * r + y, -r + x, y);
mc.curveTo(-r + x, -0.4142135623730951 * r + y, -Math.SQRT1_2 * r + x, -Math.SQRT1_2 * r + y);
mc.curveTo(-0.4142135623730951 * r + x, -r + y, x, -r + y);
mc.curveTo(0.4142135623730951 * r + x, -r + y, Math.SQRT1_2 * r + x, -Math.SQRT1_2 * r + y);
mc.curveTo(r + x, -0.4142135623730951 * r + y, r + x, y);
}
function elasticX(mc, targt, accel, friction) {
if (mc.qxSpeed == undefined) {
mc.qxSpeed = 0;
}
mc.qxSpeed += (targt - mc._x) * accel;
mc.qxSpeed *= friction;
mc._x += mc.qxSpeed;
}
function elasticY(mc, targt, accel, friction) {
if (mc.qySpeed == undefined) {
mc.qySpeed = 0;
}
mc.qySpeed += (targt - mc._y) * accel;
mc.qySpeed *= friction;
mc._y += mc.qySpeed;
}
if (fromStart) {
fromStart = false;
} else {
mainSong.start(0, 999999);
}
var level = 0;
var numEle = 1;
var cStatus = 1;
var cash = 0;
var k = 1;
var bmp1 = new flash.display.BitmapData(700, 550, false, 16777215);
bitmapArea.attachBitmap(bmp1, k++);
var dingSound = new Sound(this);
dingSound.attachSound('elevatorDing');
var openSound = new Sound(this);
openSound.attachSound('openSound');
var closeSound = new Sound(this);
closeSound.attachSound('closeSound');
var eleSound = new Sound(this);
eleSound.attachSound('eleSound');
var elevators = new Array();
var floors = new Array();
var activeFloors = new Array();
var rockets = new Array();
var floorCounter = 1;
var sE = elevators[0];
var shaftHealth = 500;
var shaftMaxHealth = shaftHealth;
var gunLevel = 0;
var gunCounter = 0;
var kills = 0;
var redrawLater = false;
var weaponNames = new Array('turretGun', 'machineGun', 'boomCannon', 'rocketLauncher', 'laserGun');
onEnterFrame = function () {
if (!pausedGame) {
handleDrawArea();
handleElevators();
handleShaft();
if (cStatus == 1) {
handlePlayer();
handleEnemies();
handleWeapons();
handleMeta();
playerShoot(false);
}
}
if (cStatus == 2) {
handleUpgradeScreen();
uro._visible = true;
} else {
uro._visible = false;
}
if (cStatus == 1) {
player.swapDepths(k++);
}
if (cStatus == 10) {
pausedGame = true;
gameOver.swapDepths(k++);
}
};
var timeCounter = 0;
var dayCompleted = false;
var timeGoal = 0;
var mute = false;
var pausedGame = false;
var s = new Sound(this);
var spawnRates = new Array(30, 40, 50, 60, 70);
onMouseDown = function () {
myMouseDown = true;
gunCounter = 0;
if (cStatus == 2 || cStatus == 1) {
if (uro.curWeapon.hitTest(_xmouse, _ymouse)) {
if (Key.isDown(16)) {
tempElev = uro.curWeapon.elevator;
removeWeapon(tempElev, uro.curWeapon);
cash += uro.subTotal;
return undefined;
} else {
if (uro.curWeapon.level < 5) {
if (uro.upgradeAmount <= cash) {
++uro.curWeapon.level;
cash -= uro.upgradeAmount;
uro.curWeapon.numberSpace.disp.text = uro.curWeapon.level;
}
return undefined;
}
}
}
}
r = 0;
while (r < elevators.length) {
cur = elevators[r];
if (cStatus == 1) {
if (cur.hitA.hitTest(_xmouse, _ymouse) && cur.moveStage == 0) {
cur.swapDepths(k++);
player.swapDepths(k++);
copy = attachMovie('ElevatorShade', 'copy', k++);
copy._x = cur._x;
copy._y = cur._y;
copy._alpha = 50;
copy.targetElevator = cur;
startDrag(copy, false, copy._x, 0, copy._x, 550);
setMCColour(copy, 16777215);
cur.moveE = true;
return undefined;
}
}
++r;
}
};
onMouseUp = function () {
myMouseDown = false;
r = 0;
while (r < elevators.length) {
cur = elevators[r];
if (cur.moveE) {
if (copy.curTarget.elevator == null) {
cur.moveStage = 1;
cur.ready = false;
cur.destination.elevator = null;
cur.destination = copy.curTarget;
copy.curTarget.elevator = cur;
closeSound.start(0, 1);
cur.door.play();
} else {
if (copy.curTarget.elevator.moveStage == 0) {
other = copy.curTarget.elevator;
closeSound.start(0, 1);
trace(other);
trace(cur);
other.swapDepths(k++);
cur.swapDepths(k++);
other.moveStage = 1;
cur.moveStage = 1;
other.ready = false;
cur.ready = false;
tempEle = other.destination.elevator;
other.destination.elevator = cur.destination.elevator;
cur.destination.elevator = tempEle;
other.destination = cur.destination;
cur.destination = copy.curTarget;
copy.curTarget.elevator = cur;
cur.door.play();
other.door.play();
}
}
copy.stopDrag();
copy.removeMovieClip();
}
cur.moveE = false;
++r;
}
};
initLevel();
i = 0;
while (i < numEle) {
addElevator(false);
++i;
}
initPlayer();
stop();
}
movieClip 430 {
}
movieClip 436 {
}
movieClip 438 {
}
movieClip 442 {
}
movieClip 446 {
frame 1 {
stop();
}
frame 30 {
stop();
}
}
movieClip 448 {
}
movieClip 450 {
}
movieClip 451 {
}
movieClip 458 {
frame 1 {
stop();
}
}
movieClip 459 {
}
movieClip 477 {
frame 1 {
onEnterFrame = function () {
col = new Color(this);
switch (random(5)) {
case 0:
col.setRGB(16711680);
break;
case 1:
col.setRGB(13369344);
break;
case 2:
col.setRGB(14483456);
break;
case 3:
col.setRGB(16711680);
break;
case 4:
col.setRGB(10027008);
}
};
}
}
movieClip 478 {
}
movieClip 491 {
frame 1 {
onEnterFrame = function () {
col = new Color(this);
switch (random(5)) {
case 0:
col.setRGB(16711680);
break;
case 1:
col.setRGB(13369344);
break;
case 2:
col.setRGB(14483456);
break;
case 3:
col.setRGB(16711680);
break;
case 4:
col.setRGB(10027008);
}
};
}
}
movieClip 492 {
}
button 496 {
on (release) {
_root.muteHandler();
}
}
button 500 {
on (release) {
pauseHandler();
}
}
button 504 {
on (release) {
gotoMenu();
}
}
movieClip 508 {
frame 1 {
stop();
}
}
movieClip 512 {
}
movieClip 513 {
}
movieClip 518 {
}