Frame 1
stop();
var gameWidth = 600;
var gameHeight = 390;
var iProgress;
var levelData = new Array();
var xml = new XML();
xml.ignoreWhite = true;
xml.parseXML("<levels><level level=\"1\" bonus=\"35\" spawnTime=\"40\" koodos=\"2\" message=\"Uppity Canucks and their hoity-toity manners! Send 'em packin'!\"><enemy type=\"1\" amount=\"10\" spawnTime=\"40\"/></level><level level=\"2\" bonus=\"35\" spawnTime=\"40\" koodos=\"2\" message=\"Be sure to place towers near bends to get the most bang for your buck.\"><enemy type=\"1\" amount=\"20\" spawnTime=\"40\"/></level><level level=\"3\" bonus=\"35\" spawnTime=\"40\" koodos=\"2\" message=\"Beaver meat is similar in flavor to lean beef.\"><enemy type=\"1\" amount=\"10\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"5\" spawnTime=\"27\"/><enemy type=\"1\" amount=\"10\" spawnTime=\"40\"/></level><level level=\"4\" bonus=\"40\" spawnTime=\"40\" koodos=\"2\" message=\"I know by now you're itchin' to buy some nukes. Do yourself a favor and wait.\"><enemy type=\"2\" amount=\"5\" spawnTime=\"27\"/><enemy type=\"1\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"5\" spawnTime=\"27\"/><enemy type=\"1\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"5\" spawnTime=\"27\"/></level><level level=\"5\" bonus=\"40\" spawnTime=\"40\" koodos=\"2\" message=\"Try upgrading towers before you buy new ones.\"><enemy type=\"1\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"13\" spawnTime=\"27\"/></level><level level=\"6\" bonus=\"40\" spawnTime=\"40\" koodos=\"2\" message=\"I imagine you could get pretty far from just the arrow and grenade towers alone...\"><enemy type=\"2\" amount=\"25\" spawnTime=\"27\"/></level><level level=\"7\" bonus=\"40\" spawnTime=\"40\" koodos=\"2\" message=\"The name "Canada" comes from an Iroquois word, "kanata," meaning "village."\"><enemy type=\"1\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"10\" spawnTime=\"27\"/><enemy type=\"3\" amount=\"8\" spawnTime=\"30\"/></level><level level=\"8\" bonus=\"45\" spawnTime=\"40\" koodos=\"2\" message=\"Some air towers might prove useful soon.\"><enemy type=\"2\" amount=\"8\" spawnTime=\"27\"/><enemy type=\"3\" amount=\"8\" spawnTime=\"30\"/><enemy type=\"2\" amount=\"8\" spawnTime=\"27\"/><enemy type=\"3\" amount=\"8\" spawnTime=\"30\"/></level><level level=\"9\" bonus=\"50\" spawnTime=\"40\" koodos=\"2\" message=\"Keep your eyes on the skies!\"><enemy type=\"9\" amount=\"7\" spawnTime=\"35\"/></level><level level=\"10\" bonus=\"60\" spawnTime=\"40\" koodos=\"2\" message=\"Something's coming... something... BIG!\"><enemy type=\"11\" amount=\"1\" spawnTime=\"40\"/></level><level level=\"11\" bonus=\"40\" spawnTime=\"40\" koodos=\"3\" message=\"Alex Trebek has been the host of jeopardy since 1984.\"><enemy type=\"2\" amount=\"20\" spawnTime=\"30\"/><enemy type=\"3\" amount=\"20\" spawnTime=\"30\"/></level><level level=\"12\" bonus=\"40\" spawnTime=\"40\" koodos=\"3\" message=\"Beavers\u2019 teeth continue to grow if they don\u2019t use them to mow down trees.\"><enemy type=\"4\" amount=\"10\" spawnTime=\"40\"/><enemy type=\"3\" amount=\"33\" spawnTime=\"30\"/></level><level level=\"13\" bonus=\"40\" spawnTime=\"40\" koodos=\"3\" message=\"Baby moose are also called "mooselings"\"><enemy type=\"5\" amount=\"27\" spawnTime=\"25\"/></level><level level=\"14\" bonus=\"45\" spawnTime=\"40\" koodos=\"3\" message=\"Robert Goulet called Canada home long before he moved to Vegas!\"><enemy type=\"4\" amount=\"12\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"12\" spawnTime=\"25\"/></level><level level=\"15\" bonus=\"45\" spawnTime=\"40\" koodos=\"3\" message=\"A Canadian, Wilbur Franks, invented an anti-gravity suit.\"><enemy type=\"6\" amount=\"17\" spawnTime=\"40\"/></level><level level=\"16\" bonus=\"50\" spawnTime=\"40\" koodos=\"3\" message=\"The zipper was invented by a Canadian.\"><enemy type=\"4\" amount=\"13\" spawnTime=\"40\"/><enemy type=\"6\" amount=\"10\" spawnTime=\"40\"/></level><level level=\"17\" bonus=\"50\" spawnTime=\"40\" koodos=\"3\" message=\"Canadians are a fierce, warlike people who eat their young. No seriously, they\u2019re nice.\"><enemy type=\"6\" amount=\"11\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"10\" spawnTime=\"25\"/></level><level level=\"18\" bonus=\"50\" spawnTime=\"40\" koodos=\"3\" message=\"There are 10 provinces and 3 territories that comprise the federation of Canada.\"><enemy type=\"9\" amount=\"5\" spawnTime=\"30\"/><enemy type=\"10\" amount=\"8\" spawnTime=\"30\"/></level><level level=\"19\" bonus=\"55\" spawnTime=\"40\" koodos=\"3\" message=\"Before moving to Beverly Hills 90210, Jason Priestly lived in Canada.\"><enemy type=\"7\" amount=\"15\" spawnTime=\"40\"/></level><level level=\"20\" bonus=\"90\" spawnTime=\"40\" koodos=\"3\" message=\"Canada is a constitutional monarchy.\"><enemy type=\"12\" amount=\"1\" spawnTime=\"40\"/></level><level level=\"21\" bonus=\"50\" spawnTime=\"40\" koodos=\"4\" message=\"Pam Anderson has been married to Tommy Lee, Kid Rock, and Rick Saloman.\"><enemy type=\"7\" amount=\"17\" spawnTime=\"40\"/></level><level level=\"22\" bonus=\"50\" spawnTime=\"40\" koodos=\"4\" message=\"Canada has two national languages: French and English.\"><enemy type=\"7\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"8\" amount=\"5\" spawnTime=\"30\"/></level><level level=\"23\" bonus=\"50\" spawnTime=\"40\" koodos=\"4\" message=\"Some Canadian Geese in the Pacific Northwest region have stopped migrating altogether.\"><enemy type=\"7\" amount=\"8\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"15\" spawnTime=\"25\"/><enemy type=\"6\" amount=\"8\" spawnTime=\"40\"/></level><level level=\"24\" bonus=\"60\" spawnTime=\"40\" koodos=\"4\" message=\"Be careful of out of control defense spending, you might need the money later.\"><enemy type=\"4\" amount=\"50\" spawnTime=\"50\"/></level><level level=\"25\" bonus=\"60\" spawnTime=\"40\" koodos=\"4\" message=\"SCTV alums include John Candy, Katherine O\u2019Hara, Eugene Levy, Rick Moranis and Dave Thomas.\"><enemy type=\"8\" amount=\"10\" spawnTime=\"30\"/><enemy type=\"5\" amount=\"16\" spawnTime=\"25\"/></level><level level=\"26\" bonus=\"60\" spawnTime=\"40\" koodos=\"4\" message=\"The hockey goalie mask was invented by a candian who was apparently concerned about his beautiful face.\"><enemy type=\"9\" amount=\"8\" spawnTime=\"30\"/><enemy type=\"10\" amount=\"12\" spawnTime=\"30\"/></level><level level=\"27\" bonus=\"70\" spawnTime=\"40\" koodos=\"4\" message=\"Real Canadian bacon is actually called "peameal bacon" and is rolled in corn meal.\"><enemy type=\"6\" amount=\"37\" spawnTime=\"40\"/></level><level level=\"28\" bonus=\"70\" spawnTime=\"40\" koodos=\"4\" message=\"Curling has it\u2019s origins of Scotland... just like golf!\"><enemy type=\"6\" amount=\"10\" spawnTime=\"40\"/><enemy type=\"7\" amount=\"10\" spawnTime=\"40\"/><enemy type=\"8\" amount=\"7\" spawnTime=\"30\"/></level><level level=\"29\" bonus=\"80\" spawnTime=\"40\" koodos=\"4\" message=\"The Bloc Quebecois is a political party in Canada that wants sovereignty for the province of Quebec.\"><enemy type=\"1\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"5\" spawnTime=\"30\"/><enemy type=\"3\" amount=\"5\" spawnTime=\"30\"/><enemy type=\"4\" amount=\"5\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"10\" spawnTime=\"25\"/><enemy type=\"6\" amount=\"4\" spawnTime=\"40\"/><enemy type=\"7\" amount=\"4\" spawnTime=\"40\"/></level><level level=\"30\" bonus=\"110\" spawnTime=\"40\" koodos=\"4\" message=\"Fun Fact: In 2007, the Canadian dollar out-valued the US dollar! Thanks, President Bush!\"><enemy type=\"13\" amount=\"1\" spawnTime=\"40\"/></level><level level=\"31\" bonus=\"75\" spawnTime=\"40\" koodos=\"5\" message=\"Bryan Adams is most famous for "Summer of 69" and other lame power ballads.\"><enemy type=\"8\" amount=\"12\" spawnTime=\"30\"/><enemy type=\"5\" amount=\"20\" spawnTime=\"25\"/></level><level level=\"32\" bonus=\"75\" spawnTime=\"40\" koodos=\"5\" message=\"Tommy Chong isn\u2019t Chinese! He\u2019s actually... a Canadian!\"><enemy type=\"6\" amount=\"15\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"20\" spawnTime=\"25\"/></level><level level=\"33\" bonus=\"85\" spawnTime=\"40\" koodos=\"5\" message=\"The Canadian anthem, "O Canada", is written in English and French.\"><enemy type=\"9\" amount=\"6\" spawnTime=\"30\"/><enemy type=\"10\" amount=\"15\" spawnTime=\"30\"/><enemy type=\"9\" amount=\"6\" spawnTime=\"30\"/><enemy type=\"10\" amount=\"10\" spawnTime=\"30\"/></level><level level=\"34\" bonus=\"85\" spawnTime=\"40\" koodos=\"5\" message=\"If you use a nuke, be sure to lead the target a bit: rocket science isn\u2019t an exact science.\"><enemy type=\"8\" amount=\"25\" spawnTime=\"30\"/></level><level level=\"35\" bonus=\"85\" spawnTime=\"40\" koodos=\"5\" message=\"Beaver fur was used in the making of felt.\"><enemy type=\"7\" amount=\"20\" spawnTime=\"40\"/></level><level level=\"36\" bonus=\"95\" spawnTime=\"40\" koodos=\"5\" message=\"Sometimes building towers as decoys can be useful.\"><enemy type=\"7\" amount=\"15\" spawnTime=\"40\"/><enemy type=\"6\" amount=\"15\" spawnTime=\"40\"/></level><level level=\"37\" bonus=\"95\" spawnTime=\"40\" koodos=\"5\" message=\"The guards at Buckingham Palace wear hats made of Canadian black bear fur.\"><enemy type=\"4\" amount=\"20\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"15\" spawnTime=\"25\"/><enemy type=\"6\" amount=\"8\" spawnTime=\"40\"/><enemy type=\"7\" amount=\"8\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"8\" spawnTime=\"25\"/></level><level level=\"38\" bonus=\"100\" spawnTime=\"40\" koodos=\"5\" message=\"Beaver testicles are used as a pain reliever by the Inuits.\"><enemy type=\"7\" amount=\"15\" spawnTime=\"40\"/><enemy type=\"8\" amount=\"15\" spawnTime=\"30\"/></level><level level=\"39\" bonus=\"100\" spawnTime=\"40\" koodos=\"5\" message=\"Hockey is the most popular sport in Canada.\"><enemy type=\"6\" amount=\"30\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"10\" spawnTime=\"40\"/></level><level level=\"40\" bonus=\"120\" spawnTime=\"40\" koodos=\"5\" message=\"Increased range is good when enemies are coming towards your towers, not so much once they\u2019ve gotten past. Keep some low ranges to soften up the guys in back.\"><enemy type=\"14\" amount=\"1\" spawnTime=\"40\"/></level><level level=\"41\" bonus=\"75\" spawnTime=\"40\" koodos=\"6\" message=\"Marshall McLuhan coined the term "The medium is the message."\"><enemy type=\"7\" amount=\"25\" spawnTime=\"40\"/><enemy type=\"3\" amount=\"15\" spawnTime=\"30\"/></level><level level=\"42\" bonus=\"75\" spawnTime=\"40\" koodos=\"6\" message=\""The Kids in the Hall" was produced by SNL\u2019s Lorne Michaels\"><enemy type=\"7\" amount=\"20\" spawnTime=\"40\"/><enemy type=\"8\" amount=\"15\" spawnTime=\"30\"/><enemy type=\"5\" amount=\"10\" spawnTime=\"30\"/></level><level level=\"43\" bonus=\"80\" spawnTime=\"40\" koodos=\"6\" message=\"Labatt, Molson, and Sleeman are the three largest brewers of beer in Canada. I guess Elsinore must be the fourth largest.\"><enemy type=\"7\" amount=\"20\" spawnTime=\"40\"/><enemy type=\"8\" amount=\"20\" spawnTime=\"30\"/></level><level level=\"44\" bonus=\"80\" spawnTime=\"40\" koodos=\"6\" message=\""Great White North" was hosted by Bob and Doug McKenzie\"><enemy type=\"5\" amount=\"10\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"10\" spawnTime=\"30\"/><enemy type=\"5\" amount=\"10\" spawnTime=\"40\"/><enemy type=\"2\" amount=\"15\" spawnTime=\"30\"/><enemy type=\"5\" amount=\"15\" spawnTime=\"30\"/></level><level level=\"45\" bonus=\"85\" spawnTime=\"40\" koodos=\"6\" message=\"Beavers are closely related to squirrels!\"><enemy type=\"9\" amount=\"20\" spawnTime=\"30\"/><enemy type=\"10\" amount=\"20\" spawnTime=\"30\"/></level><level level=\"46\" bonus=\"85\" spawnTime=\"40\" koodos=\"6\" message=\"The Roadhouse is handy when placed closer to the Canadian side. Be careful of enemies that shoot though!\"><enemy type=\"8\" amount=\"50\" spawnTime=\"40\"/></level><level level=\"47\" bonus=\"90\" spawnTime=\"40\" koodos=\"6\" message=\"William Shatner performs Shakespeare with a flawless Canadian accent, eh!\"><enemy type=\"7\" amount=\"20\" spawnTime=\"40\"/><enemy type=\"6\" amount=\"20\" spawnTime=\"40\"/><enemy type=\"5\" amount=\"10\" spawnTime=\"30\"/></level><level level=\"48\" bonus=\"90\" spawnTime=\"40\" koodos=\"6\" message=\"Canadians consume more macaroni and cheese than any other nation.\"><enemy type=\"5\" amount=\"45\" spawnTime=\"30\"/></level><level level=\"49\" bonus=\"90\" spawnTime=\"40\" koodos=\"6\" message=\"Okay, you might want those nukes now!\"><enemy type=\"4\" amount=\"15\" spawnTime=\"50\"/><enemy type=\"5\" amount=\"20\" spawnTime=\"30\"/><enemy type=\"8\" amount=\"20\" spawnTime=\"30\"/><enemy type=\"7\" amount=\"30\" spawnTime=\"40\"/></level><level level=\"50\" bonus=\"140\" spawnTime=\"40\" koodos=\"6\" message=\"Celine Dion is most famous for her contribution to the Titanic score.\"><enemy type=\"15\" amount=\"1\" spawnTime=\"40\"/></level></levels>");
levelData = xml.firstChild.childNodes;
setTimeout(function () {
play();
}, 2000);
Frame 2
stop();
var difficulty = "medium";
var useSavedGame = false;
loadGame._visible = false;
var so = SharedObject.getLocal("icsnaBorderDefense");
if (so.data.phase != undefined) {
loadGame._visible = true;
}
loadGame.gotoAndStop(1);
loadGame.onRollOver = function () {
this.gotoAndStop(2);
};
loadGame.onRollOut = (loadGame.onDragOut = function () {
this.gotoAndStop(1);
});
loadGame.onRelease = function () {
difficulty = so.data.difficulty;
useSavedGame = true;
gotoAndStop ("game");
};
easy.gotoAndStop(1);
easy.onRollOver = function () {
this.gotoAndStop(2);
};
easy.onRollOut = (easy.onDragOut = function () {
this.gotoAndStop(1);
});
easy.onRelease = function () {
difficulty = "easy";
gotoAndStop ("game");
};
medium.gotoAndStop(1);
medium.onRollOver = function () {
this.gotoAndStop(2);
};
medium.onRollOut = (medium.onDragOut = function () {
this.gotoAndStop(1);
});
medium.onRelease = function () {
difficulty = "medium";
gotoAndStop ("game");
};
hard.gotoAndStop(1);
hard.onRollOver = function () {
this.gotoAndStop(2);
};
hard.onRollOut = (hard.onDragOut = function () {
this.gotoAndStop(1);
});
hard.onRelease = function () {
difficulty = "hard";
gotoAndStop ("game");
};
Frame 3
var game = (new net.icsna.CanadianBorderDefense.Game(difficulty, so, useSavedGame));
Symbol 88 MovieClip [nuke explosion] Frame 48
this.removeMovieClip();
Symbol 95 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 110 MovieClip Frame 15
stop();
this._parent.removeMovieClip();
Symbol 117 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 124 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 133 MovieClip Frame 37
gotoAndPlay ("loop");
Symbol 140 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 147 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 154 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 163 MovieClip Frame 35
gotoAndPlay ("loop");
Symbol 170 MovieClip Frame 23
gotoAndPlay ("loop");
Symbol 178 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 187 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 198 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 205 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 212 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 219 MovieClip Frame 29
gotoAndPlay ("loop");
Symbol 231 MovieClip Frame 23
gotoAndPlay ("loop");
Symbol 240 MovieClip [book] Frame 22
gotoAndPlay (1);
Symbol 251 MovieClip [rubble] Frame 70
this.tile.rubble = false;
this.removeMovieClip();
Symbol 261 MovieClip [small cannon explosion] Frame 21
this.removeMovieClip();
Symbol 262 MovieClip [large cannon explosion] Frame 21
this.removeMovieClip();
Symbol 299 MovieClip Frame 115
gotoAndPlay ("loop");
Symbol 323 MovieClip Frame 1
stop();
Symbol 323 MovieClip Frame 32
stop();
Symbol 323 MovieClip Frame 64
stop();
Symbol 339 MovieClip Frame 1
stop();
Symbol 339 MovieClip Frame 11
stop();
Symbol 373 MovieClip [nuke] Frame 71
stop();
massDamage._visible = false;
this._x = this.endX;
this._y = -50;
nukeTower.clip.tower.nukeSilo.play();
nukeTower.bayOpen = false;
setTimeout(_root.game.dropNuke, 2000, this);
Symbol 533 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Game] Frame 0
class net.icsna.CanadianBorderDefense.Game
{
var researchingBeer, researchingNuke, beerAmtResearched, nukeAmtResearched, towerSelected, _jobsLeft, _totalJobs, _nukeTowerSelected, _gameMode, _currentTower, _currentCellOver, _enemyController, _difficulty, _saveData;
function Game (diff, so, savedGame, levelData) {
saveData = (so);
difficulty = (diff);
if (savedGame) {
loadSavedGame();
} else {
setupGame();
}
}
function setupGame() {
initializeVariables();
createBoard();
createTowerHolder();
createCanadianHolder();
createBulletHolder();
setupMenuItems();
setupMouseControls();
setupKeyboardControls();
enemyController = (new net.icsna.CanadianBorderDefense.EnemyController(this, _root.levelData));
enemyController.start(0);
_root.onEnterFrame = mx.utils.Delegate.create(this, handleEnterFrame);
}
function initializeVariables() {
_map[0] = new Array(3, 3, 5, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3);
_map[1] = new Array(3, 3, 5, 3, 3, 3, 3, 3, 3, 8, 4, 4, 9, 3);
_map[2] = new Array(3, 3, 7, 4, 4, 4, 4, 4, 4, 6, 3, 3, 5, 3);
_map[3] = new Array(3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 3);
_map[4] = new Array(3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 4, 4, 6, 3);
_map[5] = new Array(8, 4, 4, 4, 4, 4, 4, 9, 3, 5, 3, 3, 3, 3);
_map[6] = new Array(5, 3, 3, 3, 3, 3, 3, 5, 3, 5, 3, 3, 3, 3);
_map[7] = new Array(5, 3, 3, 3, 3, 3, 3, 7, 4, 6, 3, 3, 3, 3);
_map[8] = new Array(5, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3);
_map[9] = new Array(7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 3, 3);
_map[10] = new Array(3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 5, 3, 3);
money = (170);
switch (_root.game.difficulty) {
case "hard" :
money = money * 1.5;
break;
case "medium" :
money = money * 1.2;
}
nukeCounter = 0;
beerResearched = false;
nukeResearched = false;
totalJobs = (40);
net.icsna.CanadianBorderDefense.Stats.jobsTotal = 40;
jobs = (40);
researchingBeer = false;
researchingNuke = false;
beerAmtResearched = 0;
nukeAmtResearched = 0;
}
function createBoard() {
var _local10 = _root.createEmptyMovieClip("board", 10);
var _local7 = 0;
while (_local7 < _map.length) {
var _local8 = _local7;
var _local9 = _map[_local7].length;
var _local4 = 0;
while (_local4 < _local9) {
var _local6 = _local4;
var _local3 = _root.board.attachMovie("tile", (("tile_" + _local7) + "_") + _local4, ++tileCount);
_local3._x = _local6 * tileWidth;
_local3._y = _local8 * tileHeight;
_local3.type = _map[_local8][_local6];
if (_local3.type > 3) {
_local3.gotoAndStop(3);
_local3.tile.gotoAndStop(_local3.type - 3);
_local3.tile.scorch._visible = false;
} else if (_local3.type == 3) {
var _local5 = Math.random();
switch (difficulty) {
case "easy" :
if (_local5 < 0.3) {
_local3.gotoAndStop(2);
_local3.type = 2;
} else {
_local3.gotoAndStop(1);
_local3.type = 1;
}
_local3.tile.gotoAndStop(1);
break;
case "medium" :
if (_local5 < 0.45) {
_local3.gotoAndStop(2);
_local3.type = 2;
} else {
_local3.gotoAndStop(1);
_local3.type = 1;
}
_local3.tile.gotoAndStop(1);
break;
case "hard" :
if (_local5 < 0.6) {
_local3.gotoAndStop(2);
_local3.type = 2;
} else {
_local3.gotoAndStop(1);
_local3.type = 1;
}
_local3.tile.gotoAndStop(1);
}
} else if (_local3.type == 0) {
_local3.gotoAndStop(1);
_local3.tile.gotoAndStop(1);
} else {
_local3.gotoAndStop(_local3.type);
_local3.tile.gotoAndStop(1);
}
_local3.scorched = false;
_local3.radioactive = false;
_local3.rubble = false;
_local3.placeable.gotoAndStop(1);
_local3.placeable._visible = false;
_local4++;
}
_local7++;
}
}
function createTowerHolder() {
_root.createEmptyMovieClip("towerHolder", 20);
}
function createCanadianHolder() {
_root.createEmptyMovieClip("canadianHolder", 30);
}
function createBulletHolder() {
_root.createEmptyMovieClip("bulletHolder", 40);
}
function setupMenuItems() {
_root.menu.swapDepths(2000);
_root.popupBar.swapDepths(2001);
_root.menu.sellBox._visible = false;
_root.menu.research1.gotoAndStop(1);
_root.menu.research1.menuItem = 7;
_root.menu.research1.researchStatus.researchBar._xscale = 0;
_root.menu.research2.gotoAndStop(1);
_root.menu.research2.menuItem = 8;
_root.menu.research2.researchStatus.researchBar._xscale = 0;
_root.menu.research1.cost = BEER_RESEARCH_COST;
_root.menu.research2.cost = NUKE_RESEARCH_COST;
_root.menu.towerTips._visible = false;
_root.menu.towerTips.gotoAndStop(1);
_root.menu.upgrade1._visible = false;
_root.menu.upgrade1.gotoAndStop(1);
_root.menu.upgrade1.upgradeNum = 1;
_root.menu.upgrade2._visible = false;
_root.menu.upgrade2.gotoAndStop(1);
_root.menu.upgrade2.upgradeNum = 2;
_root.menu.menuTower1.gotoAndStop(1);
_root.menu.menuTower2.gotoAndStop(1);
_root.menu.menuTower3.gotoAndStop(1);
_root.menu.menuTower4.gotoAndStop(1);
_root.menu.menuTower5.gotoAndStop(1);
_root.menu.menuTower6.gotoAndStop(1);
_root.menu.menuTower1.type = net.icsna.CanadianBorderDefense.Tower.ARROW;
_root.menu.menuTower1.cost = net.icsna.CanadianBorderDefense.Tower.ARROW_COST;
_root.menu.menuTower1.menuItem = 1;
_root.menu.menuTower2.type = net.icsna.CanadianBorderDefense.Tower.CANNON;
_root.menu.menuTower2.cost = net.icsna.CanadianBorderDefense.Tower.CANNON_COST;
_root.menu.menuTower2.menuItem = 2;
_root.menu.menuTower3.type = net.icsna.CanadianBorderDefense.Tower.FLYER;
_root.menu.menuTower3.cost = net.icsna.CanadianBorderDefense.Tower.FLYER_COST;
_root.menu.menuTower3.menuItem = 3;
_root.menu.menuTower4.type = net.icsna.CanadianBorderDefense.Tower.FIRE;
_root.menu.menuTower4.cost = net.icsna.CanadianBorderDefense.Tower.FIRE_COST;
_root.menu.menuTower4.menuItem = 4;
_root.menu.menuTower5.type = net.icsna.CanadianBorderDefense.Tower.FREEZE;
_root.menu.menuTower5.cost = net.icsna.CanadianBorderDefense.Tower.FREEZE_COST;
_root.menu.menuTower5.menuItem = 5;
_root.menu.menuTower6.type = net.icsna.CanadianBorderDefense.Tower.NUKE;
_root.menu.menuTower6.cost = net.icsna.CanadianBorderDefense.Tower.NUKE_COST;
_root.menu.menuTower6.menuItem = 6;
_root.menu.sellBox.onRelease = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
if (_root.game.gameMode == "shooting nuke") {
_root.game.gameMode = "normal";
_root.nukeReticule.removeMovieClip();
}
_root.game.sellTower();
};
_root.menu.menuTower1.onRollOver = (_root.menu.menuTower2.onRollOver = (_root.menu.menuTower3.onRollOver = (_root.menu.menuTower4.onRollOver = (_root.menu.menuTower5.onRollOver = (_root.menu.menuTower6.onRollOver = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
_root.menu.towerTips.gotoAndStop(this.menuItem);
_root.menu.towerTips._visible = true;
})))));
_root.menu.menuTower1.onRollOut = (_root.menu.menuTower2.onRollOut = (_root.menu.menuTower3.onRollOut = (_root.menu.menuTower4.onRollOut = (_root.menu.menuTower5.onRollOut = (_root.menu.menuTower6.onRollOut = (_root.menu.menuTower1.onDragOut = (_root.menu.menuTower2.onDragOut = (_root.menu.menuTower3.onDragOut = (_root.menu.menuTower4.onDragOut = (_root.menu.menuTower5.onDragOut = (_root.menu.menuTower6.onDragOut = function () {
_root.menu.towerTips._visible = false;
})))))))))));
_root.menu.menuTower1.onRelease = (_root.menu.menuTower2.onRelease = (_root.menu.menuTower3.onRelease = (_root.menu.menuTower4.onRelease = (_root.menu.menuTower5.onRelease = (_root.menu.menuTower6.onRelease = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
if ((this.type == net.icsna.CanadianBorderDefense.Tower.FREEZE) && (!_root.game.beerResearched)) {
return(undefined);
}
if ((this.type == net.icsna.CanadianBorderDefense.Tower.NUKE) && (!_root.game.nukeResearched)) {
return(undefined);
}
if (_root.game.money >= this.cost) {
_root.game.unselectTower();
_root.game.purchaseTower(this.type);
}
})))));
_root.menu.upgrade1.onRelease = (_root.menu.upgrade2.onRelease = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
if (_root.game.gameMode == "shooting nuke") {
_root.game.gameMode = "normal";
_root.nukeReticule.removeMovieClip();
}
if (_root.game.money < this.cost) {
return(undefined);
}
if (_root.game.towerSelected.upgrades[this.upgradeNum - 1] != 0) {
return(undefined);
}
_root.game.money = _root.game.money - this.cost;
net.icsna.CanadianBorderDefense.Stats.moneySpent = net.icsna.CanadianBorderDefense.Stats.moneySpent + this.cost;
_root.game.towerSelected.upgradeTower(this.upgradeNum);
});
_root.menu.research1.onRollOver = (_root.menu.research2.onRollOver = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
_root.menu.towerTips.gotoAndStop(this.menuItem);
_root.menu.towerTips._visible = true;
});
_root.menu.research1.onRollOut = (_root.menu.research2.onRollOut = (_root.menu.research1.onDragOut = (_root.menu.research2.onDragOut = function () {
_root.menu.towerTips._visible = false;
})));
_root.menu.research1.onRelease = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
if (_root.game.money >= this.cost) {
net.icsna.CanadianBorderDefense.Stats.moneySpent = net.icsna.CanadianBorderDefense.Stats.moneySpent + this.cost;
_root.game.money = _root.game.money - this.cost;
_root.game.researchingBeer = true;
delete this.onRelease;
}
};
_root.menu.research2.onRelease = function () {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
if (_root.game.money >= this.cost) {
net.icsna.CanadianBorderDefense.Stats.moneySpent = net.icsna.CanadianBorderDefense.Stats.moneySpent + this.cost;
_root.game.money = _root.game.money - this.cost;
_root.game.researchingNuke = true;
delete this.onRelease;
}
};
updateMenu();
}
function setupMouseControls() {
mouseListener.onMouseMove = mx.utils.Delegate.create(this, handleMouseMove);
mouseListener.onMouseUp = mx.utils.Delegate.create(this, handleMouseUp);
Mouse.addListener(mouseListener);
}
function setupKeyboardControls() {
keyListener.onKeyDown = mx.utils.Delegate.create(this, handleKeyDown);
Key.addListener(keyListener);
}
function handleKeyDown() {
if (Key.isDown(27)) {
if (gameMode == "placing tower") {
currentTower.clip.removeMovieClip();
delete eval (currentTower);
towerSelected = null;
findCellOver().placeable.gotoAndStop(1);
findCellOver().placeable._visible = false;
gameMode = ("normal");
} else if (gameMode == "shooting nuke") {
nukeTowerSelected = (null);
_root.nukeReticule.removeMovieClip();
unselectTower();
gameMode = ("normal");
} else {
unselectTower();
}
}
}
function handleMouseMove() {
switch (gameMode) {
case "placing tower" :
var _local6 = Math.floor(_root.board._ymouse / tileHeight);
var _local7 = Math.floor(_root.board._xmouse / tileWidth);
currentTower.x = _root.board._xmouse - (tileWidth / 2);
currentTower.y = _root.board._ymouse - (tileHeight / 2);
if (_root.board.hitTest(_xmouse + _root._x, _ymouse + _root._y, false)) {
currentTower.showRange();
} else {
currentTower.hideRange();
}
currentCellOver = (findCellOver());
if (isPlaceable(currentCellOver, _local6, _local7)) {
currentCellOver.placeable.gotoAndStop(1);
currentCellOver.placeable._visible = true;
} else {
currentCellOver.placeable.gotoAndStop(2);
currentCellOver.placeable._visible = true;
}
var _local5 = 0;
while (_local5 < rows) {
var _local4 = 0;
while (_local4 < columns) {
var _local3 = _root.board[(("tile_" + _local5) + "_") + _local4];
if (_local3 == currentCellOver) {
} else {
_local3.placeable.gotoAndStop(1);
_local3.placeable._visible = false;
}
_local4++;
}
_local5++;
}
break;
case "shooting nuke" :
_root.nukeReticule._x = _xmouse;
_root.nukeReticule._y = _ymouse;
}
updateAfterEvent();
}
function isPlaceable(tile, row, column) {
if (row == 0) {
trace("row: " + row);
return(false);
}
if ((currentTower.type == net.icsna.CanadianBorderDefense.Tower.FLYER) && ((tile.type != 2) || (tile.scorched))) {
trace("currentTower.type: " + currentTower.type);
trace("tile.type: " + tile.type);
return(false);
}
if (tile.containsTower) {
trace("tile.containsTower: " + tile.containsTower);
return(false);
}
if (tile.type > 3) {
trace("tile.type is road");
return(false);
}
if (tile.type > 0) {
if ((tile.type == 2) && (currentTower.type != net.icsna.CanadianBorderDefense.Tower.FLYER)) {
if (money < (currentTower.cost + 5)) {
trace("not enough money");
return(false);
}
}
}
return(true);
}
function handleMouseUp() {
switch (gameMode) {
case "placing tower" :
if (!_root.board.hitTest(_xmouse + _root._x, _ymouse + _root._y)) {
return(undefined);
}
var _local6 = Math.floor(_ymouse / tileHeight);
var _local9 = Math.floor(_xmouse / tileWidth);
var _local10 = (_local6 * columns) + _local9;
if (!isPlaceable(currentCellOver, _local6, _local9)) {
return(undefined);
}
currentTower.x = currentCellOver._x;
currentTower.y = currentCellOver._y;
towers[_local10] = currentTower;
currentTower.row = _local6;
currentTower.column = _local9;
var _local4 = _root.board[(("tile_" + _local6) + "_") + _local9];
if ((_local4.type == 2) && (currentTower.type != net.icsna.CanadianBorderDefense.Tower.FLYER)) {
money = ((money - currentTower.cost) - 5);
} else {
money = (money - currentTower.cost);
}
net.icsna.CanadianBorderDefense.Stats.moneySpent = net.icsna.CanadianBorderDefense.Stats.moneySpent + currentTower.cost;
_local4.type = 1;
_local4.gotoAndStop(_local4.type);
if (_local4.scorched) {
_local4.tile.gotoAndStop(2);
} else {
_local4.tile.gotoAndStop(1);
}
_local4.containsTower = true;
currentTower.hideRange();
currentTower.setupEvents();
findCellOver().placeable._visible = false;
net.icsna.CanadianBorderDefense.Stats.towersBuilt.push(currentTower.type);
currentTower = (null);
gameMode = ("normal");
break;
case "shooting nuke" :
if (!_root.board.hitTest(_xmouse + _root._x, _ymouse + _root._y)) {
return(undefined);
}
_local6 = Math.floor(_root.board._ymouse / tileHeight);
_local9 = Math.floor(_root.board._xmouse / tileWidth);
var _local7 = (_local6 * columns) + _local9;
if (towers[_local7]) {
if (towers[_local7] == towerSelected) {
return(undefined);
}
_root.nukeReticule.removeMovieClip();
nukeTowerSelected = (null);
gameMode = ("normal");
return(undefined);
}
unselectTower();
var _local5 = _root.attachMovie("nuke", "nuke", 60 + (nukeCounter++));
_local5.gotoAndStop(1);
_local5._x = nukeTowerSelected.__get__x() + (nukeTowerSelected.__get__width() / 3.5);
_local5._y = nukeTowerSelected.__get__y() + (nukeTowerSelected.__get__height() / 2);
_local5.endX = (_local9 * tileWidth) + (tileWidth / 2);
_local5.endY = (_local6 * tileHeight) + (tileHeight / 2);
_local5.nukeTower = nukeTowerSelected;
_local5.play();
var _local8 = new Sound(_root);
_local8.attachSound("nuke launch");
_local8.start();
_root.nukeReticule.removeMovieClip();
nukeTowerSelected.__set__nukeReady(false);
nukeTowerSelected.__set__nukeConstructionAmt(0);
nukeTowerSelected = (null);
gameMode = ("normal");
break;
case "normal" :
if (!towerSelected) {
} else if (!_root.board.hitTest(_xmouse + _root._x, _ymouse + _root._y, false)) {
} else {
var _local3 = 0;
while (_local3 < towers.length) {
if (!towers[_local3]) {
} else if (!towers[_local3].clip.tower.hitTest(_xmouse + _root._x, _ymouse + _root._y, true)) {
} else {
return(undefined);
}
_local3++;
}
unselectTower();
}
}
}
function handleEnterFrame() {
if (gameMode == "waiting") {
return(undefined);
}
enemyController.update();
if (towers.length > 0) {
updateTowers();
}
if (bullets.length > 0) {
updateBullets();
}
if (researchingBeer || (researchingNuke)) {
updateResearch();
}
}
function purchaseTower(towerType) {
if (gameMode == "shooting nuke") {
nukeTowerSelected = (null);
_root.nukeReticule.removeMovieClip();
unselectTower();
gameMode = ("normal");
}
if (currentTower) {
currentTower.clip.removeMovieClip();
currentTower = (null);
}
switch (towerType) {
case net.icsna.CanadianBorderDefense.Tower.ARROW :
var _local3 = new net.icsna.CanadianBorderDefense.ArrowTower();
break;
case net.icsna.CanadianBorderDefense.Tower.CANNON :
_local3 = new net.icsna.CanadianBorderDefense.CannonTower();
break;
case net.icsna.CanadianBorderDefense.Tower.FLYER :
_local3 = new net.icsna.CanadianBorderDefense.FlyerTower();
break;
case net.icsna.CanadianBorderDefense.Tower.FIRE :
_local3 = new net.icsna.CanadianBorderDefense.FireTower();
break;
case net.icsna.CanadianBorderDefense.Tower.FREEZE :
_local3 = new net.icsna.CanadianBorderDefense.FreezeTower();
break;
case net.icsna.CanadianBorderDefense.Tower.NUKE :
_local3 = new net.icsna.CanadianBorderDefense.NukeTower();
}
currentTower = (_local3);
gameMode = ("placing tower");
}
function findCellOver() {
var _local6 = _xmouse;
var _local5 = _ymouse;
var _local4 = Math.floor(_xmouse / tileWidth);
var _local3 = Math.floor(_ymouse / tileHeight);
return(_root.board[(("tile_" + _local3) + "_") + _local4]);
}
function updateMenu() {
if (((money < _root.menu.research1.cost) || (beerResearched)) || (researchingBeer)) {
_root.menu.research1.gotoAndStop(1);
} else {
_root.menu.research1.gotoAndStop(2);
}
if (((money < _root.menu.research2.cost) || (nukeResearched)) || (researchingNuke)) {
_root.menu.research2.gotoAndStop(1);
} else {
_root.menu.research2.gotoAndStop(2);
}
if (money < _root.menu.menuTower1.cost) {
_root.menu.menuTower1.gotoAndStop(1);
} else {
_root.menu.menuTower1.gotoAndStop(2);
}
if (money < _root.menu.menuTower2.cost) {
_root.menu.menuTower2.gotoAndStop(1);
} else {
_root.menu.menuTower2.gotoAndStop(2);
}
if (money < _root.menu.menuTower3.cost) {
_root.menu.menuTower3.gotoAndStop(1);
} else {
_root.menu.menuTower3.gotoAndStop(2);
}
if (money < _root.menu.menuTower4.cost) {
_root.menu.menuTower4.gotoAndStop(1);
} else {
_root.menu.menuTower4.gotoAndStop(2);
}
if ((money < _root.menu.menuTower5.cost) || (!beerResearched)) {
_root.menu.menuTower5.gotoAndStop(1);
} else {
_root.menu.menuTower5.gotoAndStop(2);
}
if ((money < _root.menu.menuTower6.cost) || (!nukeResearched)) {
_root.menu.menuTower6.gotoAndStop(1);
} else {
_root.menu.menuTower6.gotoAndStop(2);
}
}
function updateTowers() {
var _local2 = 0;
while (_local2 < towers.length) {
var _local3 = towers[_local2];
if (!_local3) {
} else {
_local3.update();
}
_local2++;
}
}
function updateBullets() {
var _local2 = 0;
while (_local2 < bullets.length) {
var _local3 = bullets[_local2];
if (!_local3) {
} else {
_local3.update();
}
_local2++;
}
}
function createBullet(bulletType, shooter, target) {
var _local2 = new net.icsna.CanadianBorderDefense.Bullet(bulletType, shooter, target);
bullets.push(_local2);
}
function removeBullet(bullet) {
bullet.__get__clip().removeMovieClip();
net.icsna.utils.ICSNAArrays.removeFromArray(bullet, bullets);
bullet = null;
}
function modifyJobs(val) {
jobs = jobs + val;
if (val < 0) {
net.icsna.CanadianBorderDefense.Stats.jobsLost = net.icsna.CanadianBorderDefense.Stats.jobsLost + (-val);
}
if (jobs <= 0) {
gameMode = ("waiting");
endGame(false, false);
jobs = (0);
}
}
function updateResearch() {
if (researchingBeer && (gameMode != "waiting")) {
beerAmtResearched++;
var _local3 = (beerAmtResearched / (BEER_RESEARCH_TIME * 31)) * 100;
_root.menu.research1.researchStatus.researchBar._xscale = _local3;
if (beerAmtResearched >= (BEER_RESEARCH_TIME * 31)) {
researchingBeer = false;
beerAmtResearched = BEER_RESEARCH_TIME * 31;
beerResearched = true;
}
}
if (researchingNuke && (gameMode != "waiting")) {
nukeAmtResearched++;
var _local3 = (nukeAmtResearched / (NUKE_RESEARCH_TIME * 31)) * 100;
_root.menu.research2.researchStatus.researchBar._xscale = _local3;
if (nukeAmtResearched >= (NUKE_RESEARCH_TIME * 31)) {
researchingNuke = false;
nukeAmtResearched = NUKE_RESEARCH_TIME * 31;
nukeResearched = true;
}
}
}
function dropNuke(nuke) {
var _local4 = new mx.transitions.Tween(nuke, "_y", mx.transitions.easing.Regular.easeIn, nuke._y, nuke.endY, 2, true);
var _local2 = new Sound(_root);
_local2.attachSound("nuke explode");
_local2.start();
_local4.onMotionFinished = function () {
var _local2 = _root.attachMovie("nuke explosion", "nukeExplosion" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local2._x = nuke._x;
_local2._y = nuke._y;
_root.game.findNukedTargets(nuke);
_root.game.findNukedTiles(nuke);
nuke.removeMovieClip();
};
}
function findNukedTargets(nuke) {
var _local8 = net.icsna.utils.ICSNAArrays.copyArray(enemyController.__get__canadians());
var _local5 = 0;
while (_local5 < _local8.length) {
var _local4 = _local8[_local5];
var _local7 = net.icsna.utils.ICSNAMath.dist(_local4.x + (_local4.clip._width / 2), _local4.y + (_local4.clip._height / 2), nuke._x, nuke._y);
var _local6 = nuke.nukeTower.range + (_local4.clip._width / 2);
if (_local7 < _local6) {
_local4.addHealth(-nuke.nukeTower.damage);
}
_local5++;
}
_local5 = 0;
while (_local5 < towers.length) {
var _local2 = towers[_local5];
if (!_local2) {
} else {
var _local7 = net.icsna.utils.ICSNAMath.dist(_local2.x + (_local2.clip.tower._width / 2), _local2.y + (_local2.clip.tower._height / 2), nuke._x, nuke._y);
var _local6 = nuke.nukeTower.range + (_local2.clip.tower._width / 2);
if (_local7 < _local6) {
_local2.addHealth(-nuke.nukeTower.damage);
}
}
_local5++;
}
}
function findNukedTiles(nuke) {
var _local7 = 0;
while (_local7 < _map.length) {
var _local13 = _local7;
var _local12 = _map[_local7].length;
var _local6 = 0;
while (_local6 < _local12) {
var _local11 = _local6;
var _local4 = _root.board[(("tile_" + _local7) + "_") + _local6];
var _local10 = net.icsna.utils.ICSNAMath.dist(_local4._x + (_local4._width / 2), _local4._y + (_local4._height / 2), nuke._x, nuke._y);
var _local8 = nuke.nukeTower.splashRange;
if (_local10 < _local8) {
if (!_local4.scorched) {
if ((_local4.type < 3) && (_local4.type > 0)) {
_local4.tile.gotoAndStop(2);
} else {
_local4.tile.scorch._visible = true;
}
_local4.scorched = true;
}
if (!_local4.radioactive) {
var _local5 = _root.attachMovie("radioactive", "radioactive" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
_local5._x = _local4._x + (_local4._width / 2);
_local5._y = _local4._y + (_local4._height / 2);
_local5.tile = _local4;
_local4.radioactive = true;
_global.setTimeout(removeRadiation, RADIATION_DURATION, _local5);
}
}
_local6++;
}
_local7++;
}
}
function removeRadiation(radiation) {
radiation.tile.radioactive = false;
radiation.removeMovieClip();
}
function killTower(tow) {
var _local7 = new Sound(_root);
_local7.attachSound("tower destroyed");
_local7.start();
if (!tow) {
return(undefined);
}
var _local4 = _root.board.attachMovie("rubble", "rubble" + _root.board.getNextHighestDepth(), _root.board.getNextHighestDepth());
_local4._x = tow.x + (tow.width / 2);
_local4._y = tow.y + (tow.height / 2);
var _local6 = Math.floor(tow.y / _root.game.tileHeight);
var _local8 = Math.floor(tow.x / _root.game.tileWidth);
var _local5 = _root.board[(("tile_" + _local6) + "_") + _local8];
_local5.rubble = true;
_local4.tile = _local5;
_local6 = Math.floor(tow.y / tileHeight);
_local8 = Math.floor(tow.x / tileWidth);
_local5 = _root.board[(("tile_" + _local6) + "_") + _local8];
if (_local5.containsTower) {
_local5.containsTower = false;
}
net.icsna.CanadianBorderDefense.Stats.towersLost.push(tow.type);
towers[(_local6 * columns) + _local8] = null;
tow.viewingDetails = false;
tow.clip.removeMovieClip();
tow = null;
}
function removeTower(tow) {
var _local5 = Math.floor(tow.y / tileHeight);
var _local6 = Math.floor(tow.x / tileWidth);
var _local4 = _root.board[(("tile_" + _local5) + "_") + _local6];
if (_local4.containsTower) {
_local4.containsTower = false;
}
towers[(_local5 * columns) + _local6] = null;
tow.clip.removeMovieClip();
tow.viewingDetails = false;
tow = null;
towerSelected = null;
}
function sellTower() {
var _local5 = new Sound(_root);
_local5.attachSound("sell sound");
_local5.start();
money = money + towerSelected.value;
var _local4 = Math.floor(towerSelected.y / tileHeight);
var _local6 = Math.floor((towerSelected.x + 10) / tileWidth);
var _local3 = _root.board[(("tile_" + _local4) + "_") + _local6];
if (_local3.containsTower) {
_local3.containsTower = false;
}
towers[(_local4 * columns) + _local6] = null;
towerSelected.clip.removeMovieClip();
_root.menu.sellBox._visible = false;
_root.menu.upgrade1._visible = false;
_root.menu.upgrade2._visible = false;
towerSelected.viewingDetails = false;
towerSelected = null;
}
function unselectTower() {
towerSelected.viewingDetails = false;
towerSelected.hideRange();
towerSelected.hideStatus();
_root.menu.sellBox._visible = false;
_root.menu.upgrade1._visible = false;
_root.menu.upgrade2._visible = false;
towerSelected = null;
}
function clearLevel() {
unselectTower();
var _local3 = 0;
while (_local3 < towers.length) {
towers[_local3].viewingDetails = false;
towers[_local3].hideRange();
towers[_local3].hideStatus();
_local3++;
}
while (bullets.length > 0) {
var _local4 = bullets[0];
_local4.__get__clip().removeMovieClip();
net.icsna.utils.ICSNAArrays.removeFromArray(_local4, bullets);
}
if (gameMode == "shooting nuke") {
nukeTowerSelected = (null);
_root.nukeReticule.removeMovieClip();
}
if (gameMode == "placing tower") {
currentTower.clip.removeMovieClip();
delete eval (currentTower);
towerSelected = null;
}
}
function showLevelMessage(message) {
_root.popupBar.popupText.text = message;
var _local4 = new mx.transitions.Tween(_root.popupBar, "_y", mx.transitions.easing.Regular.easeOut, _root.popupBar._y, _root.popupBar._y + _root.popupBar._height, 1, true);
_local4.onMotionFinished = function () {
var _local3 = _root.attachMovie("start level", "start_mc", _root.getNextHighestDepth());
if (_root.game.enemyController.phase == 0) {
_local3.saveMenu._visible = false;
}
_local3._x = _root.menu._x / 2;
_local3._y = 195;
_local3.begin.gotoAndStop(1);
_local3.begin.onRollOver = function () {
this.gotoAndStop(2);
};
_local3.begin.onRollOut = (_local3.begin.onDragOut = function () {
this.gotoAndStop(1);
});
_local3.begin.onRelease = function () {
this._parent.removeMovieClip();
var _local3 = new mx.transitions.Tween(_root.popupBar, "_y", mx.transitions.easing.Regular.easeOut, _root.popupBar._y, -_root.popupBar._height, 1, true);
_local3.onMotionFinished = function () {
_root.game.gameMode = "normal";
};
};
_local3.saveMenu.yes.gotoAndStop(1);
_local3.saveMenu.no.gotoAndStop(1);
_local3.saveMenu.yes.onRollOver = function () {
this.gotoAndStop(2);
};
_local3.saveMenu.yes.onRollOut = (_local3.saveMenu.yes.onDragOut = function () {
this.gotoAndStop(1);
});
_local3.saveMenu.yes.onRelease = function () {
_root.game.saveGame(_root.game.enemyController.phase);
this._parent._visible = false;
};
};
}
function saveGame(phase) {
saveData.clear();
saveData.data.phase = phase;
saveData.data.tiles = new Array();
saveData.data.towers = new Array();
var _local7 = 0;
while (_local7 < rows) {
var _local6 = 0;
while (_local6 < columns) {
var _local5 = _root.board[(("tile_" + _local7) + "_") + _local6];
var _local3 = new Object();
_local3.scorched = _local5.scorched;
_local3.type = _local5.type;
_local3.containsTower = _local5.containsTower;
saveData.data.tiles.push(_local3);
_local6++;
}
_local7++;
}
_local7 = 0;
while (_local7 < towers.length) {
var _local4 = towers[_local7];
if (!_local4) {
} else {
var _local3 = new Object();
_local3.type = _local4.type;
_local3.row = _local4.row;
_local3.column = _local4.column;
_local3.range = _local4.range;
_local3.firingRate = _local4.firingRate;
_local3.damage = _local4.damage;
_local3.splashRange = _local4.splashRange;
_local3.splashDamage = _local4.splashDamage;
_local3.health = _local4.health;
_local3.upgrades = new Array();
_local3.upgrades = _local4.upgrades;
_local3.value = _local4.value;
if (_local4.type == net.icsna.CanadianBorderDefense.Tower.NUKE) {
_local3.nukeBuildTime = _local4.nukeBuildTime;
_local3.nukeReady = _local4.nukeReady;
_local3.bayOpen = _local4.bayOpen;
}
saveData.data.towers.push(_local3);
}
_local7++;
}
saveData.data.difficulty = difficulty;
saveData.data.jobs = jobs;
saveData.data.nukeCounter = nukeCounter;
saveData.data.money = money;
saveData.data.nukeResearched = nukeResearched;
saveData.data.beerResearched = beerResearched;
saveData.data.stats = new Object();
saveData.data.stats.enemiesKilled = net.icsna.CanadianBorderDefense.Stats.enemiesKilled;
saveData.data.stats.enemiesTotal = net.icsna.CanadianBorderDefense.Stats.enemiesTotal;
saveData.data.stats.moneyEarned = net.icsna.CanadianBorderDefense.Stats.moneyEarned;
saveData.data.stats.moneySpent = net.icsna.CanadianBorderDefense.Stats.moneySpent;
saveData.data.stats.jobsTotal = net.icsna.CanadianBorderDefense.Stats.jobsTotal;
saveData.data.stats.jobsLost = net.icsna.CanadianBorderDefense.Stats.jobsLost;
saveData.data.stats.towersBuilt = net.icsna.CanadianBorderDefense.Stats.towersBuilt;
saveData.data.stats.towersLost = net.icsna.CanadianBorderDefense.Stats.towersLost;
saveData.data.stats.bossesKilled = net.icsna.CanadianBorderDefense.Stats.bossesKilled;
saveData.data.stats.totalBosses = net.icsna.CanadianBorderDefense.Stats.totalBosses;
saveData.flush();
}
function loadSavedGame() {
money = (saveData.data.money);
nukeCounter = saveData.data.nukeCounter;
beerResearched = saveData.data.beerResearched;
nukeResearched = saveData.data.nukeResearched;
totalJobs = (40);
net.icsna.CanadianBorderDefense.Stats.jobsTotal = 40;
jobs = (saveData.data.jobs);
researchingBeer = false;
researchingNuke = false;
beerAmtResearched = 0;
nukeAmtResearched = 0;
var _local12 = _root.createEmptyMovieClip("board", 10);
var _local10 = 0;
while (_local10 < rows) {
var _local9 = _local10;
var _local6 = 0;
while (_local6 < columns) {
var _local8 = _local6;
var _local7 = saveData.data.tiles[(_local9 * columns) + _local8];
var _local3 = _root.board.attachMovie("tile", (("tile_" + _local10) + "_") + _local6, ++tileCount);
_local3._x = _local8 * tileWidth;
_local3._y = _local9 * tileHeight;
_local3.type = _local7.type;
if (_local3.type > 3) {
_local3.gotoAndStop(3);
_local3.tile.gotoAndStop(_local3.type - 3);
} else if (_local3.type == 0) {
_local3.gotoAndStop(1);
_local3.tile.gotoAndStop(1);
} else {
_local3.gotoAndStop(_local3.type);
_local3.tile.gotoAndStop(1);
}
if (_local7.scorched) {
_local3.tile.scorch._visible = true;
_local3.scorched = true;
} else {
_local3.tile.scorch._visible = false;
_local3.scorched = false;
}
_local3.containsTower = _local7.containsTower;
_local3.radioactive = false;
_local3.rubble = false;
_local3.placeable.gotoAndStop(1);
_local3.placeable._visible = false;
_local6++;
}
_local10++;
}
createTowerHolder();
createCanadianHolder();
createBulletHolder();
var _local11 = saveData.data.towers;
_local10 = 0;
while (_local10 < _local11.length) {
var _local4 = _local11[_local10];
switch (_local4.type) {
case net.icsna.CanadianBorderDefense.Tower.ARROW :
var _local5 = new net.icsna.CanadianBorderDefense.ArrowTower();
break;
case net.icsna.CanadianBorderDefense.Tower.CANNON :
_local5 = new net.icsna.CanadianBorderDefense.CannonTower();
break;
case net.icsna.CanadianBorderDefense.Tower.FLYER :
_local5 = new net.icsna.CanadianBorderDefense.FlyerTower();
break;
case net.icsna.CanadianBorderDefense.Tower.FIRE :
_local5 = new net.icsna.CanadianBorderDefense.FireTower();
break;
case net.icsna.CanadianBorderDefense.Tower.FREEZE :
_local5 = new net.icsna.CanadianBorderDefense.FreezeTower();
break;
case net.icsna.CanadianBorderDefense.Tower.NUKE :
_local5 = new net.icsna.CanadianBorderDefense.NukeTower();
}
_local5.__set__x(_local4.column * tileWidth);
_local5.__set__y(_local4.row * tileHeight);
_local5.__set__row(_local4.row);
_local5.__set__column(_local4.column);
_local5.__set__range(_local4.range);
_local5.__set__firingRate(_local4.firingRate);
_local5.__set__damage(_local4.damage);
_local5.__set__splashDamage(_local4.splashDamage);
_local5.__set__splashRange(_local4.splashRange);
_local5.__set__health(_local4.health);
_local5.__set__upgrades(_local4.upgrades);
_local5.__set__value(_local4.value);
if (_local5.__get__type() == net.icsna.CanadianBorderDefense.Tower.NUKE) {
_local5.__set__nukeBuildTime(_local4.nukeBuildTime);
_local5.__set__nukeReady(_local4.nukeReady);
_local5.__set__bayOpen(_local4.bayOpen);
}
_local5.setupEvents();
towers[(_local4.row * columns) + _local4.column] = _local5;
_local10++;
}
net.icsna.CanadianBorderDefense.Stats.enemiesKilled = saveData.data.stats.enemiesKilled;
net.icsna.CanadianBorderDefense.Stats.enemiesTotal = saveData.data.stats.enemiesTotal;
net.icsna.CanadianBorderDefense.Stats.moneyEarned = saveData.data.stats.moneyEarned;
net.icsna.CanadianBorderDefense.Stats.moneySpent = saveData.data.stats.moneySpent;
net.icsna.CanadianBorderDefense.Stats.jobsTotal = saveData.data.stats.jobsTotal;
net.icsna.CanadianBorderDefense.Stats.jobsLost = saveData.data.stats.jobsLost;
net.icsna.CanadianBorderDefense.Stats.towersBuilt = saveData.data.stats.towersBuilt;
net.icsna.CanadianBorderDefense.Stats.towersLost = saveData.data.stats.towersLost;
net.icsna.CanadianBorderDefense.Stats.bossesKilled = saveData.data.stats.bossesKilled;
net.icsna.CanadianBorderDefense.Stats.totalBosses = saveData.data.stats.totalBosses;
setupMenuItems();
setupMouseControls();
setupKeyboardControls();
enemyController = (new net.icsna.CanadianBorderDefense.EnemyController(this, _root.levelData));
enemyController.start(saveData.data.phase);
_root.onEnterFrame = mx.utils.Delegate.create(this, handleEnterFrame);
}
function endGame(win, dionKilled) {
if (win) {
if (dionKilled) {
var _local4 = new Sound(_root);
_local4.attachSound("music america anthem");
_local4.start(0, 3);
} else {
var _local4 = new Sound(_root);
_local4.attachSound("music o canada");
_local4.start(0, 3);
}
} else if (dionKilled) {
var _local4 = new Sound(_root);
_local4.attachSound("music o canada");
_local4.start(0, 3);
} else {
var _local4 = new Sound(_root);
_local4.attachSound("music o canada");
_local4.start(0, 3);
}
_root.bulletHolder.removeMovieClip();
_root.canadianHolder.removeMovieClip();
_root.towerHolder.removeMovieClip();
var _local3 = _root.attachMovie("stats screen", "statsScreen", _root.getNextHighestDepth());
_local3._x = (_root.gameWidth - _root.menu._width) / 2;
_local3._y = _root.gameHeight / 2;
_local3.playAgain.gotoAndStop(1);
_local3.enemiesKilled.text = net.icsna.CanadianBorderDefense.Stats.enemiesKilled.length;
_local3.enemiesTotal.text = net.icsna.CanadianBorderDefense.Stats.enemiesTotal.length;
_local3.percentEnemiesKilled.text = ((net.icsna.CanadianBorderDefense.Stats.enemiesKilled.length / net.icsna.CanadianBorderDefense.Stats.enemiesTotal.length) * 100) + "%";
_local3.moneySpent.text = net.icsna.CanadianBorderDefense.Stats.moneySpent;
_local3.moneyEarned.text = net.icsna.CanadianBorderDefense.Stats.moneyEarned;
if (net.icsna.CanadianBorderDefense.Stats.moneyEarned == 0) {
_local3.percentMoneySpent.text = "0%";
} else {
_local3.percentMoneySpent.text = ((net.icsna.CanadianBorderDefense.Stats.moneySpent / net.icsna.CanadianBorderDefense.Stats.moneyEarned) * 100) + "%";
}
_local3.jobsTotal.text = net.icsna.CanadianBorderDefense.Stats.jobsTotal;
_local3.jobsLost.text = net.icsna.CanadianBorderDefense.Stats.jobsLost;
_local3.percentJobsLost.text = ((net.icsna.CanadianBorderDefense.Stats.jobsLost / net.icsna.CanadianBorderDefense.Stats.jobsTotal) * 100) + "%";
_local3.playAgain.onRelease = function () {
getURL ("javascript:refreshAllAds()");
stopAllSounds();
_root.menu.removeMovieClip();
_root.board.removeMovieClip();
_root.gotoAndStop("menu");
this._parent.removeMovieClip();
};
}
function set money(val) {
if (val < 0) {
val = 0;
}
_money = val;
_root.menu.money_txt.text = ("$" + Math.floor(money)) + " USD";
updateMenu();
//return(money);
}
function get money() {
return(_money);
}
function get jobs() {
return(_jobsLeft);
}
function set jobs(val) {
if (val < 0) {
val = 0;
}
if (val > totalJobs) {
val = totalJobs;
}
_jobsLeft = val;
_root.menu.jobs.text = (jobs + "/") + totalJobs;
//return(jobs);
}
function get totalJobs() {
return(_totalJobs);
}
function set totalJobs(val) {
if (val < 0) {
val = 0;
}
_totalJobs = val;
//return(totalJobs);
}
function get nukeTowerSelected() {
return(_nukeTowerSelected);
}
function set nukeTowerSelected(val) {
_nukeTowerSelected = val;
//return(nukeTowerSelected);
}
function set gameMode(val) {
_gameMode = val;
//return(gameMode);
}
function get gameMode() {
return(_gameMode);
}
function set tileWidth(val) {
_tileWidth = val;
//return(tileWidth);
}
function get tileWidth() {
return(_tileWidth);
}
function set tileHeight(val) {
_tileHeight = val;
//return(tileHeight);
}
function get tileHeight() {
return(_tileHeight);
}
function set currentTower(val) {
_currentTower = val;
//return(currentTower);
}
function get currentTower() {
return(_currentTower);
}
function set currentCellOver(val) {
_currentCellOver = val;
//return(currentCellOver);
}
function get currentCellOver() {
return(_currentCellOver);
}
function get enemyController() {
return(_enemyController);
}
function set enemyController(val) {
_enemyController = val;
//return(enemyController);
}
function get difficulty() {
return(_difficulty);
}
function set difficulty(val) {
_difficulty = val;
//return(difficulty);
}
function get saveData() {
return(_saveData);
}
function set saveData(val) {
_saveData = val;
//return(saveData);
}
var _money = 100;
var mouseListener = new Object();
var keyListener = new Object();
var columns = 14;
var rows = 11;
var tileCount = 0;
var _tileWidth = 35.4;
var _tileHeight = 35.4;
var towers = new Array();
var bullets = new Array();
var nukeCounter = 0;
var BEER_RESEARCH_COST = 300;
var NUKE_RESEARCH_COST = 900;
var RADIATION_DURATION = 10000;
var RADIATION_DAMAGE = 0.4;
var BEER_RESEARCH_TIME = 50;
var NUKE_RESEARCH_TIME = 90;
var beerResearched = false;
var nukeResearched = false;
var _map = new Array();
}
Symbol 534 MovieClip [__Packages.net.icsna.CanadianBorderDefense.EnemyController] Frame 0
class net.icsna.CanadianBorderDefense.EnemyController
{
var levelData, _dionKilled, _koodosValue, _canadians, _totalPhases, _phaseStarted, _phase, _message, _phaseSpawnTime, _spawnTime, _game, _enemiesToSpawn, _levelValue;
function EnemyController (game, levelData) {
canadians = (new Array());
enemiesToSpawn = (new Array());
this.levelData = levelData;
phaseSpawnTime = (20);
spawnTime = (20);
phase = (0);
this.game = (game);
totalPhases = (levelData.length);
_dionKilled = false;
}
function start(num) {
phase = (num);
initializePhase();
}
function initializePhase() {
stopAllSounds();
var _local4 = levelData[phase];
phaseStarted = (false);
phaseSpawnTime = (parseInt(_local4.childNodes[0].attributes.spawnTime));
message = (((phase + 1) + ". ") + _local4.attributes.message);
_koodosValue = parseInt(_local4.attributes.koodos);
levelValue = (parseInt(_local4.attributes.bonus));
spawnTime = (phaseSpawnTime);
var _local2 = 0;
while (_local2 < _local4.childNodes.length) {
enemiesToSpawn.push("spawnTime");
enemiesToSpawn.push(_local4.childNodes[_local2].attributes.spawnTime);
var _local3 = 0;
while (_local3 < _local4.childNodes[_local2].attributes.amount) {
enemiesToSpawn.push(parseInt(_local4.childNodes[_local2].attributes.type));
_local3++;
}
_local2++;
}
game.__set__gameMode("waiting");
if (message != "") {
game.showLevelMessage(message);
} else {
game.__set__gameMode("normal");
}
}
function update() {
if (enemiesToSpawn.length > 0) {
spawnTime = ((spawnTime-1));
if (spawnTime <= 0) {
if (!phaseStarted) {
phaseStarted = (true);
}
spawnTime = (phaseSpawnTime);
spawnNextCanadian();
}
}
updateEnemies();
}
function spawnNextCanadian() {
if (enemiesToSpawn[0] == "spawnTime") {
enemiesToSpawn.shift();
enemiesToSpawn.shift();
}
if (enemiesToSpawn[1] == "spawnTime") {
phaseSpawnTime = (enemiesToSpawn[2]);
}
switch (enemiesToSpawn[0]) {
case net.icsna.CanadianBorderDefense.Canadian.BASIC_LUMBERJACK :
case net.icsna.CanadianBorderDefense.Canadian.BASIC_BROTHER_1 :
case net.icsna.CanadianBorderDefense.Canadian.BASIC_BROTHER_2 :
case net.icsna.CanadianBorderDefense.Canadian.BASIC_OLD_LADY :
var _local3 = new net.icsna.CanadianBorderDefense.Basic(enemiesToSpawn[0]);
break;
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_MOUNTIE :
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_BEAR :
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_MOOSE :
_local3 = new net.icsna.CanadianBorderDefense.Tough(enemiesToSpawn[0]);
break;
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_FIGHTER_HOCKEY :
_local3 = new net.icsna.CanadianBorderDefense.ToughFighter(enemiesToSpawn[0]);
break;
case net.icsna.CanadianBorderDefense.Canadian.FLYER_GOOSE :
case net.icsna.CanadianBorderDefense.Canadian.FLYER_CLOWN :
_local3 = new net.icsna.CanadianBorderDefense.Flyer(enemiesToSpawn[0]);
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_GUITAR :
var _local4 = new Sound(_root);
_local4.attachSound("boss bryan adams");
_local4.start(0, 9999);
case net.icsna.CanadianBorderDefense.Canadian.BOSS_TREBEK :
case net.icsna.CanadianBorderDefense.Canadian.BOSS_PAM :
case net.icsna.CanadianBorderDefense.Canadian.BOSS_MARSHAL :
case net.icsna.CanadianBorderDefense.Canadian.BOSS_DION :
_local3 = new net.icsna.CanadianBorderDefense.Boss(enemiesToSpawn[0]);
}
if (_local3.__get__flyer()) {
_local3.__set__direction("down");
_local3.__set__x(net.icsna.utils.ICSNAMath.randomNumber(_root.board._x + (_local3.__get__clip().canadian._width / 2), _root.board._width - (_local3.__get__clip().canadian._width / 2), true));
_local3.__set__y((-_local3.__get__clip().canadian._height) / 2);
} else {
_local3.__set__currDestIndex(0);
_local3.__set__currDestination(getDestCoord(_local3));
_local3.__set__x(_local3.__get__currDestination()[0]);
_local3.__set__y(_local3.__get__currDestination()[1] - game.__get__tileHeight());
_local3.__set__direction("down");
}
canadians.push(_local3);
enemiesToSpawn.shift();
net.icsna.CanadianBorderDefense.Stats.enemiesTotal.push(_local3.__get__type());
}
function updateEnemies() {
movement();
reorderPositions();
updateHealth();
checkForFiring();
checkForNextPhase();
}
function checkForFiring() {
var _local3 = 0;
while (_local3 < canadians.length) {
var _local2 = canadians[_local3];
if ((_local2.type < net.icsna.CanadianBorderDefense.Canadian.BOSS_TREBEK) && (_local2.type != net.icsna.CanadianBorderDefense.Canadian.TOUGH_FIGHTER_HOCKEY)) {
} else {
var _local4 = getEnemies(_local2);
if (_local4.length == 0) {
} else {
var _local5 = --_local2.firingTime;
if (_local5 <= 0) {
_local2.firingTime = _local2.firingRate;
_local2.fire(_local4);
}
}
}
_local3++;
}
}
function getEnemies(canadian) {
var _local7 = _root.game.towers;
var _local8 = new Array();
var _local4 = 0;
while (_local4 < _local7.length) {
var _local2 = _local7[_local4];
if (!_local2) {
} else {
var _local6 = net.icsna.utils.ICSNAMath.dist(canadian.x + canadian.clip.canadian._x, canadian.y + canadian.clip.canadian._y, _local2.x + (_local2.width / 2), _local2.y + (_local2.height / 2));
var _local5 = canadian.firingRange + (_local2.width / 2);
if (_local6 < _local5) {
_local8.push(_local2);
}
}
_local4++;
}
return(_local8);
}
function movement() {
var _local3 = 0;
while (_local3 < canadians.length) {
var _local2 = canadians[_local3];
if (_local2.frozen) {
_local2.freezeTime--;
if (_local2.frozen.upgrades[0]) {
var _local4 = _local2.freezeTime + 31;
} else {
var _local4 = _local2.freezeTime;
}
if (_local4 <= 0) {
_local2.freezeTime = _local2.maxFreezeTime;
_local2.frozen = null;
}
} else {
moveCanadian(_local2);
}
_local3++;
}
}
function moveCanadian(currCanadian) {
var _local4 = getDestCoord(currCanadian);
currCanadian.move();
switch (currCanadian.direction) {
case "left" :
if (currCanadian.x <= _local4[0]) {
currCanadian.x = _local4[0];
getNextDest(currCanadian);
}
break;
case "right" :
if (currCanadian.x >= _local4[0]) {
currCanadian.x = _local4[0];
getNextDest(currCanadian);
}
break;
case "up" :
if (currCanadian.y <= _local4[1]) {
currCanadian.y = _local4[1];
getNextDest(currCanadian);
}
break;
case "down" :
if (currCanadian.y < _local4[1]) {
break;
}
currCanadian.y = _local4[1];
getNextDest(currCanadian);
}
if (canadianOffBoard(currCanadian)) {
removeCanadian(currCanadian);
return(undefined);
}
var _local5 = Math.floor(currCanadian.y / game.__get__tileHeight());
var _local6 = Math.floor(currCanadian.x / game.__get__tileWidth());
var _local7 = _root.board[(("tile_" + _local5) + "_") + _local6];
if (_local7.radioactive) {
currCanadian.addHealth(-game.RADIATION_DAMAGE);
}
}
function canadianOffBoard(currCanadian) {
if (currCanadian.x < (-game.__get__tileWidth())) {
return(true);
}
if (currCanadian.x > _root.board._width) {
return(true);
}
if (currCanadian.y < (-game.__get__tileHeight())) {
return(true);
}
if (currCanadian.y > _root.board._height) {
return(true);
}
return(false);
}
function reorderPositions() {
canadians.sort(order);
}
function order(a, b) {
if (a.distanceTraveled < b.distanceTraveled) {
return(1);
}
if (a.distanceTraveled > b.distanceTraveled) {
return(-1);
}
return(0);
}
function updateHealth() {
var _local3 = 0;
while (_local3 < canadians.length) {
var _local2 = canadians[_local3];
if (_local2.onFire) {
_local2.addHealth(-_local2.fireDamage);
_local2.fireLength--;
if (_local2.fireLength <= 0) {
_local2.onFire = false;
_local2.clip.flame._visible = false;
}
}
_local2.updateHealth();
_local3++;
}
}
function getDestCoord(canadian) {
var _local4 = new Array();
var _local6 = path[canadian.currDestIndex][0];
var _local7 = path[canadian.currDestIndex][1];
var _local5 = _root.board[(("tile_" + _local6) + "_") + _local7];
if (!_local5) {
switch (canadian.direction) {
case "left" :
_local4 = [canadian.x - game.__get__tileWidth(), canadian.y];
break;
case "right" :
_local4 = [canadian.x + game.__get__tileWidth(), canadian.y];
break;
case "up" :
_local4 = [canadian.x, canadian.y - game.__get__tileHeight()];
break;
case "down" :
_local4 = [canadian.x, canadian.y + game.__get__tileHeight()];
}
return(_local4);
}
return([_local5._x, _local5._y]);
}
function getNextDest(canadian) {
var _local3 = new Array();
canadian.currDestIndex++;
_local3 = getDestCoord(canadian);
if (_local3[0] > canadian.x) {
canadian.direction = "right";
}
if (_local3[0] < canadian.x) {
canadian.direction = "left";
}
if (_local3[1] < canadian.y) {
canadian.direction = "up";
}
if (_local3[1] > canadian.y) {
canadian.direction = "down";
}
return(_local3);
}
function checkForNextPhase() {
if (phaseStarted) {
if ((enemiesToSpawn.length <= 0) && (canadians.length <= 0)) {
_root.game.money = _root.game.money + levelValue;
_root.game.clearLevel();
startNextPhase();
}
}
}
function startNextPhase() {
phase = ((phase+1));
if (phase >= totalPhases) {
game.__set__gameMode("waiting");
if (game.__get__jobs() > 0) {
if (_dionKilled) {
game.endGame(true, true);
} else {
game.endGame(true, false);
}
} else if (_dionKilled) {
game.endGame(false, true);
} else {
game.endGame(false, false);
}
} else {
initializePhase();
}
}
function removeCanadian(canadian) {
net.icsna.utils.ICSNAArrays.removeFromArray(canadian, canadians);
canadian.clip.removeMovieClip();
if (((((canadian.type == net.icsna.CanadianBorderDefense.Canadian.BOSS_TREBEK) || (canadian.type == net.icsna.CanadianBorderDefense.Canadian.BOSS_PAM)) || (canadian.type == net.icsna.CanadianBorderDefense.Canadian.BOSS_GUITAR)) || (canadian.type == net.icsna.CanadianBorderDefense.Canadian.BOSS_MARSHAL)) || (canadian.type == net.icsna.CanadianBorderDefense.Canadian.BOSS_DION)) {
game.modifyJobs(-5);
} else {
game.modifyJobs(-1);
}
var _local4 = new Sound(_root);
_local4.attachSound("lose job");
_local4.start();
canadian = null;
}
function killCanadian(canadian) {
if (canadian.type == net.icsna.CanadianBorderDefense.Canadian.BOSS_DION) {
_dionKilled = true;
}
net.icsna.utils.ICSNAArrays.removeFromArray(canadian, canadians);
canadian.clip.canadian._visible = false;
canadian.clip.death._visible = true;
canadian.clip.death.play();
var _local4 = new Sound(_root);
_local4.attachSound("death " + (Math.floor(Math.random() * 3) + 1));
_local4.start();
_root.game.money = _root.game.money + canadian.value;
net.icsna.CanadianBorderDefense.Stats.moneyEarned = net.icsna.CanadianBorderDefense.Stats.moneyEarned + canadian.value;
net.icsna.CanadianBorderDefense.Stats.enemiesKilled.push(canadian.type);
if (canadian.type >= net.icsna.CanadianBorderDefense.Canadian.BOSS_TREBEK) {
net.icsna.CanadianBorderDefense.Stats.bossesKilled.push(canadian.type);
}
canadian = null;
}
function get canadians() {
return(_canadians);
}
function set canadians(val) {
_canadians = val;
//return(canadians);
}
function get totalPhases() {
return(_totalPhases);
}
function set totalPhases(val) {
_totalPhases = val;
//return(totalPhases);
}
function get phaseStarted() {
return(_phaseStarted);
}
function set phaseStarted(val) {
_phaseStarted = val;
//return(phaseStarted);
}
function get phase() {
return(_phase);
}
function set phase(val) {
_phase = val;
//return(phase);
}
function get message() {
return(_message);
}
function set message(val) {
_message = val;
//return(message);
}
function get phaseSpawnTime() {
return(_phaseSpawnTime);
}
function set phaseSpawnTime(val) {
_phaseSpawnTime = val;
//return(phaseSpawnTime);
}
function get spawnTime() {
return(_spawnTime);
}
function set spawnTime(val) {
_spawnTime = val;
//return(spawnTime);
}
function get game() {
return(_game);
}
function set game(val) {
_game = val;
//return(game);
}
function get enemiesToSpawn() {
return(_enemiesToSpawn);
}
function set enemiesToSpawn(val) {
_enemiesToSpawn = val;
//return(enemiesToSpawn);
}
function get levelValue() {
return(_levelValue);
}
function set levelValue(val) {
_levelValue = val;
//return(levelValue);
}
var path = new Array([0, 2], [1, 2], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6], [2, 7], [2, 8], [2, 9], [1, 9], [1, 10], [1, 11], [1, 12], [2, 12], [3, 12], [4, 12], [4, 11], [4, 10], [4, 9], [5, 9], [6, 9], [7, 9], [7, 8], [7, 7], [6, 7], [5, 7], [5, 6], [5, 4], [5, 3], [5, 2], [5, 1], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 5], [9, 6], [9, 7], [9, 8], [9, 9], [9, 10], [9, 11], [10, 11]);
}
Symbol 535 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Canadian] Frame 0
class net.icsna.CanadianBorderDefense.Canadian
{
var _clip, _type, _health, _maxHealth, _speed, _flyer, _currDestIndex, _currDestination, _direction, _frozen, _dead, _freezeChance, _freezeTime, _maxFreezeTime, _value, _firingRange, _distanceTraveled, _fireDamage, _fireLength, _onFire;
function Canadian (canadianType) {
_clip = _root.canadianHolder.attachMovie("canadian", "canadian" + canadianCounter, ++canadianCounter);
type = (canadianType);
clip.gotoAndStop(type);
clip.healthBar._visible = false;
clip.death.gotoAndStop(1);
clip.death._visible = false;
clip.flame._visible = false;
speed = (1);
distanceTraveled = (0);
clip.canadian.onRollOver = mx.utils.Delegate.create(this, handleRollOver);
clip.canadian.onRollOut = (clip.canadian.onRollOut = mx.utils.Delegate.create(this, handleRollOut));
}
function handleRollOver() {
if (_root.game.gameMode != "normal") {
return(undefined);
}
clip.swapDepths(canadianCounter);
showRange();
showStatus();
}
function handleRollOut() {
if (_root.game.gameMode != "normal") {
return(undefined);
}
hideRange();
hideStatus();
}
function move() {
switch (direction) {
case "left" :
x = x - speed;
break;
case "right" :
x = x + speed;
break;
case "up" :
y = y - speed;
break;
case "down" :
y = y + speed;
}
distanceTraveled = distanceTraveled + speed;
}
function showStatus() {
clip.healthBar._visible = true;
if ((x + clip.healthBar._x) < 0) {
clip.healthBar._x = clip.canadian._width;
} else {
clip.healthBar._x = -clip.healthBar._width;
}
}
function hideStatus() {
clip.healthBar._visible = false;
clip.healthBar._x = -clip.healthBar._width;
}
function showRange() {
clip.range1._width = (clip.range1._height = firingRange * 2);
clip.range1._visible = true;
}
function hideRange() {
clip.range1._visible = false;
}
function updateHealth() {
var _local2 = health / maxHealth;
clip.healthBar.healthMeter._xscale = _local2 * 100;
}
function addHealth(val) {
health = (health + val);
if (health <= 0) {
dead = (true);
_root.game.enemyController.killCanadian(this);
}
}
function get x() {
return(clip._x);
}
function set x(val) {
clip._x = val;
//return(x);
}
function get y() {
return(clip._y);
}
function set y(val) {
clip._y = val;
//return(y);
}
function get clip() {
return(_clip);
}
function set clip(val) {
_clip = val;
//return(clip);
}
function get type() {
return(_type);
}
function set type(val) {
_type = val;
//return(type);
}
function get health() {
return(_health);
}
function set health(val) {
if (val > maxHealth) {
val = maxHealth;
}
_health = val;
//return(health);
}
function get maxHealth() {
return(_maxHealth);
}
function set maxHealth(val) {
_maxHealth = val;
//return(maxHealth);
}
function set speed(val) {
_speed = val;
//return(speed);
}
function get speed() {
return(_speed);
}
function get flyer() {
return(_flyer);
}
function set flyer(val) {
_flyer = val;
//return(flyer);
}
function set currDestIndex(val) {
_currDestIndex = val;
//return(currDestIndex);
}
function get currDestIndex() {
return(_currDestIndex);
}
function set currDestination(val) {
_currDestination = val;
//return(currDestination);
}
function get currDestination() {
return(_currDestination);
}
function set direction(val) {
_direction = val;
//return(direction);
}
function get direction() {
return(_direction);
}
function get frozen() {
return(_frozen);
}
function set frozen(val) {
_frozen = val;
//return(frozen);
}
function set dead(val) {
_dead = val;
//return(dead);
}
function get dead() {
return(_dead);
}
function get freezeChance() {
return(_freezeChance);
}
function set freezeChance(val) {
_freezeChance = val;
//return(freezeChance);
}
function get freezeTime() {
return(_freezeTime);
}
function set freezeTime(val) {
_freezeTime = val;
//return(freezeTime);
}
function get maxFreezeTime() {
return(_maxFreezeTime);
}
function set maxFreezeTime(val) {
_maxFreezeTime = val;
//return(maxFreezeTime);
}
function get value() {
return(_value);
}
function set value(val) {
_value = val;
//return(value);
}
function get firingRange() {
return(_firingRange);
}
function set firingRange(val) {
_firingRange = val;
//return(firingRange);
}
function get distanceTraveled() {
return(_distanceTraveled);
}
function set distanceTraveled(val) {
_distanceTraveled = val;
//return(distanceTraveled);
}
function get fireDamage() {
return(_fireDamage);
}
function set fireDamage(val) {
_fireDamage = val;
//return(fireDamage);
}
function get fireLength() {
return(_fireLength);
}
function set fireLength(val) {
_fireLength = val;
//return(fireLength);
}
function get onFire() {
return(_onFire);
}
function set onFire(val) {
_onFire = val;
//return(onFire);
}
static var BASIC_LUMBERJACK = 1;
static var BASIC_BROTHER_1 = 2;
static var BASIC_BROTHER_2 = 3;
static var BASIC_OLD_LADY = 4;
static var TOUGH_MOUNTIE = 5;
static var TOUGH_BEAR = 6;
static var TOUGH_MOOSE = 7;
static var TOUGH_FIGHTER_HOCKEY = 8;
static var FLYER_GOOSE = 9;
static var FLYER_CLOWN = 10;
static var BOSS_TREBEK = 11;
static var BOSS_PAM = 12;
static var BOSS_GUITAR = 13;
static var BOSS_MARSHAL = 14;
static var BOSS_DION = 15;
static var canadianCounter = 0;
}
Symbol 536 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 537 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Basic] Frame 0
class net.icsna.CanadianBorderDefense.Basic extends net.icsna.CanadianBorderDefense.Canadian
{
var __set__speed, __set__value, __set__freezeChance, __set__maxFreezeTime, __set__freezeTime, __set__maxHealth, __set__health, maxHealth, health, __set__flyer;
function Basic (subType) {
super(subType);
switch (subType) {
case net.icsna.CanadianBorderDefense.Canadian.BASIC_LUMBERJACK :
__set__speed(1);
__set__value(1);
__set__freezeChance(5);
__set__maxFreezeTime(120);
__set__freezeTime(120);
__set__maxHealth(30);
__set__health(30);
break;
case net.icsna.CanadianBorderDefense.Canadian.BASIC_BROTHER_1 :
__set__speed(1.4);
__set__value(1.3);
__set__freezeChance(5);
__set__maxFreezeTime(120);
__set__freezeTime(120);
__set__maxHealth(48);
__set__health(48);
break;
case net.icsna.CanadianBorderDefense.Canadian.BASIC_BROTHER_2 :
__set__speed(1.5);
__set__value(1.4);
__set__freezeChance(5);
__set__maxFreezeTime(120);
__set__freezeTime(120);
__set__maxHealth(62);
__set__health(62);
break;
case net.icsna.CanadianBorderDefense.Canadian.BASIC_OLD_LADY :
__set__speed(0.8);
__set__value(1.3);
__set__freezeChance(3);
__set__maxFreezeTime(120);
__set__freezeTime(120);
__set__maxHealth(210);
__set__health(210);
}
switch (_root.game.difficulty) {
case "easy" :
maxHealth = maxHealth * 0.85;
health = health * 0.85;
break;
case "hard" :
maxHealth = maxHealth * 1.05;
health = health * 1.05;
}
__set__flyer(false);
}
}
Symbol 538 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Tough] Frame 0
class net.icsna.CanadianBorderDefense.Tough extends net.icsna.CanadianBorderDefense.Canadian
{
var __set__speed, __set__value, __set__freezeChance, __set__maxFreezeTime, __set__freezeTime, __set__maxHealth, __set__health, maxHealth, health, __set__flyer;
function Tough (subType) {
super(subType);
switch (subType) {
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_MOUNTIE :
__set__speed(1.5);
__set__value(1.4);
__set__freezeChance(3);
__set__maxFreezeTime(60);
__set__freezeTime(60);
__set__maxHealth(100);
__set__health(100);
break;
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_BEAR :
__set__speed(1.1);
__set__value(1.8);
__set__freezeChance(1);
__set__maxFreezeTime(60);
__set__freezeTime(60);
__set__maxHealth(220);
__set__health(220);
break;
case net.icsna.CanadianBorderDefense.Canadian.TOUGH_MOOSE :
__set__speed(1.3);
__set__value(2);
__set__freezeChance(1);
__set__maxFreezeTime(60);
__set__freezeTime(60);
__set__maxHealth(250);
__set__health(250);
}
switch (_root.game.difficulty) {
case "easy" :
maxHealth = maxHealth * 0.85;
health = health * 0.85;
break;
case "hard" :
maxHealth = maxHealth * 1.05;
health = health * 1.05;
}
__set__flyer(false);
}
}
Symbol 539 MovieClip [__Packages.net.icsna.CanadianBorderDefense.ToughFighter] Frame 0
class net.icsna.CanadianBorderDefense.ToughFighter extends net.icsna.CanadianBorderDefense.Canadian
{
var __get__clip, __set__speed, __set__value, __set__freezeChance, __set__maxFreezeTime, __set__freezeTime, __set__firingRange, __set__maxHealth, __set__health, maxHealth, health, __set__flyer, __get__x, __get__y, _firingRate, _firingTime, _damage, _bulletCounter, _bulletType;
function ToughFighter (subType) {
super(subType);
__get__clip().range1._visible = false;
__set__speed(1);
if (!(subType === net.icsna.CanadianBorderDefense.Canadian.TOUGH_FIGHTER_HOCKEY)) {
} else {
__set__speed(1.3);
__set__value(3);
__set__freezeChance(5);
__set__maxFreezeTime(60);
__set__freezeTime(60);
__set__firingRange(85);
firingRate = (40);
firingTime = (0);
damage = (7);
__set__maxHealth(100);
__set__health(100);
bulletType = ("puck");
}
switch (_root.game.difficulty) {
case "easy" :
maxHealth = maxHealth * 0.85;
health = health * 0.85;
break;
case "hard" :
damage = (8.5);
__set__firingRange(95);
maxHealth = maxHealth * 1.05;
health = health * 1.05;
}
__set__flyer(false);
}
function fire(targets) {
var target = targets[Math.floor(Math.random() * targets.length)];
var _local3 = _root.attachMovie(bulletType, bulletType + bulletCounter, _root.getNextHighestDepth());
_local3._x = __get__x() + __get__clip().canadian._x;
_local3._y = __get__y() + __get__clip().canadian._y;
_local3.target = target;
_local3.speed = 5;
_local3.damage = damage;
var _local4 = new Sound(_root);
_local4.attachSound("hockey puck");
_local4.start();
_local3.onEnterFrame = function () {
var _local5 = (this.target.y + (this.target.height / 2)) - this._y;
var _local6 = (this.target.x + (this.target.width / 2)) - this._x;
var _local2 = Math.atan2(_local5, _local6);
var _local4 = Math.cos(_local2) * this.speed;
var _local3 = Math.sin(_local2) * this.speed;
var _local7 = net.icsna.utils.ICSNAMath.dist(this._x, this._y, this.target.x + (this.target.width / 2), this.target.y + (this.target.height / 2));
this._x = this._x + _local4;
this._y = this._y + _local3;
if ((_local7 < 10) || (!target.clip._visible)) {
delete this.onEnterFrame;
this.target.addHealth(-this.damage);
this.removeMovieClip();
}
};
}
function get firingRate() {
return(_firingRate);
}
function set firingRate(val) {
_firingRate = val;
//return(firingRate);
}
function get firingTime() {
return(_firingTime);
}
function set firingTime(val) {
_firingTime = val;
//return(firingTime);
}
function get damage() {
return(_damage);
}
function set damage(val) {
_damage = val;
//return(damage);
}
function get bulletCounter() {
return(_bulletCounter);
}
function set bulletCounter(val) {
_bulletCounter = val;
//return(bulletCounter);
}
function get bulletType() {
return(_bulletType);
}
function set bulletType(val) {
_bulletType = val;
//return(bulletType);
}
}
Symbol 540 MovieClip [__Packages.net.icsna.utils.ICSNAMath] Frame 0
class net.icsna.utils.ICSNAMath
{
function ICSNAMath () {
}
static function toRadians(degrees) {
return((degrees * Math.PI) / 180);
}
static function toDegrees(radians) {
return((radians * 180) / Math.PI);
}
static function randomNumber(min, max, floor) {
if (max < min) {
return(-1);
}
if (max == min) {
return(max);
}
if (floor) {
return(Math.floor(Math.random() * (max - min)) + min);
}
return((Math.random() * (max - min)) + min);
}
static function findHypotenuse(side1, side2) {
if ((side1 < 0) || (side2 < 0)) {
return(-1);
}
return(Math.sqrt(Math.pow(side1, 2) + Math.pow(side2, 2)));
}
static function dist(x1, y1, x2, y2) {
return(Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)));
}
}
Symbol 541 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Flyer] Frame 0
class net.icsna.CanadianBorderDefense.Flyer extends net.icsna.CanadianBorderDefense.Canadian
{
var __set__speed, __set__value, __set__maxHealth, __set__health, maxHealth, health, __set__flyer, y, speed, distanceTraveled, __get__y;
function Flyer (subType) {
super(subType);
__set__speed(2);
switch (subType) {
case net.icsna.CanadianBorderDefense.Canadian.FLYER_GOOSE :
__set__value(1);
__set__maxHealth(33);
__set__health(33);
break;
case net.icsna.CanadianBorderDefense.Canadian.FLYER_CLOWN :
__set__value(1.2);
__set__maxHealth(75);
__set__health(75);
}
switch (_root.game.difficulty) {
case "easy" :
maxHealth = maxHealth * 0.85;
health = health * 0.85;
break;
case "hard" :
maxHealth = maxHealth * 1.05;
health = health * 1.05;
}
__set__flyer(true);
}
function move() {
y = y + speed;
distanceTraveled = distanceTraveled + speed;
if (__get__y() > _root.board._height) {
_root.game.enemyController.removeCanadian(this);
}
}
}
Symbol 542 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Boss] Frame 0
class net.icsna.CanadianBorderDefense.Boss extends net.icsna.CanadianBorderDefense.Canadian
{
var __get__clip, __set__speed, __set__value, __set__firingRange, __set__maxHealth, __set__health, maxHealth, health, __set__flyer, __get__type, __get__x, __get__y, _firingRate, _firingTime, _damage, _bulletCounter, _bulletType;
function Boss (subType) {
super(subType);
__get__clip().range1._visible = false;
__set__speed(1);
switch (subType) {
case net.icsna.CanadianBorderDefense.Canadian.BOSS_TREBEK :
__set__speed(1.2);
__set__value(100);
firingRate = (32);
__set__firingRange(75);
firingTime = (0);
__set__maxHealth(700);
__set__health(700);
damage = (45);
__get__clip().laser1._visible = false;
__get__clip().laser2._visible = false;
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_PAM :
__set__speed(1.2);
__set__value(100);
firingRate = (20);
__set__firingRange(100);
firingTime = (0);
damage = (35);
bulletType = ("kiss");
bulletCounter = (0);
__set__maxHealth(850);
__set__health(850);
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_GUITAR :
__set__speed(1.3);
__set__value(110);
firingRate = (5);
__set__firingRange(120);
firingTime = (0);
damage = (8);
bulletType = ("note");
__set__maxHealth(1000);
__set__health(1000);
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_MARSHAL :
__set__speed(1);
__set__value(120);
firingRate = (90);
__set__firingRange(150);
firingTime = (0);
damage = (100);
bulletType = ("book");
__set__maxHealth(1250);
__set__health(1250);
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_DION :
__set__speed(1);
__set__value(400);
firingRate = (2);
__set__firingRange(2000);
firingTime = (0);
damage = (2.5);
__set__maxHealth(2100);
__set__health(2100);
}
switch (_root.game.difficulty) {
case "easy" :
maxHealth = maxHealth * 0.85;
health = health * 0.85;
break;
case "hard" :
maxHealth = maxHealth * 1.05;
health = health * 1.05;
}
__set__flyer(false);
}
function fire(targets) {
var target = targets[0];
switch (__get__type()) {
case net.icsna.CanadianBorderDefense.Canadian.BOSS_TREBEK :
var _local9 = new Sound(_root);
_local9.attachSound("boss trebek " + (Math.floor(Math.random() * 2) + 1));
_local9.start();
__get__clip().laser1.onEnterFrame = function () {
if (!target.clip._visible) {
delete this.onEnterFrame;
this._visible = false;
return(undefined);
}
var _local2 = (target.y + (target.height / 2)) - ((this._parent._y + this._parent.canadian._y) - 10);
var _local3 = (target.x + (target.width / 2)) - ((this._parent._x + this._parent.canadian._x) - 5);
var _local4 = Math.atan2(_local2, _local3);
var _local5 = net.icsna.utils.ICSNAMath.dist(this._parent._x + this._parent.canadian._x, this._parent._y + this._parent.canadian._y, target.x + (target.width / 2), target.y + (target.height / 2));
this._rotation = 0;
this._width = _local5;
this._rotation = net.icsna.utils.ICSNAMath.toDegrees(_local4);
this._visible = true;
};
__get__clip().laser2.onEnterFrame = function () {
if (!target.clip._visible) {
delete this.onEnterFrame;
this._visible = false;
return(undefined);
}
var _local2 = (target.y + (target.height / 2)) - ((this._parent._y + this._parent.canadian._y) - 10);
var _local3 = (target.x + (target.width / 2)) - ((this._parent._x + this._parent.canadian._x) + 5);
var _local4 = Math.atan2(_local2, _local3);
var _local5 = net.icsna.utils.ICSNAMath.dist(this._parent._x + this._parent.canadian._x, this._parent._y + this._parent.canadian._y, target.x + (target.width / 2), target.y + (target.height / 2));
this._rotation = 0;
this._width = _local5;
this._rotation = net.icsna.utils.ICSNAMath.toDegrees(_local4);
this._visible = true;
};
target.addHealth(-damage);
_global.setTimeout(function (canadian) {
delete canadian.clip.laser1.onEnterFrame;
delete canadian.clip.laser2.onEnterFrame;
canadian.clip.laser1._visible = false;
canadian.clip.laser2._visible = false;
}, 500, this);
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_PAM :
case net.icsna.CanadianBorderDefense.Canadian.BOSS_GUITAR :
case net.icsna.CanadianBorderDefense.Canadian.BOSS_MARSHAL :
if (__get__type() == net.icsna.CanadianBorderDefense.Canadian.BOSS_PAM) {
_local9 = new Sound(_root);
_local9.attachSound("boss pam");
_local9.start();
} else if (__get__type() == net.icsna.CanadianBorderDefense.Canadian.BOSS_MARSHAL) {
_local9 = new Sound(_root);
_local9.attachSound("boss marshal");
_local9.start();
}
var _local8 = _root.attachMovie(bulletType, bulletType + bulletCounter, _root.getNextHighestDepth());
_local8._x = __get__x() + __get__clip().canadian._x;
_local8._y = __get__y() + __get__clip().canadian._y;
_local8.target = target;
_local8.speed = 5;
_local8.damage = damage;
_local8.onEnterFrame = function () {
var _local5 = (this.target.y + (this.target.height / 2)) - this._y;
var _local6 = (this.target.x + (this.target.width / 2)) - this._x;
var _local2 = Math.atan2(_local5, _local6);
var _local4 = Math.cos(_local2) * this.speed;
var _local3 = Math.sin(_local2) * this.speed;
var _local7 = net.icsna.utils.ICSNAMath.dist(this._x, this._y, this.target.x + (this.target.width / 2), this.target.y + (this.target.height / 2));
this._x = this._x + _local4;
this._y = this._y + _local3;
if ((_local7 < 10) || (!target.clip._visible)) {
delete this.onEnterFrame;
this.target.addHealth(-this.damage);
this.removeMovieClip();
}
};
break;
case net.icsna.CanadianBorderDefense.Canadian.BOSS_DION :
var _local5 = 0;
for(;;){
if (_local5 >= targets.length) {
break;
}
var _local4 = targets[_local5];
var _local6 = net.icsna.utils.ICSNAMath.dist(__get__x() + __get__clip().canadian._x, __get__y() + __get__clip().canadian._y, _local4.x + (_local4.width / 2), _local4.y + (_local4.height / 2));
if (_local6 < 100) {
_local4.addHealth(-damage);
} else if (_local6 < 200) {
_local4.addHealth((-damage) + 0.5);
} else if (_local6 < 300) {
_local4.addHealth((-damage) + 1);
} else {
_local4.addHealth((-damage) + 1.5);
}
_local5++;
};
}
}
function get firingRate() {
return(_firingRate);
}
function set firingRate(val) {
_firingRate = val;
//return(firingRate);
}
function get firingTime() {
return(_firingTime);
}
function set firingTime(val) {
_firingTime = val;
//return(firingTime);
}
function get damage() {
return(_damage);
}
function set damage(val) {
_damage = val;
//return(damage);
}
function get bulletCounter() {
return(_bulletCounter);
}
function set bulletCounter(val) {
_bulletCounter = val;
//return(bulletCounter);
}
function get bulletType() {
return(_bulletType);
}
function set bulletType(val) {
_bulletType = val;
//return(bulletType);
}
}
Symbol 543 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Stats] Frame 0
class net.icsna.CanadianBorderDefense.Stats
{
function Stats () {
}
static function getFavoriteTower() {
}
static var enemiesKilled = new Array();
static var enemiesTotal = new Array();
static var moneyEarned = 0;
static var moneySpent = 0;
static var jobsTotal = 0;
static var jobsLost = 0;
static var towersBuilt = new Array();
static var towersLost = new Array();
static var bossesKilled = new Array();
static var totalBosses = 5;
}
Symbol 544 MovieClip [__Packages.net.icsna.utils.ICSNAArrays] Frame 0
class net.icsna.utils.ICSNAArrays
{
function ICSNAArrays () {
}
static function isMemberOfArray(value, arr) {
var _local1 = 0;
while (_local1 < arr.length) {
if (arr[_local1] == value) {
return(_local1);
}
_local1++;
}
return(-1);
}
static function removeFromArray(item, arr) {
var _local1 = 0;
while (_local1 < arr.length) {
if (item == arr[_local1]) {
arr.splice(_local1, 1);
return(item);
}
_local1++;
}
return(-1);
}
static function copyArray(arr) {
return(arr.slice());
}
static function shuffleArray(arr) {
var _local2 = 0;
while (_local2 < arr.length) {
var _local4 = arr[_local2];
var _local3 = Math.floor(Math.random() * arr.length);
arr[_local2] = arr[_local3];
arr[_local3] = _local4;
_local2++;
}
}
}
Symbol 545 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Tower] Frame 0
class net.icsna.CanadianBorderDefense.Tower
{
static var _towerViewing;
var currentUpgrade, progressMC, _timeToFire, _health, _dead, _maxHealth, _underConstruction, _clip, _type, _firingRate, _freezing, _range, _splashRange, _splashDamage, _cost, _enemyList, _damage, _freezingTime, _freezeResetTime, _ableToFreeze, _viewingDetails, _upgrades, _upgradeProgress, _amtUpgraded, _value, _row, _column, _nukeConstructionAmt, _nukeBuildTime, _bayOpen, _nukeReady, _shotsFired;
function Tower (towerType) {
clip = (_root.towerHolder.attachMovie("tower", "tower" + towerCounter, ++towerCounter));
type = (towerType);
clip.gotoAndStop(type);
clip.tower.gotoAndStop(1);
clip.constructionBar._visible = false;
clip.constructionOverlay._visible = false;
clip.healthBar._visible = false;
clip.range._visible = false;
x = (_root.board._xmouse - (_root.game.tileWidth / 2));
y = (_root.board._ymouse - (_root.game.tileHeight / 2));
enemyList = (new Array());
health = (400);
maxHealth = (400);
dead = (false);
upgrades = ([0, 0]);
underConstruction = (false);
clip.smoke._visible = false;
clip.smoke.gotoAndStop(1);
}
function handleRollOver() {
if (((_root.game.gameMode == "placing tower") || (viewingDetails)) || (_root.game.gameMode == "waiting")) {
return(undefined);
}
clip.swapDepths(towerCounter);
showRange();
showStatus();
}
function handleRollOut() {
if (((_root.game.gameMode == "placing tower") || (viewingDetails)) || (_root.game.gameMode == "waiting")) {
return(undefined);
}
hideRange();
hideStatus();
}
function handleRelease() {
if ((_root.game.gameMode == "placing tower") || (_root.game.gameMode == "waiting")) {
return(undefined);
}
if (viewingDetails) {
_root.game.towerSelected = null;
_root.menu.upgrade1._visible = false;
_root.menu.upgrade2._visible = false;
_root.menu.sellBox._visible = false;
hideRange();
hideStatus();
viewingDetails = (false);
} else {
_root.game.towerSelected = this;
_root.menu.upgrade1._visible = true;
_root.menu.upgrade1.gotoAndStop(type);
if (upgrades[0]) {
_root.menu.upgrade1.alphaBox._visible = true;
} else {
_root.menu.upgrade1.alphaBox._visible = false;
}
_root.menu.upgrade2._visible = true;
_root.menu.upgrade2.gotoAndStop(type);
if (upgrades[1]) {
_root.menu.upgrade2.alphaBox._visible = true;
} else {
_root.menu.upgrade2.alphaBox._visible = false;
}
_root.menu.sellBox._visible = true;
_root.menu.sellBox.sellValue.text = "$" + value;
viewingDetails = (true);
}
}
function setupEvents() {
clip.tower.onRollOver = mx.utils.Delegate.create(this, handleRollOver);
clip.tower.onRollOut = (clip.tower.onRollOut = mx.utils.Delegate.create(this, handleRollOut));
clip.tower.onRelease = mx.utils.Delegate.create(this, handleRelease);
}
function updateStatusBars() {
var _local2 = health / maxHealth;
clip.healthBar.healthMeter._xscale = _local2 * 100;
if (_local2 <= 0.25) {
clip.smoke._visible = true;
clip.smoke.play();
}
if (underConstruction) {
clip.constructionBar._visible = true;
_local2 = Math.floor((amtUpgraded / (UPGRADE_TIME * 31)) * 100);
clip.constructionBar.constructionMeter._xscale = _local2;
} else {
clip.constructionBar._visible = false;
}
}
function showStatus() {
clip.healthBar._visible = true;
if ((x + clip.healthBar._x) < 0) {
clip.healthBar._x = clip.tower._width;
} else {
clip.healthbar._x = -clip.healthBar._width;
}
if (underConstruction) {
clip.constructionBar._visible = true;
if ((x + clip.constructionBar._x) < 0) {
clip.constructionBar._x = clip.tower._x + clip.tower._width;
} else {
clip.constructionBar._x = -clip.constructionBar._width;
}
}
}
function hideStatus() {
clip.healthBar._visible = false;
clip.healthBar._x = -clip.healthBar._width;
clip.constructionBar._visible = false;
clip.constructionBar._x = -clip.constructionBar._width;
clip.nukeBar._visible = false;
clip.nukeBar._x = -clip.nukeBar._width;
}
function showRange() {
clip.range._width = (clip.range._height = range * 2);
clip.range._visible = true;
}
function hideRange() {
clip.range._visible = false;
}
function upgradeTower(num) {
num--;
if (num == 0) {
value = value + Math.floor(_root.menu.upgrade1.cost * 0.75);
} else {
value = value + Math.floor(_root.menu.upgrade2.cost * 0.75);
}
_root.game.towerSelected = null;
viewingDetails = (false);
_root.menu.upgrade1._visible = false;
_root.menu.upgrade2._visible = false;
_root.menu.sellBox._visible = false;
clip.constructionOverlay._visible = true;
clip.tower._visible = false;
underConstruction = (true);
amtUpgraded = (0);
currentUpgrade = num;
progressMC = clip.createEmptyMovieClip("upgrader", clip.getNextHighestDepth());
progressMC.onEnterFrame = mx.utils.Delegate.create(this, handleUpgradeProgress);
}
function handleUpgradeProgress() {
}
function update() {
updateStatusBars();
getEnemies();
clip.range._width = range * 2;
clip.range._height = range * 2;
if (!underConstruction) {
if (type == FREEZE) {
if (freezing) {
if (enemyList.length > 0) {
checkToFreeze();
}
} else if (enemyList.length > 0) {
if (ableToFreeze) {
var _local4 = new Sound(_root);
_local4.attachSound("tower freeze");
_local4.start();
freezing = (true);
ableToFreeze = (false);
clip.tower.onOff.gotoAndStop(2);
_global.setTimeout(turnFreezingOff, (freezingTime / 31) * 1000, this);
_global.setTimeout(turnAbleToFreezeOn, (freezeResetTime / 31) * 1000, this);
}
}
} else if ((_timeToFire < firingRate) || (enemyList.length > 0)) {
checkToFire();
}
}
}
function turnFreezingOff(blah) {
blah.freezing = false;
blah.clip.tower.onOff.gotoAndStop(1);
}
function turnAbleToFreezeOn(blah) {
blah.ableToFreeze = true;
}
function getEnemies() {
var _local5 = _root.game.enemyController.canadians;
enemyList = ([]);
var _local4 = 0;
for ( ; _local4 < _local5.length ; _local4++) {
var _local3 = _local5[_local4];
if (!enemyInRange(_local3)) {
if (net.icsna.utils.ICSNAArrays.isMemberOfArray(_local3, enemyList) != -1) {
net.icsna.utils.ICSNAArrays.removeFromArray(_local3, enemyList);
}
} else if (net.icsna.utils.ICSNAArrays.isMemberOfArray(_local3, enemyList) != -1) {
} else {
if (type == FLYER) {
if ((!_local3.flyer) && (!upgrades[1])) {
continue;
}
} else if ((type != NUKE) && (type != ARROW)) {
if (_local3.flyer) {
continue;
}
} else {
enemyList.push(_local3);
}
enemyList.push(_local3);
}
}
}
function enemyInRange(enemy) {
var _local6 = enemy.x + enemy.clip.canadian._x;
var _local4 = enemy.y + enemy.clip.canadian._y;
var _local5 = (x + clip.tower._x) + (clip.tower._width / 2);
var _local3 = (y + clip.tower._y) + (clip.tower._height / 2);
var _local8 = net.icsna.utils.ICSNAMath.dist(_local6, _local4, _local5, _local3);
var _local7 = range + (enemy.clip.canadian._width / 4);
if (_local8 < _local7) {
return(true);
}
return(false);
}
function checkToFreeze() {
var _local3 = 0;
while (_local3 < enemyList.length) {
var _local2 = enemyList[_local3];
if (_local2.type == FLYER) {
} else if (_local2.frozen) {
} else {
var _local4 = Math.floor(Math.random() * 100);
if (upgrades[1]) {
_local4 = _local4 - 2;
}
if (_local4 < _local2.freezeChance) {
_local2.frozen = this;
}
}
_local3++;
}
}
function checkToFire() {
if (_timeToFire == firingRate) {
if (enemyList.length > 0) {
fireBullet(enemyList);
}
}
_timeToFire--;
if (_timeToFire <= 0) {
_timeToFire = firingRate;
}
}
function fireBullet(enemyList) {
var _local3 = enemyList[0];
switch (type) {
case ARROW :
_root.game.createBullet(net.icsna.CanadianBorderDefense.Bullet.ARROW, this, _local3);
var _local4 = new Sound(_root);
_local4.attachSound("tower arrow");
_local4.start();
break;
case CANNON :
_root.game.createBullet(net.icsna.CanadianBorderDefense.Bullet.CANNON, this, _local3);
_local4 = new Sound(_root);
_local4.attachSound("tower cannon");
_local4.start();
break;
case FLYER :
_root.game.createBullet(net.icsna.CanadianBorderDefense.Bullet.FLYER, this, _local3);
if (shotsFired == 0) {
shotsFired = ((shotsFired+1));
_local4 = new Sound(_root);
_local4.attachSound("tower flyer");
_local4.start();
} else {
shotsFired = ((shotsFired+1));
if (shotsFired <= 50) {
break;
}
shotsFired = (0);
}
}
}
function addHealth(val) {
health = health + val;
if (health <= 0) {
if (!dead) {
_root.game.killTower(this);
dead = (true);
}
}
}
function get health() {
return(_health);
}
function set health(val) {
if (val > maxHealth) {
val = maxHealth;
}
_health = val;
//return(health);
}
function get dead() {
return(_dead);
}
function set dead(val) {
_dead = val;
//return(dead);
}
function get maxHealth() {
return(_maxHealth);
}
function set maxHealth(val) {
_maxHealth = val;
//return(maxHealth);
}
function set underConstruction(val) {
_underConstruction = val;
//return(underConstruction);
}
function get underConstruction() {
return(_underConstruction);
}
function get width() {
return(clip.tower._width);
}
function get height() {
return(clip.tower._height);
}
function get x() {
return(clip._x);
}
function set x(val) {
clip._x = val;
//return(x);
}
function get y() {
return(clip._y);
}
function set y(val) {
clip._y = val;
//return(y);
}
function get clip() {
return(_clip);
}
function set clip(val) {
_clip = val;
//return(clip);
}
function set type(val) {
_type = val;
//return(type);
}
function get type() {
return(_type);
}
function set firingRate(val) {
_firingRate = val;
//return(firingRate);
}
function get firingRate() {
return(_firingRate);
}
function get freezing() {
return(_freezing);
}
function set freezing(val) {
_freezing = val;
//return(freezing);
}
function set range(val) {
_range = val;
//return(range);
}
function get range() {
return(_range);
}
function set splashRange(val) {
_splashRange = val;
//return(splashRange);
}
function get splashRange() {
return(_splashRange);
}
function set splashDamage(val) {
_splashDamage = val;
//return(splashDamage);
}
function get splashDamage() {
return(_splashDamage);
}
function set cost(val) {
_cost = val;
//return(cost);
}
function get cost() {
return(_cost);
}
function get enemyList() {
return(_enemyList);
}
function set enemyList(val) {
_enemyList = val;
//return(enemyList);
}
function get firstEnemy() {
return(enemyList[0]);
}
function get damage() {
return(_damage);
}
function set damage(val) {
_damage = val;
//return(damage);
}
function get freezingTime() {
return(_freezingTime);
}
function set freezingTime(val) {
_freezingTime = val;
//return(freezingTime);
}
function get freezeResetTime() {
return(_freezeResetTime);
}
function set freezeResetTime(val) {
_freezeResetTime = val;
//return(freezeResetTime);
}
function get ableToFreeze() {
return(_ableToFreeze);
}
function set ableToFreeze(val) {
_ableToFreeze = val;
//return(ableToFreeze);
}
function set viewingDetails(val) {
_viewingDetails = val;
if (!val) {
if (!clip.tower.hitTest(_xmouse + _root._x, _ymouse + _root._)) {
hideStatus();
hideRange();
}
_towerViewing = null;
} else {
if ((_towerViewing != undefined) && (_towerViewing != null)) {
_towerViewing.hideStatus();
_towerViewing.hideRange();
_towerViewing.viewingDetails = false;
}
_towerViewing = this;
}
//return(viewingDetails);
}
function get viewingDetails() {
return(_viewingDetails);
}
function get upgrades() {
return(_upgrades);
}
function set upgrades(val) {
_upgrades = val;
//return(upgrades);
}
function get upgradeProgress() {
return(_upgradeProgress);
}
function set upgradeProgress(val) {
_upgradeProgress = val;
//return(upgradeProgress);
}
function get amtUpgraded() {
return(_amtUpgraded);
}
function set amtUpgraded(val) {
_amtUpgraded = val;
//return(amtUpgraded);
}
function get value() {
return(_value);
}
function set value(val) {
if (val < 0) {
val = 0;
}
_value = val;
//return(value);
}
function get row() {
return(_row);
}
function set row(val) {
_row = val;
//return(row);
}
function get column() {
return(_column);
}
function set column(val) {
_column = val;
//return(column);
}
function get nukeConstructionAmt() {
return(_nukeConstructionAmt);
}
function set nukeConstructionAmt(val) {
_nukeConstructionAmt = val;
//return(nukeConstructionAmt);
}
function get nukeBuildTime() {
return(_nukeBuildTime);
}
function set nukeBuildTime(val) {
_nukeBuildTime = val;
//return(nukeBuildTime);
}
function get bayOpen() {
return(_bayOpen);
}
function set bayOpen(val) {
_bayOpen = val;
//return(bayOpen);
}
function get nukeReady() {
return(_nukeReady);
}
function set nukeReady(val) {
_nukeReady = val;
//return(nukeReady);
}
function get shotsFired() {
return(_shotsFired);
}
function set shotsFired(val) {
_shotsFired = val;
//return(shotsFired);
}
static var ARROW = 1;
static var ARROW_COST = 40;
static var CANNON = 2;
static var CANNON_COST = 70;
static var FLYER = 3;
static var FLYER_COST = 60;
static var FIRE = 4;
static var FIRE_COST = 190;
static var FREEZE = 5;
static var FREEZE_COST = 110;
static var NUKE = 6;
static var NUKE_COST = 400;
static var towerCounter = 0;
static var UPGRADE_TIME = 5;
}
Symbol 546 MovieClip [__Packages.net.icsna.CanadianBorderDefense.Bullet] Frame 0
class net.icsna.CanadianBorderDefense.Bullet
{
var _clip, _speed, _angle, _dx, _dy, _type, _target, _tower;
function Bullet (bulletType, shooter, enemy) {
clip = (_root.bulletHolder.attachMovie("bullet", "bullet" + bulletCounter, ++bulletCounter));
type = (bulletType);
target = (enemy);
tower = (shooter);
clip.gotoAndStop(type);
clip._x = shooter.x + (shooter.width / 2);
clip._y = shooter.y + (shooter.height / 2);
if (type == FLYER) {
speed = (5);
} else {
speed = (15);
}
angle = (findAngle());
clip._rotation = net.icsna.utils.ICSNAMath.toDegrees(angle);
dx = (Math.cos(angle) * speed);
dy = (Math.sin(angle) * speed);
}
function findAngle() {
var _local3 = (target.x + target.clip.canadian._x) - x;
var _local2 = (target.y + target.clip.canadian._y) - y;
return(Math.atan2(_local2, _local3));
}
function update() {
angle = (findAngle());
if (!angle) {
_root.game.removeBullet(this);
}
clip._rotation = net.icsna.utils.ICSNAMath.toDegrees(angle);
dx = (Math.cos(angle) * speed);
dy = (Math.sin(angle) * speed);
x = x + dx;
y = y + dy;
if ((((x < 0) || (x > _root.board._width)) || (y < 0)) || (y > _root.board._height)) {
_root.game.removeBullet(this);
}
if (target.clip.canadian.hitTest(x + _root._x, y + _root._y, true)) {
if (type == CANNON) {
if (tower.upgrades[1] == 0) {
var _local3 = _root.attachMovie("small cannon explosion", "explosion" + (explosionCount++), _root.getNextHighestDepth());
} else {
var _local3 = _root.attachMovie("large cannon explosion", "explosion" + (explosionCount++), _root.getNextHighestDepth());
}
_local3._x = x;
_local3._y = y;
}
if (!target.dead) {
target.addHealth(-tower.damage);
if (type == CANNON) {
}
doSplashDamage();
}
_root.game.removeBullet(this);
}
}
function doSplashDamage() {
var _local7 = _root.game.enemyController.canadians;
var _local4 = 0;
while (_local4 < _local7.length) {
var _local3 = _local7[_local4];
if (_local3 == tower.firstEnemy) {
} else {
var _local6 = net.icsna.utils.ICSNAMath.dist(x, y, _local3.x + (_local3.clip.canadian._width / 2), _local3.y + (_local3.clip.canadian._height / 2));
var _local5 = tower.splashRange + (_local3.clip.canadian._width / 2);
if (_local6 < _local5) {
_local3.addHealth(-tower.splashDamage);
}
}
_local4++;
}
}
function get clip() {
return(_clip);
}
function set clip(val) {
_clip = val;
//return(clip);
}
function get x() {
return(clip._x);
}
function set x(val) {
clip._x = val;
//return(x);
}
function get y() {
return(clip._y);
}
function set y(val) {
clip._y = val;
//return(y);
}
function get speed() {
return(_speed);
}
function set speed(val) {
_speed = val;
//return(speed);
}
function get angle() {
return(_angle);
}
function set angle(val) {
_angle = val;
//return(angle);
}
function get dx() {
return(_dx);
}
function set dx(val) {
_dx = val;
//return(dx);
}
function get dy() {
return(_dy);
}
function set dy(val) {
_dy = val;
//return(dy);
}
function get type() {
return(_type);
}
function set type(val) {
_type = val;
//return(type);
}
function get target() {
return(_target);
}
function set target(val) {
_target = val;
//return(target);
}
function get tower() {
return(_tower);
}
function set tower(val) {
_tower = val;
//return(tower);
}
static var ARROW = 1;
static var CANNON = 2;
static var FLYER = 3;
static var PUCK = 4;
static var LASER = 5;
static var KISS = 6;
static var NOTE = 7;
static var BOOK = 8;
static var explosionCount = 0;
static var bulletCounter = 0;
}
Symbol 547 MovieClip [__Packages.net.icsna.CanadianBorderDefense.NukeTower] Frame 0
class net.icsna.CanadianBorderDefense.NukeTower extends net.icsna.CanadianBorderDefense.Tower
{
var __get__clip, __set__cost, __set__value, __get__cost, __set__nukeReady, __set__bayOpen, __set__nukeBuildTime, __set__range, __set__splashRange, __set__damage, __set__nukeConstructionAmt, nukeBuildTime, __get__x, __get__nukeBuildTime, __get__nukeConstructionAmt, __get__nukeReady, __get__bayOpen, __get__underConstruction, __set__amtUpgraded, __get__amtUpgraded, __set__upgradeProgress, __get__upgradeProgress, progressMC, __set__underConstruction, currentUpgrade, __get__upgrades, splashRange;
function NukeTower () {
super(net.icsna.CanadianBorderDefense.Tower.NUKE);
__get__clip().nukeBar._visible = false;
__set__cost(net.icsna.CanadianBorderDefense.Tower.NUKE_COST);
__set__value(Math.floor(__get__cost() * 0.75));
__set__nukeReady(true);
__set__bayOpen(false);
__set__nukeBuildTime(2480);
__set__range(37);
__set__splashRange(60);
__set__damage(100);
__set__nukeConstructionAmt(nukeBuildTime);
}
function showRange() {
}
function hideRange() {
}
function showStatus() {
super.showStatus();
__get__clip().nukeBar._visible = true;
if ((__get__x() + __get__clip().nukeBar._x) < 0) {
__get__clip().nukeBar._x = __get__clip().tower._x + __get__clip().tower._width;
} else {
__get__clip().nukeBar._x = -__get__clip().nukeBar._width;
}
}
function hideStatus() {
super.hideStatus();
}
function updateStatusBars() {
super.updateStatusBars();
var _local3 = __get__nukeConstructionAmt() / __get__nukeBuildTime();
__get__clip().nukeBar.nukeMeter._xscale = _local3 * 100;
}
function update() {
super.update();
if (__get__nukeReady() && (!__get__bayOpen())) {
__set__bayOpen(true);
__get__clip().tower.nukeSilo.play();
var _local4 = new Sound(_root);
_local4.attachSound("nuke bay open");
_local4.start();
} else if (!__get__nukeReady()) {
if (__get__underConstruction() || (_root.game.gameMode == "waiting")) {
return(undefined);
}
__set__nukeConstructionAmt((__get__nukeConstructionAmt()+1));
if (__get__nukeConstructionAmt() >= __get__nukeBuildTime()) {
__set__nukeConstructionAmt(nukeBuildTime);
__set__nukeReady(true);
}
}
}
function checkToFire() {
}
function handleUpgradeProgress() {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
__set__amtUpgraded((__get__amtUpgraded()+1));
__set__upgradeProgress(Math.floor((__get__amtUpgraded() / (net.icsna.CanadianBorderDefense.Tower.UPGRADE_TIME * 31)) * 100));
if (__get__upgradeProgress() >= 100) {
delete progressMC.onEnterFrame;
__set__underConstruction(false);
__get__clip().constructionOverlay._visible = false;
__get__clip().tower._visible = true;
__get__upgrades()[currentUpgrade]++;
if (currentUpgrade == 0) {
nukeBuildTime = nukeBuildTime * 0.7;
if (__get__nukeReady()) {
__set__nukeConstructionAmt(nukeBuildTime);
}
} else {
splashRange = splashRange * 1.5;
}
}
}
function handleRelease() {
if ((_root.game.gameMode == "waiting") || (_root.game.gameMode == "placing tower")) {
return(undefined);
}
super.handleRelease();
if (__get__nukeReady() && (_root.game.gameMode != "shooting nuke")) {
_root.game.gameMode = "shooting nuke";
_root.attachMovie("nuke reticule", "nukeReticule", 50);
_root.nukeReticule._x = _xmouse;
_root.nukeReticule._y = _ymouse;
_root.game.nukeTowerSelected = this;
}
}
static var radiationDamage = 0.5;
}
Symbol 548 MovieClip [__Packages.net.icsna.CanadianBorderDefense.ArrowTower] Frame 0
class net.icsna.CanadianBorderDefense.ArrowTower extends net.icsna.CanadianBorderDefense.Tower
{
var __set__cost, __set__value, __get__cost, __set__range, __set__firingRate, __set__damage, _timeToFire, firingRate, __set__amtUpgraded, __get__amtUpgraded, __set__upgradeProgress, __get__upgradeProgress, progressMC, __set__underConstruction, __get__clip, currentUpgrade, __get__upgrades, range, damage;
function ArrowTower () {
super(net.icsna.CanadianBorderDefense.Tower.ARROW);
__set__cost(net.icsna.CanadianBorderDefense.Tower.ARROW_COST);
__set__value(Math.floor(__get__cost() * 0.75));
__set__range(100);
__set__firingRate(28);
__set__damage(4);
_timeToFire = firingRate;
}
function handleUpgradeProgress() {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
__set__amtUpgraded((__get__amtUpgraded()+1));
__set__upgradeProgress(Math.floor((__get__amtUpgraded() / (net.icsna.CanadianBorderDefense.Tower.UPGRADE_TIME * 31)) * 100));
if (__get__upgradeProgress() >= 100) {
delete progressMC.onEnterFrame;
__set__underConstruction(false);
__get__clip().constructionOverlay._visible = false;
__get__clip().tower._visible = true;
__get__upgrades()[currentUpgrade]++;
if (currentUpgrade == 0) {
range = range * 1.8;
} else {
damage = damage * 1.5;
}
}
}
}
Symbol 549 MovieClip [__Packages.net.icsna.CanadianBorderDefense.CannonTower] Frame 0
class net.icsna.CanadianBorderDefense.CannonTower extends net.icsna.CanadianBorderDefense.Tower
{
var __set__cost, __set__value, __get__cost, __set__range, __set__splashRange, __set__firingRate, __set__damage, __set__splashDamage, _timeToFire, firingRate, __set__amtUpgraded, __get__amtUpgraded, __set__upgradeProgress, __get__upgradeProgress, progressMC, __set__underConstruction, __get__clip, currentUpgrade, __get__upgrades, damage, splashDamage;
function CannonTower () {
super(net.icsna.CanadianBorderDefense.Tower.CANNON);
__set__cost(net.icsna.CanadianBorderDefense.Tower.CANNON_COST);
__set__value(Math.floor(__get__cost() * 0.75));
__set__range(65);
__set__splashRange(35);
__set__firingRate(80);
__set__damage(15);
__set__splashDamage(8);
_timeToFire = firingRate;
}
function handleUpgradeProgress() {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
__set__amtUpgraded((__get__amtUpgraded()+1));
__set__upgradeProgress(Math.floor((__get__amtUpgraded() / (net.icsna.CanadianBorderDefense.Tower.UPGRADE_TIME * 31)) * 100));
if (__get__upgradeProgress() >= 100) {
delete progressMC.onEnterFrame;
__set__underConstruction(false);
__get__clip().constructionOverlay._visible = false;
__get__clip().tower._visible = true;
__get__upgrades()[currentUpgrade]++;
if (currentUpgrade == 0) {
__set__range(100);
} else {
__set__firingRate(100);
__set__splashRange(60);
damage = damage * 1.5;
splashDamage = splashDamage * 1.5;
}
}
}
}
Symbol 550 MovieClip [__Packages.net.icsna.CanadianBorderDefense.FlyerTower] Frame 0
class net.icsna.CanadianBorderDefense.FlyerTower extends net.icsna.CanadianBorderDefense.Tower
{
var __set__shotsFired, __set__cost, __set__value, __get__cost, __set__range, __set__firingRate, __set__damage, _timeToFire, firingRate, __set__amtUpgraded, __get__amtUpgraded, __set__upgradeProgress, __get__upgradeProgress, progressMC, __set__underConstruction, __get__clip, currentUpgrade, __get__upgrades;
function FlyerTower () {
super(net.icsna.CanadianBorderDefense.Tower.FLYER);
__set__shotsFired(0);
__set__cost(net.icsna.CanadianBorderDefense.Tower.FLYER_COST);
__set__value(Math.floor(__get__cost() * 0.75));
__set__range(120);
__set__firingRate(30);
__set__damage(9);
_timeToFire = firingRate;
}
function handleUpgradeProgress() {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
__set__amtUpgraded((__get__amtUpgraded()+1));
__set__upgradeProgress(Math.floor((__get__amtUpgraded() / (net.icsna.CanadianBorderDefense.Tower.UPGRADE_TIME * 31)) * 100));
if (__get__upgradeProgress() >= 100) {
delete progressMC.onEnterFrame;
__set__underConstruction(false);
__get__clip().constructionOverlay._visible = false;
__get__clip().tower._visible = true;
__get__upgrades()[currentUpgrade]++;
if (currentUpgrade == 0) {
firingRate = firingRate / 2;
}
}
}
}
Symbol 551 MovieClip [__Packages.net.icsna.CanadianBorderDefense.FireTower] Frame 0
class net.icsna.CanadianBorderDefense.FireTower extends net.icsna.CanadianBorderDefense.Tower
{
var __set__cost, __set__value, __get__cost, __set__range, __set__firingRate, __set__damage, _timeToFire, firingRate, __set__amtUpgraded, __get__amtUpgraded, __set__upgradeProgress, __get__upgradeProgress, progressMC, __set__underConstruction, __get__clip, currentUpgrade, __get__upgrades, damage, _fireLength;
function FireTower () {
super(net.icsna.CanadianBorderDefense.Tower.FIRE);
__set__cost(net.icsna.CanadianBorderDefense.Tower.FIRE_COST);
__set__value(Math.floor(__get__cost() * 0.75));
__set__range(65);
__set__firingRate(120);
__set__damage(0.16);
fireLength = (80);
_timeToFire = firingRate;
}
function handleUpgradeProgress() {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
__set__amtUpgraded((__get__amtUpgraded()+1));
__set__upgradeProgress(Math.floor((__get__amtUpgraded() / (net.icsna.CanadianBorderDefense.Tower.UPGRADE_TIME * 31)) * 100));
if (__get__upgradeProgress() >= 100) {
delete progressMC.onEnterFrame;
__set__underConstruction(false);
__get__clip().constructionOverlay._visible = false;
__get__clip().tower._visible = true;
__get__upgrades()[currentUpgrade]++;
if (currentUpgrade == 0) {
fireLength = fireLength * 1.8;
firingRate = firingRate * 1.1;
} else {
damage = damage * 1.8;
firingRate = firingRate * 1.1;
}
}
}
function fireBullet(enemyList) {
sprayFire(enemyList);
__get__clip().tower.gotoAndPlay("flame" + (1 + __get__upgrades()[1]));
var _local3 = new Sound(_root);
_local3.attachSound("tower fire");
_local3.start();
}
function sprayFire(enemyList) {
var _local3 = 0;
while (_local3 < enemyList.length) {
var _local2 = enemyList[_local3];
if (_local2.onFire) {
} else {
_local2.onFire = true;
_local2.fireDamage = damage;
_local2.fireLength = fireLength;
_local2.clip.flame._visible = true;
}
_local3++;
}
}
function get fireLength() {
return(_fireLength);
}
function set fireLength(val) {
_fireLength = val;
//return(fireLength);
}
}
Symbol 552 MovieClip [__Packages.net.icsna.CanadianBorderDefense.FreezeTower] Frame 0
class net.icsna.CanadianBorderDefense.FreezeTower extends net.icsna.CanadianBorderDefense.Tower
{
var __get__clip, __set__cost, __set__value, __get__cost, __set__range, __set__freezingTime, __set__freezeResetTime, __set__ableToFreeze, __set__amtUpgraded, __get__amtUpgraded, __set__upgradeProgress, __get__upgradeProgress, progressMC, __set__underConstruction, currentUpgrade, __get__upgrades;
function FreezeTower () {
super(net.icsna.CanadianBorderDefense.Tower.FREEZE);
__get__clip().tower.onOff.gotoAndStop(1);
__set__cost(net.icsna.CanadianBorderDefense.Tower.FREEZE_COST);
__set__value(Math.floor(__get__cost() * 0.75));
__set__range(50);
__set__freezingTime(93);
__set__freezeResetTime(279);
__set__ableToFreeze(true);
}
function handleUpgradeProgress() {
if (_root.game.gameMode == "waiting") {
return(undefined);
}
__set__amtUpgraded((__get__amtUpgraded()+1));
__set__upgradeProgress(Math.floor((__get__amtUpgraded() / (net.icsna.CanadianBorderDefense.Tower.UPGRADE_TIME * 31)) * 100));
if (__get__upgradeProgress() >= 100) {
delete progressMC.onEnterFrame;
__set__underConstruction(false);
__get__clip().constructionOverlay._visible = false;
__get__clip().tower._visible = true;
__get__upgrades()[currentUpgrade]++;
}
}
}
Symbol 553 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 554 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 555 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 556 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 388 MovieClip Frame 1
play_mc.gotoAndStop(1);
var snd = new Sound(_root);
snd.attachSound("intro guns");
snd.start();
Symbol 388 MovieClip Frame 38
var snd = new Sound(_root);
snd.attachSound("tower flyer");
snd.start();
Symbol 388 MovieClip Frame 68
stop();
var snd = new Sound(_root);
snd.attachSound("music america rock");
snd.start(0, 3);
Symbol 408 MovieClip Frame 1
stop();
Symbol 408 MovieClip Frame 2
stop();
Symbol 442 MovieClip Frame 1
this.type = "range";
this.cost = 30;
Symbol 442 MovieClip Frame 2
this.type = "range";
this.cost = 40;
Symbol 442 MovieClip Frame 3
this.type = "firing rate";
this.cost = 60;
Symbol 442 MovieClip Frame 4
this.type = "longer burning";
this.cost = 100;
Symbol 442 MovieClip Frame 5
this.type = "more beer";
this.cost = 80;
Symbol 442 MovieClip Frame 6
this.type = "mass production";
this.cost = 500;
Symbol 467 MovieClip Frame 1
this.type = "damage";
this.cost = 40;
Symbol 467 MovieClip Frame 2
this.type = "splash range";
this.cost = 60;
Symbol 467 MovieClip Frame 3
this.type = "ground attack";
this.cost = 100;
Symbol 467 MovieClip Frame 4
this.type = "lighter fluid";
this.cost = 130;
Symbol 467 MovieClip Frame 5
this.type = "better sign";
this.cost = 100;
Symbol 467 MovieClip Frame 6
this.type = "splash range";
this.cost = 300;