Frame 1
totalBytes = Math.round(getBytesTotal() / 1024);
loadedBytes = Math.round(getBytesLoaded() / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);
if (_root._framesloaded >= _root._totalframes) {
gotoAndStop ("game");
}
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=7&fv=") + fv) + "&v=") + escape(getVersion())) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
__com_mochibot__("8859a339", this, 10301, true);
Instance of Symbol 155 MovieClip in Frame 1
onClipEvent (enterFrame) {
_xscale = _root.percentDone;
}
Frame 2
gotoAndPlay (1);
Frame 3
Frame 4
function onEnterFrame() {
game.FrameTick();
game.CommTick();
}
var game = new Game();
var keyListener = new Object();
keyListener.onKeyDown = function () {
if ((_root.game.gridField.dragTower != undefined) && (Key.isDown(27))) {
_root.game.CancelSelect();
}
if (Key.isDown(16)) {
game.shiftDown = true;
}
if (Key.isDown(85)) {
game.KeyPress(85);
}
if (Key.isDown(83)) {
game.KeyPress(83);
}
};
keyListener.onKeyUp = function () {
if (!Key.isDown(27)) {
game.shiftDown = false;
}
};
Key.addListener(keyListener);
game.SetMap(28, 24, 50, 68, 14, 9, 14, 10, 17);
game.ShowStart();
score.text = _root.game.score;
Instance of Symbol 190 MovieClip "scoreBoard" in Frame 4
onClipEvent (load) {
swapDepths(5001);
}
Instance of Symbol 180 MovieClip "Interface" in Frame 4
onClipEvent (load) {
swapDepths(5000);
}
Symbol 22 MovieClip [PauseOverlay] Frame 1
function Show() {
fade = 0;
this.cacheAsBitmap = true;
this._visible = true;
this._alpha = fade;
this.onEnterFrame = function () {
fade = fade + 20;
this._alpha = fade;
if (fade >= 80) {
this.cacheAsBitmap = false;
this._alpha = 80;
this.onEnterFrame = "";
}
};
}
function Hide() {
fade = 80;
this.cacheAsBitmap = true;
this.onEnterFrame = function () {
fade = fade - 10;
this._alpha = fade;
if (fade <= 0) {
this.cacheAsBitmap = false;
this._visible = false;
this._alpha = 0;
this.onEnterFrame = "";
}
};
}
var fade;
Instance of Symbol 38 MovieClip "btnStart" in Symbol 39 MovieClip [Top] Frame 1
onClipEvent (load) {
msg.text = "START";
}
on (press) {
if (_root.game.gameState > 2) {
return(undefined);
}
if (_root.game.gameState == -1) {
return(undefined);
}
if (msg.text == "START") {
_root.game.Start();
} else if (msg.text == "PAUSE") {
_root.game.Pause();
} else if (msg.text == "RESUME") {
_root.game.Resume();
}
_root.game.PlayButtonSound();
}
Instance of Symbol 38 MovieClip "btnReset" in Symbol 39 MovieClip [Top] Frame 1
onClipEvent (load) {
msg.text = "RESET";
}
on (press) {
if (_root.game.gameState == -1) {
return(undefined);
}
_root.game.ShowStart();
_root.game.PlayButtonSound();
}
Symbol 46 MovieClip Frame 1
function SetPercentage(p) {
this.innerBar._width = 160 * p;
}
Symbol 62 MovieClip [UpgradePanel] Frame 1
#initclip 22
Object.registerClass("UpgradePanel", UpgradePanel);
#endinitclip
Instance of Symbol 60 MovieClip "upgradeButton" in Symbol 62 MovieClip [UpgradePanel] Frame 1
on (press) {
if (_root.game.gameState == 1) {
this._parent.Upgrade();
} else if (_root.game.gameState < 2) {
_root.game.UpgradeSelectedTower(true);
_root.game.SelectCell(this._parent.tower.topLeftCell.row, this._parent.tower.topLeftCell.col);
}
}
Symbol 67 MovieClip [LevelBarItem] Frame 1
var txt;
var fc;
var lvl;
level.text = txt;
levelNum.num.text = lvl;
levelNum.filters = [new flash.filters.GlowFilter(16750848, 0.8, 5, 5, 2, 3)];
lineStyle(2, 0, 100);
beginFill(fc, 100);
moveTo(0, 0);
lineTo(60, 0);
lineTo(60, 30);
lineTo(0, 30);
lineTo(0, 0);
endFill();
cacheAsBitmap = true;
Symbol 68 MovieClip [LevelBar] Frame 1
#initclip 14
Object.registerClass("LevelBar", LevelBar);
#endinitclip
Symbol 88 MovieClip [InfoPanel] Frame 1
#initclip 15
Object.registerClass("InfoPanel", InfoPanel);
#endinitclip
Instance of Symbol 83 MovieClip "sell" in Symbol 88 MovieClip [InfoPanel] Frame 1
on (press) {
_root.game.SellSelectedTower();
}
Instance of Symbol 87 MovieClip "close" in Symbol 88 MovieClip [InfoPanel] Frame 1
on (press) {
_root.game.CancelSelect();
}
Symbol 110 MovieClip Frame 1
function SetPips(num) {
pip1._visible = num > 0;
pip2._visible = num > 1;
pip3._visible = num > 2;
pip4._visible = num > 3;
pip5._visible = num > 4;
}
pip1._visible = false;
pip2._visible = false;
pip3._visible = false;
pip4._visible = false;
pip5._visible = false;
Symbol 121 MovieClip [Tower] Frame 1
#initclip 16
Object.registerClass("Tower", Tower);
#endinitclip
Symbol 123 MovieClip [ShotSpray] Frame 1
#initclip 17
Object.registerClass("ShotSpray", ShotSpray);
#endinitclip
Symbol 130 MovieClip [Shot] Frame 1
#initclip 18
Object.registerClass("Shot", Shot);
#endinitclip
Symbol 138 MovieClip [Grid] Frame 1
#initclip 19
Object.registerClass("Grid", Grid);
#endinitclip
Symbol 140 MovieClip [Fragment] Frame 1
#initclip 20
Object.registerClass("Fragment", Fragment);
#endinitclip
Symbol 151 MovieClip [Creep] Frame 1
#initclip 21
Object.registerClass("Creep", Creep);
#endinitclip
Symbol 153 MovieClip [Bounty] Frame 1
function SetBounty() {
bounty.text = "+" + num;
}
function onEnterFrame() {
if (speed > -1) {
_y = (_y - speed);
speed = speed - 0.1;
}
ticks++;
if (ticks > 35) {
removeMovieClip(this);
}
}
var ticks = 0;
var speed = 1.3;
var num;
SetBounty();
Symbol 210 MovieClip [__Packages.LevelBar] Frame 0
class LevelBar extends MovieClip
{
var setMask, attachMovie, getNextHighestDepth, removeMovieClip, increment, posX, _x;
function LevelBar () {
super();
}
function CreateLevels(levels) {
Clear();
setMask();
var _local3 = 1;
while (_local3 < levels.length) {
var _local11 = levels[_local3];
var _local10;
var _local4 = _local11.color;
var _local5 = HEXtoRGB(_local4);
if (_local11.immune) {
_local10 = "IMMUNE";
} else if (_local11.flying) {
_local10 = "FLYING";
} else if (_local11.speed > 1) {
_local10 = "FAST";
} else if (_local11.delay < 25) {
_local10 = "GROUP";
} else {
_local10 = "NORMAL";
}
if (_local11.count < 5) {
_local10 = "BOSS";
}
attachMovie("LevelBarItem", "levelBarItem" + (_local3 - 1), _local3 - 1, {_x:(_local3 - 1) * 60, _y:0, txt:_local10, fc:_local4, lvl:_local11.level});
_local3++;
}
Reset();
setMask(_root.Interface.levelMaskBar);
}
function Clear() {
var _local2 = 0;
while (_local2 < getNextHighestDepth()) {
(removeMovieClip());// not popped
_local2++;
}
}
function HEXtoRGB(hex) {
var _local1 = (isNaN(hex) ? (parseInt(hex, 16)) : (hex));
var _local4 = _local1 >> 16;
var _local5 = (_local1 ^ (_local4 << 16)) >> 8;
var _local3 = (_local1 ^ (_local4 << 16)) ^ (_local5 << 8);
return({r:_local4, g:_local5, b:_local3});
}
function SetLevel(level, timeToLevel, lastLevel) {
if (!lastLevel) {
increment = 60 / (timeToLevel * 24);
posX = 60 + ((-level) * 60);
} else {
increment = 0;
posX = 60 + ((-level) * 60);
}
_x = posX;
}
function onEnterFrame() {
if (_root.game.gameState == 1) {
posX = posX - increment;
_x = int(posX);
}
}
function Reset() {
_x = 60;
}
}
Symbol 211 MovieClip [__Packages.InfoPanel] Frame 0
class InfoPanel extends MovieClip
{
var _visible, filters, towerObj, towerBtn, tower, creep, creepPanelDetails, towerName, desc, panelDetails, sell, close;
function InfoPanel () {
super();
_visible = false;
filters = [new flash.filters.GlowFilter(16750848, 0.8, 10, 10, 2, 3)];
}
function GetSpeed(hr) {
if (hr < 7) {
return("very fast");
}
if (hr < 13) {
return("fast");
}
if (hr < 37) {
return("average");
}
if (hr < 61) {
return("slow");
}
return("very slow");
}
function CheckGold() {
if (towerObj) {
if (towerObj.cost > _root.game.gold) {
towerBtn.filters = [new flash.filters.GlowFilter(10027008, 0.8, 10, 10, 2, 3)];
} else {
towerBtn.filters = [new flash.filters.GlowFilter(39168, 0.8, 10, 10, 2, 3)];
}
}
}
function SetCreep(c) {
tower = undefined;
towerObj = undefined;
towerBtn = undefined;
creep = c;
with (creepPanelDetails) {
_visible = true;
flying.text = (c.flying ? "Yes" : "No");
immune.text = (c.immune ? "Yes" : "No");
health.text = c.health;
speed.text = c.speed;
}
towerName.text = (((c.size == 150) ? "BOSS" : "Creep") + " Level ") + c.level;
desc.text = "";
panelDetails._visible = false;
_visible = true;
sell._visible = false;
close._visible = true;
}
function onEnterFrame() {
if (creep) {
creepPanelDetails.health.text = creep.health;
}
}
function SetTowerInfo(to, btn) {
if ((!tower) && (!creep)) {
with (panelDetails) {
cost.text = to.cost;
damage.text = to.damage;
range.text = to.range;
speed.text = GetSpeed(to.hitRate);
}
towerName.text = to.towerName;
desc.text = to.desc;
_visible = true;
sell._visible = false;
close._visible = false;
creepPanelDetails._visible = false;
towerObj = to;
towerBtn = btn;
}
}
function CancelInfo() {
if ((!tower) && (!creep)) {
_visible = false;
}
}
function SetTower(t) {
towerObj = undefined;
towerBtn = undefined;
creep = undefined;
tower = t;
with (panelDetails) {
_visible = true;
cost.text = t.cost;
damage.text = t.damage;
range.text = t.range;
speed.text = GetSpeed(t.hitRate);
}
towerName.text = t.towerName;
desc.text = t.desc;
creepPanelDetails._visible = false;
_visible = true;
close._visible = true;
if (t.topLeftCell) {
sell._visible = true;
sell.msg.text = "sell for " + int(t.cost * 0.75);
} else {
sell._visible = false;
}
}
function Cancel() {
_visible = false;
tower = undefined;
creep = undefined;
towerObj = undefined;
towerBtn = undefined;
}
}
Symbol 212 MovieClip [__Packages.Tower] Frame 0
class Tower extends MovieClip
{
var shotField, hTower, _visible, _width, _height, size, upgradeBar, gotoAndStop, towerType, shotTick, targetAngle, targetTick, scanTick, upTicks, upTickTotal, targets, targetNum, upObject, level, chassis, range, towerName, damage, hitRate, splash, slow, cost, pips, rotating, topLeftCell, selectFade, selectNum, filters, creeps, dragged, _x, _y, target;
function Tower () {
super();
creepField = _root.creepField;
shotField = _root.shotField;
hTower = _root.game.gridField.hTower;
_visible = false;
_width = (_height = _root.game.gridSize * size);
upgradeBar._visible = false;
gotoAndStop(towerType);
shotTick = 0;
size = 2;
targetAngle = 0;
targetTick = 0;
scanTick = 6;
upTicks = 0;
upTickTotal = 0;
targets = [];
targetNum = -1;
SetSelected(false);
}
function Upgrade(obj) {
upObject = obj;
upTickTotal = (2 + ((level - 1) * 4)) * 24;
upTicks = upTickTotal;
upgradeBar._visible = true;
upgradeBar._width = 0;
chassis._visible = false;
}
function ApplyUpgrade() {
var _local3 = upObject.range != range;
if (_local3) {
_root.game.ModifyTowerRangeBox(this, false);
}
towerName = upObject.towerName;
damage = upObject.damage;
range = upObject.range;
hitRate = upObject.hitRate;
splash = upObject.splash;
slow = upObject.slow;
cost = upObject.cost;
level = upObject.level;
if (_local3) {
_root.game.ModifyTowerRangeBox(this, true);
}
pips.SetPips(level - 1);
SetRotation();
upObject = undefined;
upTicks = 0;
upTickTotal = 0;
upgradeBar._visible = false;
chassis._visible = true;
}
function SetRotation() {
if (rotating) {
targetAngle = Math.random() * 360;
chassis.turret._rotation = targetAngle;
}
}
function SetSelected(tf) {
hTower._visible = tf;
select = tf;
if (tf) {
hTower._x = topLeftCell.left + 1;
hTower._y = topLeftCell.top + 1;
selectFade = 1;
selectNum = 50;
filters = [new flash.filters.GlowFilter(16750848, 0.5, 10, 10, 3, 3)];
} else {
selectFade = 0;
filters = [];
}
}
function FadeSelect() {
selectNum = selectNum + (selectFade * 5);
if (selectFade == 1) {
if (selectNum >= 50) {
selectFade = -1;
}
} else if (selectNum <= 0) {
selectFade = 1;
}
hTower._alpha = selectNum;
}
function TargetValid(c) {
if (c) {
if (c.flying) {
if (towerType == 4) {
ok = !c.forcedFly;
} else {
ok = towerType != 2;
}
} else if (c.immune) {
ok = (towerType != 5) && (towerType != 4);
} else {
ok = towerType != 4;
}
if (ok) {
ok = c.shotHealth > 0;
}
}
return(ok);
}
function AcquireTarget(num) {
var _local7 = [];
var _local3;
var _local6 = 0;
var _local5 = creeps.length;
var _local4 = targetNum;
targetTick = 0;
while (_local6 < _local5) {
_local6++;
_local4++;
if (_local4 > _local5) {
_local4 = 0;
}
var _local2 = creeps[_local4];
_local3 = false;
if (_local2) {
if (_local2.flying) {
if (towerType == 4) {
_local3 = !_local2.forcedFly;
} else {
_local3 = towerType != 2;
}
} else if (_local2.immune) {
_local3 = (towerType != 5) && (towerType != 4);
} else {
_local3 = towerType != 4;
}
if (_local3) {
if ((_local2.shotHealth > 0) && (InRange(_local2))) {
if (_local7.push(_local2) == num) {
break;
}
}
}
}
}
if (_local7.length > 0) {
targetNum = _local7[0].id;
} else {
targetNum = -1;
}
return(_local7);
}
function onEnterFrame() {
if (dragged) {
return(undefined);
}
if (selectFade != 0) {
FadeSelect();
}
if (_root.game.gameState != 1) {
return(undefined);
}
if (upTicks > 0) {
if ((--upTicks) == 0) {
ApplyUpgrade();
} else {
upgradeBar._width = (1 - (upTicks / upTickTotal)) * 20;
}
return(undefined);
}
shotTick--;
if (towerType == 4) {
if (_root.game.flyingCreeps) {
if (shotTick < 0) {
var _local3 = 0;
while (_local3 < targets.length) {
if (!InRange(targets[_local3])) {
targets.splice(_local3, 1);
} else {
_local3++;
}
}
if (targets.length < 4) {
targets = targets.concat(AcquireTarget(4 - targets.length));
}
var _local4 = [];
_local4.push([_x - 7, _y]);
_local4.push([_x + 7, _y]);
_local4.push([_x, _y + 7]);
_local4.push([_x, _y - 7]);
_local3 = 0;
while (_local3 < targets.length) {
Fire(targets[_local3], _local4[_local3][0], _local4[_local3][1], _local3 == 0);
_local3++;
}
shotTick = hitRate;
}
}
} else {
if (("" + target) == "") {
target = undefined;
targetTick = ((shotTick < scanTick) ? (shotTick) : (scanTick));
}
targetTick--;
if (target && (shotTick < 0)) {
if ((target.shotHealth > 0) && (InRange(target))) {
shotTick = hitRate;
Fire(target, _x, _y, true);
} else {
target = undefined;
targetTick = scanTick;
}
}
}
if (rotating) {
if (target) {
var _local6 = target._x - _x;
var _local5 = target._y - _y;
var _local7 = Math.round((Math.atan2(_local5, _local6) * 180) / Math.PI);
targetAngle = _local7;
}
chassis.turret._rotation = targetAngle;
}
}
function Fire(target, posX, posY, playsnd) {
var _local4 = shotField.getNextHighestDepth();
shotField.attachMovie("Shot", "shot" + _local4, _local4, {creeps:creeps, _x:posX, _y:posY, target:target, damage:damage, splash:splash, shotType:towerType, slow:slow, hitAir:towerType != 2, hitGround:towerType != 4});
target.shotHealth = target.shotHealth - damage;
if (playsnd) {
var _local3;
switch (towerType) {
case 1 :
_local3 = "eep.wav";
break;
case 2 :
_local3 = "kow.wav";
break;
case 3 :
_local3 = "pop.wav";
break;
case 4 :
_local3 = "zip.wav";
break;
case 5 :
_local3 = "frost.wav";
}
_root.game.PlaySound(_local3);
}
}
function InRange(c) {
var _local3 = _x - c._x;
var _local2 = _y - c._y;
var _local4 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (_local4 < range) {
return(true);
}
return(false);
}
}
Symbol 213 MovieClip [__Packages.Cell] Frame 0
class Cell
{
var creepCount, rangeTowers, parentCellsLR, nextCellLR, parentCellsUD, nextCellUD, pathID;
function Cell () {
ClearPath(true);
ClearPath(false);
creepCount = 0;
rangeTowers = [];
}
function AddRangeTower(t, partial) {
rangeTowers.push({id:t.id, tower:t, partial:partial});
}
function RemoveRangeTower(t) {
var _local2 = 0;
while (_local2 < rangeTowers.length) {
if (rangeTowers[_local2].id == t.id) {
rangeTowers.splice(_local2, 1);
break;
}
_local2++;
}
}
function ClearPath(LR) {
if (LR) {
parentCellsLR = [];
nextCellLR = undefined;
} else {
parentCellsUD = [];
nextCellUD = undefined;
}
pathID = 0;
}
}
Symbol 214 MovieClip [__Packages.Creep] Frame 0
class Creep extends MovieClip
{
var gridSize, offSet, jitterX, jitterY, startHealth, health, lastHealth, hCreepSlow, dead, entering, forcedFly, slowRatio, flying, speed, creep, _visible, size, color, cacheAsBitmap, slowTicks, angle, dx, dy, nowX, nextX, nowY, nextY, startDelay, cCell, endCell, LR, startCell, _x, _y, removeMovieClip, healthBar;
function Creep () {
super();
gridSize = _root.game.gridSize;
offSet = gridSize / 2;
jitterX = int(((Math.random() * gridSize) / 2) - (gridSize / 4));
jitterY = int(((Math.random() * gridSize) / 2) - (gridSize / 4));
startHealth = health;
lastHealth = startHealth;
hCreepSlow._visible = false;
dead = false;
entering = true;
forcedFly = false;
slowRatio = 1;
var _local4 = 1;
if (flying) {
_local4 = 2;
}
if (speed > 1) {
_local4 = 3;
}
creep.gotoAndStop(_local4);
hCreepSlow.gotoAndStop(_local4);
_visible = false;
}
function Init() {
creep._xscale = size;
creep._yscale = size;
hCreepSlow._xscale = size;
hCreepSlow._yscale = size;
var _local2 = HEXtoRGB(color);
creep._color = SetTint(_local2.r, _local2.g, _local2.b, 35);
cacheAsBitmap = true;
}
function onPress() {
_root.game.SelectCreep(this);
}
function SetTint(r, g, b, amount) {
var _local2 = new Object();
_local2.ra = (_local2.ga = (_local2.ba = 100 - amount));
var _local3 = amount / 100;
_local2.rb = r * _local3;
_local2.gb = g * _local3;
_local2.bb = b * _local3;
var _local4 = new Color(creep);
_local4.setTransform(_local2);
return(_local4);
}
function HEXtoRGB(hex) {
var _local1 = (isNaN(hex) ? (parseInt(hex, 16)) : (hex));
var _local4 = _local1 >> 16;
var _local5 = (_local1 ^ (_local4 << 16)) >> 8;
var _local3 = (_local1 ^ (_local4 << 16)) ^ (_local5 << 8);
return({r:_local4, g:_local5, b:_local3});
}
function SetSlow(slow, time) {
slowRatio = (100 - slow) / 100;
slowTicks = time;
hCreepSlow._visible = true;
}
function StopSlow() {
hCreepSlow._visible = false;
slowRatio = 1;
}
function SetDirection(fromCell, toCell) {
var _local4 = ((creep._rotation > 0) ? 180 : -180);
if (toCell.left == fromCell.left) {
angle = ((toCell.top > fromCell.top) ? 90 : -90);
} else if (toCell.top == fromCell.top) {
angle = ((toCell.left > fromCell.left) ? 0 : (_local4));
} else {
angle = ((toCell.left > fromCell.left) ? 0 : (_local4));
if (angle == 0) {
angle = ((toCell.top > fromCell.top) ? 45 : -45);
} else {
angle = ((toCell.top > fromCell.top) ? 135 : -135);
}
}
}
function SetSpeed() {
dx = 0;
dy = 0;
if (nextX == nowX) {
dy = ((nextY > nowY) ? (speed) : (-speed));
} else if (nextY == nowY) {
dx = ((nextX > nowX) ? (speed) : (-speed));
} else {
dx = ((nextX > nowX) ? (speed / 1.4) : ((-speed) / 1.4));
dy = ((nextY > nowY) ? (speed / 1.4) : ((-speed) / 1.4));
}
}
function onEnterFrame() {
var _local5;
if (_root.game.gameState != 1) {
return(undefined);
}
if (startDelay >= 0) {
if (startDelay == 0) {
Init();
}
startDelay--;
} else {
if (cCell == undefined) {
_visible = true;
entering = false;
if (flying) {
cCell = endCell;
nextX = endCell.left + offSet;
nextY = endCell.top + offSet;
if (LR) {
nowX = -14;
nowY = nextY;
angle = 0;
} else {
nowX = nextX;
nowY = -14;
angle = 90;
}
} else {
cCell = startCell;
cCell.creepCount++;
nextX = cCell.left + offSet;
nextY = cCell.top + offSet;
if (LR) {
nowX = -14;
nowY = nextY;
angle = 0;
} else {
nowX = nextX;
nowY = -14;
angle = 90;
}
}
SetSpeed();
}
if (slowTicks > 0) {
if ((--slowTicks) == 0) {
StopSlow();
}
}
nowX = nowX + (dx * slowRatio);
nowY = nowY + (dy * slowRatio);
var _local3 = creep._rotation;
if (angle == _local3) {
} else if (angle > _local3) {
_local3 = _local3 + 15;
creep._rotation = _local3;
hCreepSlow._rotation = _local3;
} else if (angle < _local3) {
_local3 = _local3 - 15;
creep._rotation = _local3;
hCreepSlow._rotation = _local3;
}
_x = nowX + jitterX;
_y = nowY + jitterY;
if ((Math.abs(nowX - nextX) < speed) && (Math.abs(nowY - nextY) < speed)) {
if (dead) {
_root.game.LoseALife(this);
(removeMovieClip());// not popped
return(undefined);
}
var _local4;
if (LR) {
_local4 = cCell.nextCellLR;
} else {
_local4 = cCell.nextCellUD;
}
cCell.creepCount--;
if (_local4 != undefined) {
SetDirection(cCell, _local4);
_local4.creepCount++;
nextX = _local4.left + offSet;
nextY = _local4.top + offSet;
nowX = cCell.left + offSet;
nowY = cCell.top + offSet;
cCell = _local4;
SetSpeed();
} else {
dead = true;
if (LR) {
nextX = nextX + 48;
nextY = nowY;
angle = 0;
} else {
nextY = nextY + 48;
nextX = nowX;
angle = 90;
}
SetSpeed();
}
}
if (health <= 0) {
_root.game.AddKill(this);
if (cCell) {
cCell.creepCount--;
}
(removeMovieClip());// not popped
} else if (health != lastHealth) {
healthBar._width = (health / startHealth) * 15;
lastHealth = health;
}
}
}
}
Symbol 215 MovieClip [__Packages.ShotSpray] Frame 0
class ShotSpray extends MovieClip
{
var tick, timeToSpawn, _x, _y, shotNum, shotCount, dx, dy, damage, timeToLive, removeMovieClip;
function ShotSpray () {
super();
tick = timeToSpawn;
}
function SetTarget(c, t) {
_x = t._x;
_y = t._y;
shotNum = shotCount;
dx = c._x - t._x;
dy = c._y - t._y;
var _local4 = Math.sqrt((dx * dx) + (dy * dy));
var _local2 = 10 / _local4;
dx = dx * _local2;
dy = dy * _local2;
}
function onEnterFrame() {
tick--;
if ((tick == 0) && (shotNum > 0)) {
var _local3 = _root.game.shotField.getNextHighestDepth();
_root.game.shotField.attachMovie("ShotSpray", "shot" + _local3, _local3, {_x:_x + dx, _y:_y + dy, dx:dx, dy:dy, shotCount:shotCount, shotNum:shotNum - 1, timeToSpawn:timeToSpawn, timeToLive:timeToLive, damage:damage});
}
if (tick <= (-timeToLive)) {
(removeMovieClip());// not popped
}
}
}
Symbol 216 MovieClip [__Packages.Shot] Frame 0
class Shot extends MovieClip
{
var gotoAndStop, shotType, _visible, tick, _xscale, _yscale, lineStyle, moveTo, lineTo, _x, target, _y, lastX, lastY, _rotation, splash, damage, slow, creeps, hitAir, hitGround, removeMovieClip;
function Shot () {
super();
(gotoAndStop(shotType));// not popped
pointAtTarget();
_visible = false;
switch (shotType) {
case 1 :
tick = 2;
speed = 5;
break;
case 2 :
tick = 2;
speed = 1;
accel = 0.1;
break;
case 3 :
tick = 4;
break;
case 4 :
speed = 1;
accel = 0.2;
tick = 1;
_xscale = (_yscale = 50);
break;
case 5 :
tick = 1;
}
}
function LaserTarget() {
lineStyle(1, 0, 100);
moveTo(0, 0);
lineTo(target._x - _x, target._y - _y);
_visible = true;
_root.game.AddExplosion(shotType, target._x, target._y, target.dx, target.dy);
}
function pointAtTarget() {
switch (shotType) {
case 1 :
break;
case 2 :
case 4 :
var _local3 = lastX - _x;
var _local2 = lastY - _y;
_rotation = Math.round((Math.atan2(_local2, _local3) * 180) / Math.PI);
break;
case 3 :
_rotation = _rotation + 40;
break;
case 5 :
_rotation = _rotation + 20;
}
}
function onEnterFrame() {
if (_root.game.gameState != 1) {
return(undefined);
}
if (("" + target) == "") {
target = undefined;
}
if ((--tick) == 0) {
_visible = true;
}
if (target) {
lastX = target._x;
lastY = target._y;
pointAtTarget();
}
if (accel > 0) {
speed = speed + accel;
}
var _local7 = lastX - _x;
var _local6 = lastY - _y;
var _local9 = Math.sqrt((_local7 * _local7) + (_local6 * _local6));
var _local8 = speed / _local9;
_x = _x + (_local7 * _local8);
_y = _y + (_local6 * _local8);
if ((Math.abs(_local7) < speed) && (Math.abs(_local6) < speed)) {
if (target) {
_root.game.AddExplosion(shotType, _x, _y, target.dx, target.dy);
} else {
_root.game.AddExplosion(shotType, _x, _y, 0, 0);
}
if (splash == 0) {
if (target) {
target.health = target.health - damage;
if ((slow > 0) && (!target.immune)) {
target.SetSlow(slow, 100);
}
}
} else {
var _local4;
var _local5 = 0;
while (_local5 < creeps.length) {
var _local3 = creeps[_local5];
if (_local3) {
if (_local3.flying) {
_local4 = hitAir;
} else {
_local4 = hitGround;
}
if (_local4) {
_local4 = (_local3.immune ? (!slow) : true);
}
if (_local4) {
if (InRange(_local3)) {
if (_local3 != target) {
_local3.shotHealth = _local3.shotHealth - damage;
_local3.health = _local3.health - damage;
} else {
_local3.health = _local3.health - damage;
}
if (slow > 0) {
_local3.SetSlow(slow, 100);
}
}
}
}
_local5++;
}
}
(removeMovieClip());// not popped
}
}
function InRange(c) {
var _local3 = _x - c._x;
var _local2 = _y - c._y;
var _local4 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (_local4 <= splash) {
return(true);
}
return(false);
}
var speed = 4;
var accel = 0;
}
Symbol 217 MovieClip [__Packages.Grid] Frame 0
class Grid extends MovieClip
{
var gotoAlpha, _alpha, active, hCell, showCell, hRange, hTower, rows, cols, startX, startY, gridSize, dragTower, cRow, cCol, hitTest, cCell, clear, lineStyle, cells, moveTo, lineTo, beginFill, endFill, cacheAsBitmap, createTextField, getNextHighestDepth;
function Grid () {
super();
gotoAlpha = 0;
_alpha = 0;
active = false;
hCell = _root.attachMovie("hCell", "hCell", 21);
hCell._visible = false;
hCell._alpha = 50;
showCell = false;
hRange = _root.attachMovie("hRange", "hRange", 20);
hRange._visible = false;
hRange._alpha = 30;
hTower = _root.attachMovie("hTower", "hTower", 30);
hTower._alpha = 65;
hTower._visible = false;
hCell.goldChar._visible = false;
}
function Init() {
rows = _root.game.cellRows;
cols = _root.game.cellCols;
startX = _root.game.startX;
startY = _root.game.startY;
gridSize = _root.game.gridSize;
}
function CheckGold() {
if (active) {
hCell.goldChar._visible = dragTower.cost > _root.game.gold;
}
}
function CancelSelect() {
hRange._visible = false;
}
function SelectTower(t) {
hRange._width = (hRange._height = t.range * 2);
hRange._x = t.topLeftCell.left + gridSize;
hRange._y = t.topLeftCell.top + gridSize;
hRange._visible = true;
}
function ToggleGrid() {
if (!_root.game.gridOn) {
gotoAlpha = 0;
}
if (_root.game.gridOn) {
gotoAlpha = 50;
}
active = true;
}
function FollowTower(t) {
if (!_root.game.gridOn) {
gotoAlpha = 50;
active = true;
}
showCell = true;
dragTower = t;
hCell._width = (gridSize * t.size) - 2;
hCell._height = hCell._width;
hRange._width = (hRange._height = t.range * 2);
rangeOffset = t._width / 2;
HighlightCell();
CheckGold();
}
function StopFollowTower() {
if (!_root.game.gridOn) {
gotoAlpha = 0;
active = true;
}
showCell = false;
hCell._visible = false;
hRange._visible = false;
cRow = -1;
cCol = -1;
hitTest = 4;
dragTower.dragged = false;
dragTower = undefined;
}
function onMouseMove() {
if (showCell && (_alpha > 0)) {
HighlightCell();
}
}
function onMouseDown() {
if (hitTest == 0) {
_root.game.DropTower(dragTower, cCell);
} else {
var _local6 = _root._xmouse;
var _local5 = _root._ymouse;
var _local4 = int((_local6 - startX) / gridSize);
var _local3 = int((_local5 - startY) / gridSize);
if (dragTower) {
if ((((((_local4 >= 0) && (_local4 < cols)) && (_local3 >= 0)) && (_local3 < rows)) && (hitTest != 3)) && (!_root.game.shiftDown)) {
_root.game.CancelSelect();
}
} else {
_root.game.SelectCell(_local3, _local4);
}
}
}
function DrawGrid() {
clear();
lineStyle(1, 11184810);
var _local7 = startY + (rows * gridSize);
var _local8 = startX + (cols * gridSize);
cells = _root.game.cells;
var _local6 = gridSize * 10;
lineStyle(1, 16777215, 80);
moveTo(startX + ((cols / 2) * gridSize), startY + _local6);
lineTo(startX + ((cols / 2) * gridSize), _local7 - _local6);
moveTo(startX + _local6, startY + ((rows / 2) * gridSize));
lineTo(_local8 - _local6, startY + ((rows / 2) * gridSize));
lineStyle(1, 16777215, 0);
var _local5 = 0;
while (_local5 < rows) {
var _local4 = 0;
while (_local4 < cols) {
var _local3 = cells[_local5][_local4];
if (_local3.barrier && (_local3.cost == 0)) {
beginFill(16777215, 80);
moveTo(_local3.left, _local3.top);
lineTo(_local3.left + gridSize, _local3.top);
lineTo(_local3.left + gridSize, _local3.top + gridSize);
lineTo(_local3.left, _local3.top + gridSize);
lineTo(_local3.left, _local3.top);
endFill();
}
_local4++;
}
_local5++;
}
cacheAsBitmap = true;
}
function DrawCells() {
var _local3;
var _local5 = 0;
while (_local5 < rows) {
var _local4 = 0;
while (_local4 < cols) {
var _local2 = cells[_local5][_local4];
if (_local2.rangeTowers.length > 0) {
beginFill(16715792, 80);
moveTo(_local2.left, _local2.top);
lineTo(_local2.left + gridSize, _local2.top);
lineTo(_local2.left + gridSize, _local2.top + gridSize);
lineTo(_local2.left, _local2.top + gridSize);
lineTo(_local2.left, _local2.top);
endFill();
_local3 = this[(("tf:" + _local5) + ":") + _local4];
if (_local3) {
_local3.text = "" + _local2.rangeTowers.length;
} else {
_local3 = createTextField((("tf:" + _local5) + ":") + _local4, getNextHighestDepth(), _local2.left, _local2.top, gridSize, gridSize);
_local3.text = "" + _local2.rangeTowers.length;
}
} else {
_local3 = this[(("tf:" + _local5) + ":") + _local4];
if (_local3) {
_local3.removeTextField();
}
}
_local4++;
}
_local5++;
}
}
function onEnterFrame() {
if (active) {
if (gotoAlpha > _alpha) {
_alpha = _alpha + 10;
if (gotoAlpha < _alpha) {
active = false;
}
} else {
_alpha = _alpha - 10;
if (gotoAlpha > _alpha) {
active = false;
}
}
}
}
function HighlightCell() {
var _local7;
var _local6 = _root._xmouse;
var _local5 = _root._ymouse;
var _local4 = int((_local6 - startX) / gridSize);
var _local3 = int((_local5 - startY) / gridSize);
if ((((_local4 < 0) || (_local4 >= cols)) || (_local3 < 0)) || (_local3 >= rows)) {
hCell._visible = false;
hRange._visible = false;
cRow = -1;
cCol = -1;
cCell = undefined;
hitTest = 4;
} else {
_local7 = _root.game.cells[_local3][_local4];
if (_local5 < (_local7.top + (gridSize / 2))) {
cRow = _local3 - 1;
} else {
cRow = _local3;
}
if (_local6 < (_local7.left + (gridSize / 2))) {
cCol = _local4 - 1;
} else {
cCol = _local4;
}
if (cCol < 0) {
cCol = 0;
}
if (cRow < 0) {
cRow = 0;
}
if (cCol >= (cols - 1)) {
cCol = cols - 2;
}
if (cRow >= (rows - 1)) {
cRow = rows - 2;
}
cCell = _root.game.cells[cRow][cCol];
if (showCell) {
hCell._x = cCell.left;
hCell._y = cCell.top;
hCell._visible = true;
}
hRange._x = cCell.left + gridSize;
hRange._y = cCell.top + gridSize;
hRange._visible = true;
hitTest = _root.game.CellHitTest(cRow, cCol, dragTower);
}
if (hitTest == 0) {
hCell.gotoAndStop(1);
} else {
hCell.gotoAndStop(2);
}
}
}
Symbol 218 MovieClip [__Packages.Fragment] Frame 0
class Fragment extends MovieClip
{
var gotoAndStop, frame, _alpha, ticks, removeMovieClip, xVel, yVel, dx, dy, _x, _y, rotate, _rotation;
function Fragment () {
super();
gotoAndStop(frame);
if (frame == 2) {
_alpha = 25;
} else {
_alpha = 100;
}
}
function onEnterFrame() {
if (_root.game.gameState != 1) {
return(undefined);
}
if ((ticks--) <= 0) {
(removeMovieClip());// not popped
} else {
xVel = xVel - (xVel / (ticks + 1));
yVel = yVel - (yVel / (ticks + 1));
dx = dx - (dx / (ticks + 1));
dy = dy - (dy / (ticks + 1));
_x = _x + xVel;
_y = _y + yVel;
if (rotate > 0) {
_rotation = _rotation + rotate;
}
}
}
}
Symbol 219 MovieClip [__Packages.UpgradePanel] Frame 0
class UpgradePanel extends MovieClip
{
var _visible, upgradePanel, filters, upgradeBar, tower, panelDetails, upgradeButton, towerObject, upgradeName, desc;
function UpgradePanel () {
super();
_visible = false;
upgradePanel._visible = false;
active = false;
filters = [new flash.filters.GlowFilter(16750848, 0.8, 10, 10, 2, 3)];
}
function onEnterFrame() {
if (upgradeBar._visible && (tower)) {
ShowUpgrade();
}
}
function Upgrade() {
_root.game.UpgradeSelectedTower(false);
panelDetails._visible = false;
upgradeBar._visible = true;
upgradeButton._visible = false;
ShowUpgrade();
}
function CheckGold() {
if (_visible) {
if (tower && (tower.upTicks > 0)) {
upgradeButton._visible = false;
} else if (_root.game.gold >= (towerObject.cost - tower.cost)) {
upgradeButton._visible = true;
} else {
upgradeButton._visible = false;
}
}
}
function ShowUpgrade() {
if (tower && (tower.upTicks > 0)) {
upgradeBar.SetPercentage(1 - (tower.upTicks / tower.upTickTotal));
} else {
panelDetails._visible = true;
upgradeBar._visible = false;
upgradeButton._visible = true;
_root.game.SelectCell(tower.topLeftCell.row, tower.topLeftCell.col);
}
}
function GetSpeed(hr) {
if (hr < 7) {
return("very fast");
}
if (hr < 13) {
return("fast");
}
if (hr < 37) {
return("average");
}
if (hr < 61) {
return("slow");
}
return("very slow");
}
function SetTower(oldTower, newTower) {
tower = oldTower;
towerObject = newTower;
upgradeName.text = newTower.towerName;
desc.text = newTower.desc;
with (panelDetails) {
cost.text = newTower.cost - oldTower.cost;
damage.text = newTower.damage;
range.text = newTower.range;
speed.text = GetSpeed(newTower.hitRate);
}
_visible = true;
if (oldTower.upTicks > 0) {
panelDetails._visible = false;
upgradeBar._visible = true;
ShowUpgrade();
} else {
panelDetails._visible = true;
upgradeBar._visible = false;
}
CheckGold();
}
function Cancel() {
_visible = false;
panelDetails._visible = true;
upgradeBar._visible = false;
upgradeButton._visible = true;
tower = undefined;
towerObject = undefined;
}
}
Symbol 220 MovieClip [__Packages.Game] Frame 0
class Game
{
var useComms, host, netComms, clientID, topMenu, infoPanel, upgradePanel, nextPanel, levelBar, levelBarHighlight, btnNextLevel, creeps, creepCount, pathFinder, pathID, towerField, creepField, shotField, effectsField, bountyField, gridField, pauseField, gameState, expLevel, muted, inited, difficulty, gridOn, waves, NoPellet, NoSquirt, NoDart, NoSwarm, NoFrost, tick, tTick, fcount, cTick, gold, levelBonus, level, lives, timeToLevel, currentLevelTime, levelTime, score, finished, startTime, pauseTime, endTime, fpsTime, newLevelTick, creepDied, flyingCreeps, startX, endX, startY, endY, gridSize, cells, towers, cellCols, cellRows, shiftDown, midRow, midCol, currentWave, creepCountLR, creepCountUD, endCellLR, startCellLR, endCellUD, startCellUD, openingStartRow, openingStartCol, openingEndRow, openingEndCol;
function Game () {
useComms = false;
if (host == undefined) {
host = true;
}
if (useComms) {
netComms = new NetComms();
trace("COMMS ON");
clientID = (host ? 1 : 2);
netComms.clientID = 1;
}
topMenu = _root.Interface.topMenu;
infoPanel = _root.Interface.infoPanel;
upgradePanel = _root.Interface.upgradePanel;
nextPanel = _root.Interface.nextCreepInfo;
levelBar = _root.Interface.levelBar;
levelBarHighlight = _root.Interface.levelBarHighlight;
btnNextLevel = _root.Interface.btnNextLevel;
creeps = [];
creepCount = 0;
pathFinder = new PathFinder();
pathID = 1;
towerField = _root.createEmptyMovieClip("towerField", 1);
creepField = _root.createEmptyMovieClip("creepField", 2);
shotField = _root.createEmptyMovieClip("shotField", 3);
effectsField = _root.createEmptyMovieClip("effectsField", 5);
bountyField = _root.createEmptyMovieClip("bountyField", 6);
gridField = _root.attachMovie("Grid", "gridField", 10);
pauseField = _root.Interface.attachMovie("PauseOverlay", "pauseField", 100);
gameState = 0;
expLevel = 0;
muted = false;
inited = false;
difficulty = 0;
gridOn = false;
}
function KeyPress(code) {
if (gameState > 1) {
return(undefined);
}
switch (code) {
case 85 :
if ((upgradePanel.tower && (upgradePanel.upgradeButton._visible)) && (!infoPanel.tower.dragged)) {
if (gameState == 1) {
upgradePanel.Upgrade();
} else {
UpgradeSelectedTower(true);
SelectCell(upgradePanel.tower.topLeftCell.row, upgradePanel.tower.topLeftCell.col);
}
}
break;
case 83 :
if (!(infoPanel.tower && (!infoPanel.tower.dragged))) {
break;
}
SellSelectedTower();
}
}
function ShowStart() {
if (inited) {
Reset();
}
gameState = -1;
pauseField._visible = false;
_root.scoreBoard._visible = false;
_root.Interface.blockingPopup._visible = false;
_root.startPanel.Show();
_root.Interface.bottomBar.levelBarHighlight._visible = false;
levelBar.Clear();
levelBar._visible = false;
levelBarHighlight._visible = false;
ResetChallengeMode();
SetChallengeMode();
ToggleGrid(false);
}
function Init() {
var _local3;
InitMap();
InitWaves();
InitTowers();
levelBar.CreateLevels(waves);
_root.Interface.bottomBar.levelBarHighlight._visible = true;
switch (difficulty) {
case 1 :
_local3 = "Easy Mode";
break;
case 2 :
_local3 = "Normal Mode";
break;
case 3 :
_local3 = "Hard Mode";
break;
case 4 :
_local3 = "Challenge Mode";
}
_root.Interface.difficulty.diff.text = _local3;
SetChallengeMode();
Reset();
ToggleGrid(true);
inited = true;
}
function ResetChallengeMode() {
NoPellet = false;
NoSquirt = false;
NoDart = false;
NoSwarm = false;
NoFrost = false;
}
function SetChallengeMode() {
_root.Interface.btnPellet._visible = !NoPellet;
_root.Interface.btnSquirt._visible = !NoSquirt;
_root.Interface.btnDart._visible = !NoDart;
_root.Interface.btnSwarm._visible = !NoSwarm;
_root.Interface.btnFrost._visible = !NoFrost;
}
function Reset() {
tick = 0;
tTick = 0;
fcount = 0;
if (useComms) {
netComms.Reset();
cTick = 0;
}
gold = 80;
levelBonus = 0;
level = 0;
lives = 20;
timeToLevel = 1;
currentLevelTime = timeToLevel;
if (difficulty == 1) {
levelTime = 35;
btnNextLevel._visible = false;
} else {
levelTime = 25;
btnNextLevel._visible = true;
}
score = 0;
topMenu.score.text = 0;
_root.scoreBoard._visible = false;
SetLevelCaption();
CancelSelect();
ClearShots();
ClearCreeps();
ClearEffects();
ClearTowers();
topMenu.lives.text = lives;
topMenu.kills.text = 0;
topMenu.timeleft.text = timeToLevel;
topMenu.gold.text = gold;
finished = false;
gameState = 0;
_root.Interface.topMenu.btnStart.msg.text = "START";
pauseField._visible = false;
levelBar.Reset();
levelBar._visible = true;
}
function GetTime() {
var _local1 = new Date();
return(_local1.getTime());
}
function Start() {
startTime = GetTime();
gameState = 1;
if (infoPanel.tower) {
SelectCell(infoPanel.tower.topLeftCell.row, infoPanel.tower.topLeftCell.col);
}
_root.Interface.topMenu.btnStart.msg.text = "PAUSE";
btnNextLevel._visible = difficulty > 1;
levelBar.SetLevel(-1, timeToLevel, false);
levelBarHighlight._visible = true;
MakePath(true, true);
MakePath(false, true);
}
function Pause() {
gameState = 2;
_root.Interface.topMenu.btnStart.msg.text = "RESUME";
pauseField.Show();
pauseTime = GetTime();
}
function Resume() {
if ((gameState = 2)) {
gameState = 1;
}
_root.Interface.topMenu.btnStart.msg.text = "PAUSE";
pauseField.Hide();
startTime = startTime + (GetTime() - pauseTime);
}
function ShowFinish() {
endTime = GetTime();
CancelSelect();
gameState = 3;
if (finished) {
score = score + (lives * 25);
score = score + levelBonus;
score = score - GetBadCreepGoldCost();
trace(GetBadCreepGoldCost());
}
if (score < 0) {
score = 0;
}
_root.scoreBoard.SetScore(score, difficulty, finished && (lives > 1));
if ((score > 5000) && (difficulty > 1)) {
PlaySound("ivor.wav");
}
}
function GetBadCreepGoldCost() {
var _local4 = 50;
var _local5 = 0;
FilterCreeps();
var _local2 = 0;
while (_local2 < creeps.length) {
var _local3 = creeps[_local2];
if (_local3.level < _local4) {
_local4 = _local3.level;
}
_local2++;
}
_local2 = 0;
while (_local2 < creeps.length) {
var _local3 = creeps[_local2];
if (_local3.level > _local4) {
_local5 = _local5 + _local3.bounty;
}
_local2++;
}
return(_local5);
}
function ToggleGrid(tf) {
CancelSelect();
if (tf != undefined) {
gridOn = tf;
} else {
gridOn = !gridOn;
}
gridField.ToggleGrid();
if (gridOn) {
_root.Interface.btnGrid.msg.text = "NO GRID";
} else {
_root.Interface.btnGrid.msg.text = "GRID";
}
}
function CommTick() {
fcount++;
if (useComms) {
if ((++cTick) == 18) {
cTick = 1;
netComms.ServerLoad(fcount);
netComms.ServerSend(fcount);
}
netComms.FrameTick(fcount);
}
}
function FrameTick() {
if (gameState == 1) {
if ((++tick) > 24) {
tick = 1;
Tick();
fpsTime = GetTime();
}
if ((++tTick) == 6) {
tTick = 1;
AssignTowerTargets();
}
if (newLevelTick > 0) {
newLevelTick--;
PlaySound("LETSGO.WAV");
}
}
}
function Tick() {
if (creepDied) {
FilterCreeps();
}
creepDied = false;
if (finished && (creeps.length == 0)) {
ShowFinish();
}
if (!finished) {
timeToLevel--;
if (timeToLevel == 0) {
NextLevel();
}
topMenu.timeleft.text = timeToLevel;
}
}
function AssignTowerTargets() {
flyingCreeps = false;
var _local10 = 0;
while (_local10 < creeps.length) {
var _local2 = creeps[_local10];
if ((((_local2._x >= startX) && (_local2._x <= endX)) && (_local2._y >= startY)) && (_local2._y <= endY)) {
var _local8 = _local2.cCell;
if (_local2.flying) {
_local8 = cells[int((_local2._y - startY) / gridSize)][int((_local2._x - startX) / gridSize)];
flyingCreeps = true;
}
if (_local8) {
var _local5 = 0;
while (_local5 < _local8.rangeTowers.length) {
var _local4 = _local8.rangeTowers[_local5];
var _local3 = _local4.tower;
if (!_local3.target) {
if (_local3.TargetValid(_local2)) {
if (!_local4.partial) {
_local3.target = _local2;
} else {
var _local7 = _local4.tower._x - _local2._x;
var _local6 = _local4.tower._y - _local2._y;
var _local9 = Math.sqrt((_local7 * _local7) + (_local6 * _local6));
if (_local9 <= _local3.range) {
_local3.target = _local2;
}
}
}
}
_local5++;
}
}
}
_local10++;
}
}
function ModifyTowerRangeBox(t, addtower) {
var _local20 = int(t.range / gridSize) + 1;
var _local18 = t.topLeftCell;
var _local14 = _local18.left + gridSize;
var _local13 = _local18.top + gridSize;
var _local19 = _local18.row - _local20;
var _local17 = (_local18.row + _local20) + 1;
var _local15 = _local18.col - _local20;
var _local12 = (_local18.col + _local20) + 1;
var _local9 = _local19;
while (_local9 < _local17) {
var _local3 = _local15;
while (_local3 < _local12) {
var _local2 = cells[_local9][_local3];
var _local11 = _local2.left + (gridSize / 2);
var _local10 = _local2.top + (gridSize / 2);
var _local6 = _local14 - _local11;
var _local5 = _local13 - _local10;
var _local7 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
if (_local7 <= t.range) {
if (addtower) {
var _local8 = _local7 > (t.range - gridSize);
_local2.AddRangeTower(t, _local8);
} else {
_local2.RemoveRangeTower(t);
}
}
_local3++;
}
_local9++;
}
gridField.DrawGrid();
}
function TowerButtonRollover(type, btn) {
if (gameState == -1) {
return(undefined);
}
infoPanel.SetTowerInfo(towers[type][1], btn);
if (towers[type][1].cost > gold) {
btn.filters = [new flash.filters.GlowFilter(10027008, 0.8, 10, 10, 2, 3)];
} else {
btn.filters = [new flash.filters.GlowFilter(39168, 0.8, 10, 10, 2, 3)];
}
}
function SelectCreep(c) {
if (gameState > 1) {
return(undefined);
}
if (c) {
CancelSelect();
infoPanel.SetCreep(c);
} else {
CancelSelect();
}
}
function SelectCell(cellRow, cellCol) {
var _local2 = cells[cellRow][cellCol];
if (gameState > 1) {
return(undefined);
}
if (_local2.tower) {
CancelSelect();
gridField.SelectTower(_local2.tower);
infoPanel.SetTower(_local2.tower);
if (_local2.tower.level < 6) {
var _local3 = towers[_local2.tower.towerType][_local2.tower.level + 1];
upgradePanel.SetTower(_local2.tower, _local3);
_local2.tower.SetSelected(true);
gridField.SelectTower(_local2.tower);
}
} else if ((((cellCol >= 0) && (cellCol < cellCols)) && (cellRow >= 0)) && (cellRow < cellRows)) {
CancelSelect();
}
}
function CancelSelect() {
var _local3;
if (gridField.dragTower) {
_local3 = gridField.dragTower;
gridField.StopFollowTower();
removeMovieClip(_local3);
infoPanel.Cancel();
} else if (infoPanel.tower) {
_local3 = infoPanel.tower;
infoPanel.Cancel();
upgradePanel.Cancel();
gridField.CancelSelect();
} else if (infoPanel.creep) {
infoPanel.Cancel();
}
if (_local3) {
_local3.SetSelected(false);
}
if (_root.Interface.blockingPopup._visible) {
_root.Interface.blockingPopup.Hide();
}
}
function UpgradeSelectedTower(quick) {
var _local2 = upgradePanel.tower;
var _local3 = upgradePanel.towerObject;
if (_local2 && (_local3)) {
AdjustGold(-(_local3.cost - _local2.cost));
_local2.Upgrade(_local3);
if (quick) {
_local2.ApplyUpgrade();
}
}
}
function SellSelectedTower() {
var _local3 = infoPanel.tower;
var _local4;
AdjustGold(int(_local3.cost * 0.75));
var _local5 = 0;
while (_local5 < _local3.size) {
var _local2 = 0;
while (_local2 < _local3.size) {
_local4 = cells[_local3.topLeftCell.row + _local5][_local3.topLeftCell.col + _local2];
_local4.tower = undefined;
_local4.cost = 1;
_local2++;
}
_local5++;
}
_local3.SetSelected(false);
ModifyTowerRangeBox(_local3, false);
_local3.topLeftCell = undefined;
infoPanel.Cancel();
upgradePanel.Cancel();
gridField.CancelSelect();
removeMovieClip(_local3);
PlaySound("Kaching.wav");
BuildCreepPaths(true);
BuildCreepPaths(false);
}
function CellHitTest(cellRow, cellCol, t) {
var _local3;
var _local4 = 0;
if (gold >= t.cost) {
var _local5 = 0;
while (_local5 < t.size) {
var _local2 = 0;
while (_local2 < t.size) {
_local3 = cells[cellRow + _local5][cellCol + _local2];
if (_local3.cost == 0) {
_local4 = 2;
break;
}
if (_local3.creepCount > 0) {
_local4 = 3;
break;
}
if (_local3.barrier) {
_local4 = 4;
break;
}
_local2++;
}
if (_local4 > 0) {
break;
}
_local5++;
}
} else {
_local4 = 1;
}
return(_local4);
}
function DropTower(t, c) {
if (useComms) {
netComms.AddCommand(fcount, fcount + 24, ((("AT" + t.towerType) + t.level) + PadNumber(c.row, 2)) + PadNumber(c.col, 2));
infoPanel.Cancel();
gridField.StopFollowTower();
AdjustGold(-t.cost);
if (shiftDown) {
AddTower(t.towerType, true);
}
} else {
PlaceTower(t, c);
}
}
function PlaceTowerFromComms(cmd) {
var _local9 = int(cmd.substr(0, 1));
var _local10 = int(cmd.substr(1, 1));
var _local7 = int(cmd.substr(2, 2));
var _local8 = int(cmd.substr(4, 2));
var _local5 = cells[_local7][_local8];
var _local3 = towerField.getNextHighestDepth();
var _local6;
var _local2 = towers[_local9][_local10];
if (_local3 == 0) {
_local3 = 1;
}
towerField.attachMovie("Tower", "tower" + _local3, _local3, {id:_local3, creeps:creeps, level:_local2.level, towerName:_local2.towerName, desc:_local2.desc, cost:_local2.cost, towerType:_local2.towerType, hitRate:_local2.hitRate, range:_local2.range, damage:_local2.damage, splash:_local2.splash, slow:_local2.slow, rotating:_local2.rotating, dragged:false});
_local6 = towerField["tower" + _local3];
PlaceTower(_local6, _local5);
}
function PlaceTower(t, c) {
var _local8 = [];
var _local3;
var _local11 = false;
var _local10 = false;
var _local12;
var _local6 = 0;
while (_local6 < t.size) {
var _local4 = 0;
while (_local4 < t.size) {
_local3 = cells[c.row + _local6][c.col + _local4];
if (_local3.parentCellsLR.length > 0) {
_local10 = true;
}
if (_local3.parentCellsUD.length > 0) {
_local11 = true;
}
_local8.push(_local3);
_local3.tower = t;
_local3.cost = 0;
_local4++;
}
_local6++;
}
_local12 = true;
if (_local10) {
_local12 = CheckPath(true);
}
if (_local11 && (_local12)) {
_local12 = CheckPath(false);
}
if (!_local12) {
var _local7 = 0;
while (_local7 < _local8.length) {
_local8[_local7].cost = 1;
_local8[_local7].tower = undefined;
_local7++;
}
PlaySound("X.wav");
_root.Interface.blockingPopup.Show();
return(undefined);
}
if (_local10) {
BuildCreepPaths(true);
}
if (_local11) {
BuildCreepPaths(false);
}
t.topLeftCell = c;
t._x = c.left + gridSize;
t._y = c.top + gridSize;
t._visible = true;
t.SetRotation();
ModifyTowerRangeBox(t, true);
AdjustGold(-t.cost);
PlaySound("scratch.wav");
infoPanel.Cancel();
gridField.StopFollowTower();
if (shiftDown) {
AddTower(t.towerType, true);
}
}
function BreakPathFromCellLR(c) {
var _local2;
var _local3 = 0;
while (_local3 < c.parentCellsLR.length) {
_local2 = c.parentCellsLR[_local3];
_local2.nextCellLR = undefined;
_local2.moveCostLR = 0;
_local2.pathID = 0;
BreakPathFromCellLR(_local2);
_local3++;
}
c.parentCellsLR = [];
}
function BreakPathFromCellUD(c) {
var _local2;
var _local3 = 0;
while (_local3 < c.parentCellsUD.length) {
_local2 = c.parentCellsUD[_local3];
_local2.nextCellUD = undefined;
_local2.moveCostUD = 0;
_local2.pathID = 0;
if (_local2.parentCellsUD.length > 0) {
BreakPathFromCellUD(_local2);
}
_local3++;
}
}
function BuildCreepPaths(LR) {
var _local2;
var _local3;
pathID++;
ClearPath(LR);
MakePath(LR);
var _local4 = 0;
while (_local4 < creepField.getNextHighestDepth()) {
_local2 = creepField["creep" + _local4];
if ((_local2 && (!_local2.flying)) && (!_local2.dead)) {
if (_local2.entering) {
_local3 = _local2.startCell;
} else {
_local3 = _local2.cCell;
}
if (_local3) {
if (((LR && (_local2.LR)) && (_local3.nextCellLR == undefined)) || (((!LR) && (!_local2.LR)) && (_local3.nextCellUD == undefined))) {
if (!MakePathFromCell(_local3, _local2.LR)) {
if (_local2.entering) {
_local2.flying = true;
_local2.forcedFly = true;
} else {
_local2.SetFlying();
_local2.forcedFly = true;
}
}
}
}
}
_local4++;
}
}
function ClearPath(LR) {
var _local4 = 0;
while (_local4 < cellRows) {
var _local2 = 0;
while (_local2 < cellCols) {
var _local3 = cells[_local4][_local2];
_local3.ClearPath(LR);
_local2++;
}
_local4++;
}
}
function PlayButtonSound() {
PlaySound("CHANGEOP.WAV");
}
function PlaySound(wav) {
if (!muted) {
var _local2 = new Sound();
_local2.attachSound(wav);
_local2.start();
}
}
function AdjustGold(byVal) {
gold = gold + byVal;
topMenu.gold.text = gold;
infoPanel.CheckGold();
upgradePanel.CheckGold();
gridField.CheckGold();
if (isNaN(gold) || (gold == undefined)) {
gameState = 3;
}
}
function AdjustScore(byVal) {
score = score + byVal;
if (levelBonus > 0) {
topMenu.score.text = (score + "+") + levelBonus;
} else {
topMenu.score.text = score;
}
}
function AddTower(type, drag) {
var _local3 = towerField.getNextHighestDepth();
var _local4;
var _local2 = towers[type][1];
CancelSelect();
if (_local3 == 0) {
_local3 = 1;
}
towerField.attachMovie("Tower", "tower" + _local3, _local3, {id:_local3, creeps:creeps, level:_local2.level, towerName:_local2.towerName, desc:_local2.desc, cost:_local2.cost, towerType:_local2.towerType, hitRate:_local2.hitRate, range:_local2.range, damage:_local2.damage, splash:_local2.splash, slow:_local2.slow, rotating:_local2.rotating, dragged:drag});
_local4 = towerField["tower" + _local3];
if (drag) {
gridField.FollowTower(_local4);
}
infoPanel.SetTower(_local4);
}
function MakePathFromCell(c, LR) {
var _local2;
if (LR) {
_local2 = pathFinder.FindPath(cells, c.row, c.col, midRow, cellCols - 1);
if (_local2 == undefined) {
return(false);
}
StorePath(_local2, true, false);
return(true);
}
_local2 = pathFinder.FindPath(cells, c.row, c.col, cellRows - 1, midCol);
if (_local2 == undefined) {
return(false);
}
StorePath(_local2, false, false);
return(true);
}
function CheckPath(LR) {
var _local2;
if (LR) {
_local2 = pathFinder.FindPath(cells, midRow, 0, midRow, cellCols - 1);
} else {
_local2 = pathFinder.FindPath(cells, 0, midCol, cellRows - 1, midCol);
}
return(_local2 != undefined);
}
function MakePath(LR, force) {
var _local2;
pathID++;
if (LR) {
_local2 = pathFinder.FindPath(cells, midRow, 0, midRow, cellCols - 1);
} else {
_local2 = pathFinder.FindPath(cells, 0, midCol, cellRows - 1, midCol);
}
if (_local2 != undefined) {
StorePath(_local2, LR, force);
return(true);
}
return(false);
}
function SendScore(pn) {
var _local2 = GetMapString();
var _local3 = endTime - startTime;
var _local4 = (((("&c=1" + int(NoPellet)) + int(NoSquirt)) + int(NoDart)) + int(NoSwarm)) + int(NoFrost);
getURL (((((((((((("http://www.handdrawngames.com/DesktopTD/AddScore.asp?t=" + _local3) + "&d=") + difficulty) + "&s=") + score) + "&n=") + pn) + "&l=") + lives) + _local4) + "&m=") + _local2, "_self");
trace(((((((((((("http://www.handdrawngames.com/DesktopTD/AddScore.asp?t=" + _local3) + "&d=") + difficulty) + "&s=") + score) + "&n=") + pn) + "&l=") + lives) + _local4) + "&m=") + _local2);
}
function AddExplosion(type, posX, posY, dx, dy) {
var _local15 = 2;
var _local14 = 0;
var _local3 = 5;
var _local7 = 8;
var _local8;
switch (type) {
case 1 :
PlaySound("bop.wav");
break;
case 2 :
_local15 = 5;
_local3 = 8;
break;
case 3 :
dx = (-dx) * 2;
dy = (-dy) * 2;
_local15 = 2;
break;
default :
return(undefined);
}
_local3 = (Math.random() * _local3) + (_local3 / 2);
var _local2 = 0;
while (_local2 < _local15) {
var _local4 = {frame:type, ticks:_local7, _x:posX, _y:posY, xVel:(Math.random() * _local3) - (_local3 / 2), yVel:(Math.random() * _local3) - (_local3 / 2), dx:dx, dy:dy, rotate:_local14, deaccel:_local8};
effectsField.attachMovie("Fragment", "fragment" + (expLevel + _local2), expLevel + _local2, _local4);
_local2++;
}
expLevel = expLevel + _local15;
if (expLevel > 100) {
expLevel = 0;
}
}
function GetMapString() {
var _local9 = ((("v1:" + cellRows) + ":") + cellCols) + ":";
var _local4 = [];
var _local8 = 0;
while (_local8 < cellRows) {
var _local5 = 0;
while (_local5 < cellCols) {
var _local3 = cells[_local8][_local5];
if (_local3.tower) {
var _local6 = true;
var _local2 = 0;
while (_local2 < _local4.length) {
if ((_local4[_local2].topLeftCell.row == _local3.tower.topLeftCell.row) && (_local4[_local2].topLeftCell.col == _local3.tower.topLeftCell.col)) {
_local6 = false;
break;
}
_local2++;
}
if (_local6) {
_local4.push(_local3.tower);
}
}
_local5++;
}
_local8++;
}
_local8 = 0;
while (_local8 < _local4.length) {
var _local7 = _local4[_local8];
_local9 = _local9.concat(PadNumber(_local7.topLeftCell.row, 2), PadNumber(_local7.topLeftCell.col, 2), _local7.towerType, _local7.level);
_local8++;
}
return(_local9);
}
function PadNumber(num, chars) {
var _local2 = "" + num;
var _local1 = 0;
while (_local1 < (chars - _local2.length)) {
_local2 = "0" + _local2;
_local1++;
}
return(_local2);
}
function TraceCells() {
var _local5 = 0;
while (_local5 < cellRows) {
var _local3 = "";
var _local2 = 0;
while (_local2 < cellCols) {
var _local4 = cells[_local5][_local2];
_local3 = _local3.concat(_local4.cost);
_local2++;
}
trace(_local3);
_local5++;
}
}
function StorePath(path, LR, force) {
var _local7;
var _local6;
var _local9;
var _local8;
var _local12;
var _local2;
var _local4;
var _local3 = path.length - 1;
while (_local3 > 0) {
_local6 = path[_local3][0];
_local7 = path[_local3][1];
_local8 = path[_local3 - 1][0];
_local9 = path[_local3 - 1][1];
_local2 = cells[_local6][_local7];
_local4 = cells[_local8][_local9];
_local2.pathID = pathID;
if (LR) {
if (_local2.nextCellLR == undefined) {
_local2.nextCellLR = _local4;
_local4.parentCellsLR.push(_local2);
} else if (!force) {
break;
}
} else if (_local2.nextCellUD == undefined) {
_local2.nextCellUD = _local4;
_local4.parentCellsUD.push(_local2);
} else if (!force) {
break;
}
_local3--;
}
}
function AddKill(c) {
var _local3 = bountyField.getNextHighestDepth();
if (infoPanel.creep == c) {
CancelSelect();
}
AdjustGold(c.bounty);
AdjustScore(c.bounty);
bountyField.attachMovie("Bounty", "bounty" + _local3, _local3, {_x:c._x, _y:c._y - 10, num:c.bounty});
PlaySound("SPLAT.WAV");
creepDied = true;
}
function LoseALife(c) {
lives--;
topMenu.lives.text = lives;
if (infoPanel.creep == c) {
CancelSelect();
}
PlaySound("YIPPEE.WAV");
if (lives == 0) {
ShowFinish();
}
creepDied = true;
}
function SendNextLevel() {
if (gameState == 1) {
NextLevel(true);
} else if (gameState == 0) {
Start();
}
}
function NextLevel(early) {
if (finished && (creeps.length == 0)) {
ShowFinish();
return(undefined);
}
if (early) {
levelBonus = levelBonus + (timeToLevel * 2);
AdjustScore(0);
}
currentLevelTime = levelTime + int(level / 5);
timeToLevel = currentLevelTime;
if (timeToLevel > 50) {
timeToLevel = 50;
}
levelBar.SetLevel(level, timeToLevel, level > 47);
level++;
currentWave = waves[level];
topMenu.level.text = level;
SetLevelCaption();
AddWave(currentWave);
if (level == (waves.length - 1)) {
btnNextLevel._visible = false;
finished = true;
topMenu.timeleft.text = "";
timeToLevel = 0;
}
}
function SetLevelCaption() {
var _local2 = "";
var _local3 = waves[level + 1];
if (_local3) {
if (_local3.immune) {
_local2 = "IMMUNE";
} else if (_local3.flying) {
_local2 = "FLYING";
} else if (_local3.speed > 1) {
_local2 = "FAST";
} else {
_local2 = "NORMAL";
}
} else {
_local2 = "FINISH";
}
if (_local3.count == 1) {
if (_local2 == "NORMAL") {
_local2 = "BOSS";
} else {
_local2 = "B-" + _local2;
}
}
nextPanel.level.text = _local2;
}
function InitWaves() {
var _local5;
var _local3;
var _local14;
var _local16 = false;
var _local7 = 0;
var _local6 = 0;
var _local15 = 0;
var _local2;
switch (difficulty) {
case 1 :
_local5 = 2;
_local3 = 20;
_local14 = 2.2;
break;
case 2 :
_local5 = 1;
_local3 = 20;
_local14 = 2.2;
break;
case 3 :
_local5 = 1;
_local3 = 30;
_local14 = 2.2;
break;
case 4 :
_local5 = 1;
_local3 = 30;
_local14 = 2.1;
}
waves = new Array();
waves[0] = 1;
var _local4 = 0;
while (_local4 < 49) {
_local6++;
_local7++;
switch (_local6) {
case 1 :
_local2 = {count:10, bounty:_local5, size:100, health:_local3, speed:1, flying:false, immune:false, delay:25};
break;
case 2 :
_local2 = {count:10, bounty:_local5, size:100, health:_local3 * 1.33, speed:1, flying:false, delay:25};
break;
case 3 :
_local2 = {count:10, bounty:_local5, size:110, health:_local3 * 1.5, speed:1, flying:false, immune:false, delay:10};
break;
case 4 :
_local2 = {count:10, bounty:_local5, size:120, health:_local3 * 1.8, speed:1, flying:false, immune:true, delay:25};
break;
case 5 :
_local2 = {count:10, bounty:_local5, size:115, health:_local3 * 1.66, speed:(((difficulty < 3) && (_local4 == 3)) ? 1.25 : 1.5), flying:false, immune:false, delay:25};
break;
case 6 :
_local2 = {count:10, bounty:_local5, size:125, health:_local3 * 2, speed:1, flying:true, immune:false, delay:25};
}
_local2.level = _local4 + 1;
if ((difficulty == 1) && (_local4 < 7)) {
_local2.flying = false;
_local2.immune = false;
_local2.speed = 1;
} else if (((difficulty == 1) && (_local4 < 21)) && (_local2.flying)) {
_local2.flying = false;
}
if (_local6 == 6) {
_local3 = _local3 * _local14;
_local6 = 0;
_local5 = _local5 + 1;
}
_local2.color = 2236962 /* 0x222222 */;
if (_local2.immune) {
_local2.color = 11141290 /* 0xAA00AA */;
}
if (_local2.flying) {
_local2.color = 11184640 /* 0xAAAA00 */;
}
if (_local2.speed > 1) {
_local2.color = 11141120 /* 0xAA0000 */;
}
if (_local2.delay < 25) {
_local2.color = 21930;
}
if (_local7 == 7) {
if (_local2.speed > 1.2) {
_local2.speed = 1.2;
} else {
_local2.speed = 0.8;
}
if (_local2.delay < 25) {
_local2.count = 3;
_local2.bounty = _local5 * 7;
_local2.health = _local2.health * 5;
_local2.speed = 1;
} else {
_local2.count = 1;
_local2.bounty = _local5 * 20;
_local2.health = _local2.health * 12;
}
_local2.size = 150;
_local7 = 0;
}
_local2.health = int(_local2.health);
_local15 = _local15 + (_local2.count * _local2.bounty);
waves.push(_local2);
_local4++;
}
trace(_local15 * 2);
}
function InitTowers() {
towers = [];
towers[1] = [];
towers[1][1] = {level:1, towerName:"Pellet Tower", towerType:1, cost:5, hitRate:48, range:60, damage:10, splash:0, slow:0, rotating:true, desc:"Cheap tower that fires pellets."};
towers[1][2] = {level:2, towerName:"Pellet Tower 2", towerType:1, cost:10, hitRate:48, range:60, damage:20, splash:0, slow:0, rotating:true, desc:"Adds more damage."};
towers[1][3] = {level:3, towerName:"Pellet Tower 3", towerType:1, cost:20, hitRate:48, range:60, damage:40, splash:0, slow:0, rotating:true, desc:"Adds more damage."};
towers[1][4] = {level:4, towerName:"Pellet Tower 4", towerType:1, cost:40, hitRate:48, range:60, damage:80, splash:0, slow:0, rotating:true, desc:"Adds more damage."};
towers[1][5] = {level:5, towerName:"Pellet Tower 5", towerType:1, cost:80, hitRate:48, range:60, damage:160, splash:0, slow:0, rotating:true, desc:"Adds more damage."};
towers[1][6] = {level:6, towerName:"Sniper Tower", towerType:1, cost:200, hitRate:64, range:180, damage:400, splash:0, slow:0, rotating:true, desc:"Turns into a sniper tower. Final upgrade."};
towers[2] = [];
towers[2][1] = {level:1, towerName:"Dart Tower", towerType:2, cost:20, hitRate:72, range:90, damage:10, splash:35, slow:0, rotating:true, desc:"Slow firing tower that damages an area on the ground."};
towers[2][2] = {level:2, towerName:"Dart Tower 2", towerType:2, cost:35, hitRate:72, range:100, damage:20, splash:40, slow:0, rotating:true, desc:"Increases damage, splash and range."};
towers[2][3] = {level:3, towerName:"Dart Tower 3", towerType:2, cost:65, hitRate:72, range:110, damage:40, splash:45, slow:0, rotating:true, desc:"Increases damage, splash and range."};
towers[2][4] = {level:4, towerName:"Dart Tower 4", towerType:2, cost:120, hitRate:72, range:120, damage:80, splash:55, slow:0, rotating:true, desc:"Increases damage, splash and range."};
towers[2][5] = {level:5, towerName:"Dart Tower 5", towerType:2, cost:210, hitRate:72, range:130, damage:160, splash:60, slow:0, rotating:true, desc:"Increases damage, splash and range."};
towers[2][6] = {level:6, towerName:"ICBM Tower", towerType:2, cost:375, hitRate:72, range:140, damage:320, splash:65, slow:0, rotating:true, desc:"Increases damage, splash and range. Final upgrade."};
towers[3] = [];
towers[3][1] = {level:1, towerName:"Squirt Tower", towerType:3, cost:15, hitRate:12, range:70, damage:5, splash:0, slow:0, rotating:true, desc:"Quick firing tower that upgrades well."};
towers[3][2] = {level:2, towerName:"Squirt Tower 2", towerType:3, cost:27, hitRate:12, range:70, damage:10, splash:0, slow:0, rotating:true, desc:"Increases damage by +90%."};
towers[3][3] = {level:3, towerName:"Squirt Tower 3", towerType:3, cost:50, hitRate:12, range:70, damage:18, splash:0, slow:0, rotating:true, desc:"Increases damage by +90%."};
towers[3][4] = {level:4, towerName:"Squirt Tower 4", towerType:3, cost:85, hitRate:12, range:70, damage:34, splash:0, slow:0, rotating:true, desc:"Increases damage by +90%."};
towers[3][5] = {level:5, towerName:"Squirt Tower 5", towerType:3, cost:160, hitRate:12, range:70, damage:65, splash:0, slow:0, rotating:true, desc:"Increases damage by +90%."};
towers[3][6] = {level:6, towerName:"Typhoon Tower", towerType:3, cost:450, hitRate:8, range:90, damage:320, splash:0, slow:0, rotating:true, desc:"Increases range and damage by +400%. Final upgrade."};
towers[4] = [];
towers[4][1] = {level:1, towerName:"Swarm Tower", towerType:4, cost:50, hitRate:18, range:60, damage:20, splash:0, slow:0, rotating:false, desc:"Anti-air tower that fires 4 missiles at a time."};
towers[4][2] = {level:2, towerName:"Swarm Tower 2", towerType:4, cost:80, hitRate:18, range:60, damage:40, splash:0, slow:0, rotating:false, desc:"Increases damage."};
towers[4][3] = {level:3, towerName:"Swarm Tower 3", towerType:4, cost:130, hitRate:18, range:65, damage:80, splash:5, slow:0, rotating:false, desc:"Increases damage, range and adds splash."};
towers[4][4] = {level:4, towerName:"Swarm Tower 4", towerType:4, cost:205, hitRate:18, range:65, damage:160, splash:10, slow:0, rotating:false, desc:"Increases damage and splash."};
towers[4][5] = {level:5, towerName:"Swarm Tower 5", towerType:4, cost:330, hitRate:18, range:70, damage:320, splash:15, slow:0, rotating:false, desc:"Increases damage, splash and range."};
towers[4][6] = {level:6, towerName:"Storm Tower", towerType:4, cost:640, hitRate:12, range:75, damage:480, splash:20, slow:0, rotating:false, desc:"Increases damage, splash and range. Final upgrade."};
towers[5] = [];
towers[5][1] = {level:1, towerName:"Frost Tower", towerType:5, cost:50, hitRate:48, range:50, damage:10, splash:35, slow:25, rotating:true, desc:"This tower freezes creeps to slow them down."};
towers[5][2] = {level:2, towerName:"Frost Tower 2", towerType:5, cost:75, hitRate:48, range:50, damage:20, splash:35, slow:30, rotating:true, desc:"Increases splash and slow."};
towers[5][3] = {level:3, towerName:"Frost Tower 3", towerType:5, cost:100, hitRate:48, range:50, damage:30, splash:40, slow:35, rotating:true, desc:"Increases splash and slow."};
towers[5][4] = {level:4, towerName:"Frost Tower 4", towerType:5, cost:125, hitRate:48, range:50, damage:40, splash:45, slow:40, rotating:true, desc:"Increases splash and slow."};
towers[5][5] = {level:5, towerName:"Frost Tower 5", towerType:5, cost:150, hitRate:48, range:50, damage:50, splash:50, slow:45, rotating:true, desc:"Increases splash and slow."};
towers[5][6] = {level:6, towerName:"Blizzard Tower", towerType:5, cost:200, hitRate:48, range:75, damage:70, splash:50, slow:50, rotating:true, desc:"Increases splash, slow and range. Final upgrade."};
}
function FilterCreeps() {
var _local2 = 0;
while (_local2 < creeps.length) {
if (("" + creeps[_local2]) == "") {
creeps.splice(_local2, 1);
} else {
_local2++;
}
}
}
function AddWave(lvl) {
var _local3 = creepField.getNextHighestDepth();
creepCountLR = lvl.count;
if (difficulty > 1) {
creepCountUD = lvl.count;
} else {
creepCountUD = 0;
}
_local3 = (_local3 + creepCountLR) + creepCountUD;
FilterCreeps();
var _local4 = 0;
while (_local4 < lvl.count) {
creeps.push(creepField.attachMovie("Creep", "creep" + _local3, _local3, {id:creepCount, startDelay:_local4 * lvl.delay, startCell:startCellLR, endCell:endCellLR, bounty:lvl.bounty, size:lvl.size, health:lvl.health, shotHealth:lvl.health, speed:lvl.speed, immune:lvl.immune, flying:lvl.flying, color:lvl.color, level:lvl.level, LR:true}));
_local3--;
creepCount++;
if (difficulty > 1) {
creeps.push(creepField.attachMovie("Creep", "creep" + _local3, _local3, {id:creepCount, startDelay:_local4 * lvl.delay, startCell:startCellUD, endCell:endCellUD, bounty:lvl.bounty, size:lvl.size, health:lvl.health, shotHealth:lvl.health, speed:lvl.speed, immune:lvl.immune, flying:lvl.flying, color:lvl.color, level:lvl.level, LR:false}));
_local3--;
creepCount++;
}
_local4++;
}
newLevelTick = ((lvl.count < 3) ? 2 : 5);
}
function InitMap() {
CreateCellArray();
gridField.DrawGrid();
}
function SetMap(numAcross, numHigh, posX, posY, gridPixels, openingSR, openingER, openingSC, openingEC) {
startX = posX;
endX = startX + (numAcross * gridPixels);
startY = posY;
endY = startY + (numHigh * gridPixels);
gridSize = gridPixels;
cellCols = numAcross;
cellRows = numHigh;
openingStartRow = openingSR;
openingStartCol = openingSC;
openingEndRow = openingER;
openingEndCol = openingEC;
midRow = int(cellRows / 2);
midCol = int(cellCols / 2);
gridField.Init();
}
function CreateCellArray() {
cells = new Array(cellRows - 1);
var _local4 = 0;
while (_local4 < cellRows) {
cells[_local4] = new Array(cellCols - 1);
var _local3 = 0;
while (_local3 < cellCols) {
var _local2 = new Cell();
_local2.row = _local4;
_local2.col = _local3;
_local2.top = (_local4 * gridSize) + startY;
_local2.left = (_local3 * gridSize) + startX;
if ((((_local4 == 0) || (_local4 == (cellRows - 1))) || (_local3 == 0)) || (_local3 == (cellCols - 1))) {
_local2.cost = 0;
_local2.barrier = true;
} else {
_local2.cost = 1;
}
cells[_local4][_local3] = _local2;
_local3++;
}
_local4++;
}
_local4 = openingStartRow;
while (_local4 <= openingEndRow) {
cells[_local4][0].cost = 1;
cells[_local4][cellCols - 1].cost = 1;
_local4++;
}
if (difficulty > 1) {
_local4 = openingStartCol;
while (_local4 <= openingEndCol) {
cells[0][_local4].cost = 1;
cells[cellRows - 1][_local4].cost = 1;
_local4++;
}
}
startCellLR = cells[midRow][0];
endCellLR = cells[midRow][cellCols - 1];
startCellUD = cells[0][midCol];
endCellUD = cells[cellRows - 1][midCol];
gridField.DrawGrid();
}
function ClearTowers() {
var _local3;
var _local4 = 0;
while (_local4 < cellRows) {
var _local2 = 0;
while (_local2 < cellCols) {
_local3 = cells[_local4][_local2];
if (_local3.tower) {
removeMovieClip(_local3.tower);
}
_local3.rangeTowers = [];
_local2++;
}
_local4++;
}
}
function ClearCreeps() {
var _local2 = 0;
while (_local2 < creepField.getNextHighestDepth()) {
removeMovieClip(creepField["creep" + _local2]);
_local2++;
}
creeps = [];
}
function ClearEffects() {
var _local2 = 0;
while (_local2 < effectsField.getNextHighestDepth()) {
removeMovieClip(effectsField["bounty" + _local2]);
removeMovieClip(effectsField["fragment" + _local2]);
_local2++;
}
}
function ClearShots() {
var _local2 = 0;
while (_local2 < shotField.getNextHighestDepth()) {
removeMovieClip(shotField["shot" + _local2]);
_local2++;
}
}
function Chk() {
var _local2 = new LocalConnection();
var _local1 = _local2.domain();
if (_local1.indexOf("handdrawngames.com", 0) > 0) {
return(true);
}
return(false);
}
}
Symbol 221 MovieClip [__Packages.NetComms] Frame 0
class NetComms
{
var received, sndCmds, cmds, sendOK, loadOK, ID, llv, clientID, slv;
function NetComms () {
received = new Object();
sndCmds = [];
cmds = [];
sendOK = true;
loadOK = true;
ID = 0;
}
function Reset() {
sndCmds = [];
cmds = [];
sendOK = true;
loadOK = true;
ID = 0;
}
function FrameTick(frame) {
var _local4 = 0;
while (_local4 < cmds.length) {
var _local3 = cmds[_local4];
if (_local3.expFrame == frame) {
if (_local3.ack) {
var _local6 = int(_local3.cmd.substr(0, 1));
var _local5 = _local3.cmd.substr(1, 2);
if (_local5 == "AT") {
_root.game.PlaceTowerFromComms(_local3.cmd.substr(3));
}
}
}
_local4++;
}
}
function AddCommand(frame, expFrame, cmd) {
var _local2 = {id:++ID, frame:frame, expFrame:expFrame, cmd:cmd, ack:false, sentFrame:0};
cmds.push(_local2);
trace("AC:" + _local2);
}
function ServerLoad(frame) {
if (loadOK) {
llv = new LoadVars();
llv.ref = this;
loadOK = false;
llv.onLoad = function (success) {
if (success) {
trace("load ok");
this.ref.DecodeLoad();
this.ref.loadOK = true;
} else {
trace("load fail");
this.ref.loadOK = true;
}
};
llv.load((("http://www.handdrawngames.com/desktoptd/ServerLoad.asp?cid=" + clientID) + "&frame=") + frame);
}
}
function ServerSend(frame) {
var _local3;
trace("Send");
if (sendOK) {
sndCmds = [];
var _local2 = 0;
while (_local2 < cmds.length) {
_local3 = cmds[_local2];
if ((!_local3.ack) && (_local3.sentFrame == 0)) {
sndCmds.push(_local3);
}
_local2++;
}
if (sndCmds.length > 0) {
SendCommands();
}
}
}
function SendCommands(frame) {
slv = new LoadVars();
slv.ref = this;
slv.frame = frame;
sendOK = false;
slv.onLoad = function (success) {
if (success) {
trace("send ok");
this.ref.DecodeSave();
this.ref.sendOK = true;
} else {
trace("send fail");
this.ref.sendOK = true;
}
};
var _local2 = CreateURLArguments();
trace("Send Args:" + _local2);
slv.load("http://www.handdrawngames.com/desktoptd/ServerSave.asp?" + _local2);
sendOK = false;
}
function DecodeSave() {
var _local2 = 0;
while (_local2 < sndCmds.length) {
var _local3 = sndCmds[_local2];
_local3.sentFrame = slv.frame;
_local2++;
}
}
function DecodeLoad() {
var _local4 = int(llv.id);
var _local5 = int(llv.cid);
if (_local5 == clientID) {
var _local2 = 0;
while (_local2 < cmds.length) {
var _local3 = cmds[_local2];
if (_local3.id == _local4) {
trace("ID ACK:" + _local4);
_local3.ack = true;
break;
}
_local2++;
}
}
}
function CreateURLArguments() {
var _local4 = "";
var _local3 = 0;
while (_local3 < sndCmds.length) {
var _local2 = sndCmds[_local3];
_local4 = _local4.concat((("cid=" + clientID) + "&id=") + _local2.id, "&frame=" + _local2.frame, "&expFrame=" + _local2.expFrame, "&cmd=" + _local2.cmd);
_local3++;
}
return(_local4);
}
}
Symbol 222 MovieClip [__Packages.PathFinder] Frame 0
class PathFinder
{
var mapH, mapW, mapStatus, openList;
function PathFinder () {
}
function FindPath(map, startY, startX, endY, endX) {
var _local17 = 10;
var _local14 = 14;
var _local16 = true;
var _local15 = false;
mapH = map.length;
mapW = map[0].length;
mapStatus = new Array();
var _local13 = 0;
while (_local13 < mapH) {
mapStatus[_local13] = new Array();
_local13++;
}
if (startY == undefined) {
return("ERROR: No starting point");
}
if (endY == undefined) {
return("ERROR: No ending point");
}
openList = new Array();
openSquare(startY, startX, undefined, 0);
while ((openList.length > 0) && (!isClosed(endY, endX))) {
_local13 = nearerSquare();
var _local9 = openList[_local13][0];
var _local10 = openList[_local13][1];
closeSquare(_local9, _local10);
var _local3 = _local9 + 1;
while (_local3 >= (_local9 - 1)) {
var _local2 = _local10 - 1;
while (_local2 <= (_local10 + 1)) {
if ((((((_local3 >= 0) && (_local3 < mapH)) && (_local2 >= 0)) && (_local2 < mapW)) && (!((_local3 == _local9) && (_local2 == _local10)))) && ((_local16 || (_local3 == _local9)) || (_local2 == _local10))) {
var _local4 = true;
if (((!_local15) && (_local3 != _local9)) && (_local2 != _local10)) {
if (map[_local3][_local10].cost == 0) {
_local4 = false;
} else if (map[_local9][_local2].cost == 0) {
_local4 = false;
}
}
if (_local4 && (map[_local3][_local2].cost != 0)) {
if (!isClosed(_local3, _local2)) {
var _local7;
if (mapStatus[_local9][_local10].movementCost == undefined) {
_local7 = 0;
} else {
_local7 = mapStatus[_local9][_local10].movementCost;
}
var _local5 = _local7 + ((((_local3 == _local9) || (_local2 == _local10)) ? (_local17) : (_local14)) * map[_local3][_local2].cost);
if (isOpen(_local3, _local2)) {
if (_local5 < mapStatus[_local3][_local2].movementCost) {
openSquare(_local3, _local2, [_local9, _local10], _local5, undefined, true);
}
} else {
var _local8 = (Math.abs(_local3 - endY) + Math.abs(_local2 - endX)) * 10;
openSquare(_local3, _local2, [_local9, _local10], _local5, _local8, false);
}
}
}
}
_local2++;
}
_local3--;
}
}
var _local23 = isClosed(endY, endX);
if (_local23) {
var _local20 = new Array();
var _local9 = endY;
var _local10 = endX;
while ((_local9 != startY) || (_local10 != startX)) {
_local20.push([_local9, _local10, mapStatus[_local9][_local10].movementCost]);
var _local18 = mapStatus[_local9][_local10].parent[0];
var _local19 = mapStatus[_local9][_local10].parent[1];
_local9 = _local18;
_local10 = _local19;
}
_local20.push([startY, startX]);
return(_local20);
}
return(undefined);
}
function isOpen(y, x) {
return(mapStatus[y][x].open);
}
function isClosed(y, x) {
return(mapStatus[y][x].closed);
}
function nearerSquare() {
var _local5 = 999999 /* 0x0F423F */;
var _local6 = 0;
var _local3;
var _local4;
var _local2 = openList.length;
while ((_local2--) > 0) {
_local4 = mapStatus[openList[_local2][0]][openList[_local2][1]];
_local3 = _local4.heuristic + _local4.movementCost;
if (_local3 <= _local5) {
_local5 = _local3;
_local6 = _local2;
}
}
return(_local6);
}
function closeSquare(y, x) {
var _local3 = openList.length;
var _local2 = 0;
while (_local2 < _local3) {
if (openList[_local2][0] == y) {
if (openList[_local2][1] == x) {
openList.splice(_local2, 1);
break;
}
}
_local2++;
}
mapStatus[y][x].open = false;
mapStatus[y][x].closed = true;
}
function openSquare(y, x, parent, movementCost, heuristic, replacing) {
if (!replacing) {
openList.push([y, x]);
mapStatus[y][x] = {heuristic:heuristic, open:true, closed:false};
}
mapStatus[y][x].parent = parent;
mapStatus[y][x].movementCost = movementCost;
}
}
Symbol 159 MovieClip Frame 1
_root.Interface.difficulty.difficulty;
Symbol 168 MovieClip Frame 1
function Show() {
fade = 0;
this.cacheAsBitmap = true;
this._visible = true;
this._alpha = fade;
this.onEnterFrame = function () {
fade = fade + 20;
this._alpha = fade;
if (fade >= 80) {
this.cacheAsBitmap = false;
this._alpha = 80;
clearInterval(intervalID);
intervalId = setInterval(this, "executeCallback", 1000);
this.onEnterFrame = "";
}
};
}
function Hide() {
fade = 80;
this.cacheAsBitmap = true;
this.onEnterFrame = function () {
fade = fade - 10;
this._alpha = fade;
if (fade <= 0) {
this.cacheAsBitmap = false;
this._visible = false;
this._alpha = 0;
this.onEnterFrame = "";
}
};
}
function executeCallback() {
clearInterval(intervalId);
Hide();
}
var intervalId = 0;
var fade;
Instance of Symbol 176 MovieClip "levelBarHighlight" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
this.filters = [new flash.filters.GlowFilter(16750848, 0.8, 10, 10, 5, 3)];
}
Instance of Symbol 174 MovieClip "btnPellet" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndStop(1);
}
on (press) {
if (_root.game.gameState == -1) {
return(undefined);
}
if (_root.game.gameState < 2) {
_root.game.AddTower(1, true);
}
}
on (rollOver) {
_root.game.TowerButtonRollover(1, this);
}
on (rollOut) {
_root.game.infoPanel.CancelInfo();
this.filters = [];
}
Instance of Symbol 172 MovieClip "btnNextLevel" in Symbol 180 MovieClip Frame 1
on (press) {
_root.game.SendNextLevel();
}
Instance of Symbol 174 MovieClip "btnSquirt" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndStop(3);
}
on (press) {
if (_root.game.gameState == -1) {
return(undefined);
}
if (_root.game.gameState < 2) {
_root.game.AddTower(3, true);
}
}
on (rollOver) {
_root.game.TowerButtonRollover(3, this);
}
on (rollOut) {
_root.game.infoPanel.CancelInfo();
this.filters = [];
}
Instance of Symbol 174 MovieClip "btnDart" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndStop(2);
}
on (press) {
if (_root.game.gameState == -1) {
return(undefined);
}
if (_root.game.gameState < 2) {
_root.game.AddTower(2, true);
}
}
on (rollOver) {
_root.game.TowerButtonRollover(2, this);
}
on (rollOut) {
_root.game.infoPanel.CancelInfo();
this.filters = [];
}
Instance of Symbol 174 MovieClip "btnFrost" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndStop(5);
}
on (press) {
if (_root.game.gameState == -1) {
return(undefined);
}
if (_root.game.gameState < 2) {
_root.game.AddTower(5, true);
}
}
on (rollOver) {
_root.game.TowerButtonRollover(5, this);
}
on (rollOut) {
_root.game.infoPanel.CancelInfo();
this.filters = [];
}
Instance of Symbol 174 MovieClip "btnSwarm" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
this.gotoAndStop(4);
}
on (press) {
if (_root.game.gameState == -1) {
return(undefined);
}
if (_root.game.gameState < 2) {
_root.game.AddTower(4, true);
}
}
on (rollOver) {
_root.game.TowerButtonRollover(4, this);
}
on (rollOut) {
_root.game.infoPanel.CancelInfo();
this.filters = [];
}
Instance of Symbol 38 MovieClip in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
msg.text = "MUTE";
}
on (press) {
if (msg.text == "MUTE") {
_root.game.muted = true;
msg.text = "UNMUTE";
} else {
_root.game.muted = false;
msg.text = "MUTE";
}
}
Instance of Symbol 38 MovieClip "btnGrid" in Symbol 180 MovieClip Frame 1
onClipEvent (load) {
msg.text = "GRID";
}
on (press) {
_root.game.ToggleGrid();
}
Instance of Symbol 39 MovieClip [Top] "topMenu" in Symbol 180 MovieClip Frame 1
/* no clip actions */
Symbol 190 MovieClip Frame 1
function SetScore(num, diff, finished) {
btnCancel._visible = true;
if (diff == 4) {
if (finished) {
btnSubmit._visible = true;
desc.text = "You have beaten the challenge! You may submit your score.";
playerName._visible = true;
Selection.setFocus("playerName");
} else {
btnSubmit._visible = false;
desc.text = "You have failed to beat the challenge! You must beat the challenge to submit a score.";
playerName._visible = false;
Selection.setFocus("playerName");
}
} else if ((num > 499) && (_root.game.difficulty > 1)) {
btnSubmit._visible = true;
desc.text = "You may submit your score by filling in your name and clicking submit.";
playerName._visible = true;
Selection.setFocus("playerName");
} else if (_root.game.difficulty == 1) {
btnSubmit._visible = false;
playerName._visible = false;
desc.text = "Play at a harder level to submit your scores. Click 'Reset' and try again!";
} else {
btnSubmit._visible = false;
playerName._visible = false;
desc.text = "You have lost.\rClick 'Reset' and try again!";
}
score.text = num;
_visible = true;
}
this.filters = [new flash.filters.GlowFilter(16750848, 0.8, 10, 10, 2, 3)];
Instance of Symbol 38 MovieClip "btnCancel" in Symbol 190 MovieClip Frame 1
onClipEvent (load) {
msg.text = "CLOSE";
}
on (press) {
_root.scoreBoard._visible = false;
_root.game.PlayButtonSound();
if (!_root.game.Chk()) {
getURL ("http://www.handdrawngames.com/DesktopTD", "_self");
}
}
Instance of Symbol 38 MovieClip "btnSubmit" in Symbol 190 MovieClip Frame 1
onClipEvent (load) {
msg.text = "SUBMIT";
}
on (press) {
_root.scoreBoard.btnSubmit._visible = false;
_root.scoreBoard.btnCancel._visible = false;
_root.game.PlayButtonSound();
_root.game.SendScore(this._parent.playerName.text);
}
Instance of Symbol 38 MovieClip in Symbol 199 MovieClip Frame 1
onClipEvent (load) {
msg.text = "EASY";
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
_root.game.difficulty = 1;
_root.game.Init();
_root.startPanel.Fade();
_root.game.PlayButtonSound();
}
Instance of Symbol 38 MovieClip in Symbol 199 MovieClip Frame 1
onClipEvent (load) {
msg.text = "NORMAL";
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
_root.game.difficulty = 2;
_root.game.Init();
_root.startPanel.Fade();
_root.game.PlayButtonSound();
}
Instance of Symbol 38 MovieClip in Symbol 199 MovieClip Frame 1
onClipEvent (load) {
msg.text = "HARD";
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
_root.game.difficulty = 3;
_root.game.Init();
_root.startPanel.Fade();
_root.game.PlayButtonSound();
}
Instance of Symbol 38 MovieClip in Symbol 199 MovieClip Frame 1
onClipEvent (load) {
msg.text = "CHALLENGE";
var format = msg.getTextFormat();
format.size = format.size - 2;
msg.setTextFormat(format);
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
_parent._visible = false;
_parent._parent.challengeSelect._visible = true;
_root.game.PlayButtonSound();
}
Instance of Symbol 38 MovieClip in Symbol 206 MovieClip Frame 1
onClipEvent (load) {
msg.text = "BACK";
}
on (press) {
_parent._visible = false;
_parent._parent.levelSelect._visible = true;
_root.game.PlayButtonSound();
}
Instance of Symbol 38 MovieClip in Symbol 206 MovieClip Frame 1
onClipEvent (load) {
msg.text = "NO SWARM";
var format = msg.getTextFormat();
format.size = format.size - 2;
msg.setTextFormat(format);
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
with (_root.game) {
difficulty = 4;
NoSwarm = true;
Init();
_root.startPanel.Fade();
PlayButtonSound();
}
}
Instance of Symbol 38 MovieClip in Symbol 206 MovieClip Frame 1
onClipEvent (load) {
msg.text = "NO DART";
var format = msg.getTextFormat();
format.size = format.size - 2;
msg.setTextFormat(format);
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
with (_root.game) {
difficulty = 4;
NoDart = true;
Init();
_root.startPanel.Fade();
PlayButtonSound();
}
}
Instance of Symbol 38 MovieClip in Symbol 206 MovieClip Frame 1
onClipEvent (load) {
msg.text = "NO SQUIRT";
var format = msg.getTextFormat();
format.size = format.size - 2;
msg.setTextFormat(format);
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
with (_root.game) {
difficulty = 4;
NoSquirt = true;
Init();
_root.startPanel.Fade();
PlayButtonSound();
}
}
Instance of Symbol 38 MovieClip in Symbol 206 MovieClip Frame 1
onClipEvent (load) {
msg.text = "NO FROST";
var format = msg.getTextFormat();
format.size = format.size - 2;
msg.setTextFormat(format);
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
with (_root.game) {
difficulty = 4;
NoFrost = true;
Init();
_root.startPanel.Fade();
PlayButtonSound();
}
}
Instance of Symbol 38 MovieClip in Symbol 206 MovieClip Frame 1
onClipEvent (load) {
msg.text = "SQUIRTS";
var format = msg.getTextFormat();
format.size = format.size - 2;
msg.setTextFormat(format);
}
on (press) {
if (_root.startPanel.fade > 0) {
return(undefined);
}
with (_root.game) {
difficulty = 4;
NoPellet = true;
NoDart = true;
NoSwarm = true;
Init();
_root.startPanel.Fade();
PlayButtonSound();
}
}
Symbol 207 MovieClip Frame 1
function Show() {
_visible = true;
challengeSelect._visible = false;
levelSelect._visible = true;
}
function Fade() {
fade = 100;
this.cacheAsBitmap = true;
this.onEnterFrame = function () {
fade = fade - 10;
this._alpha = fade;
this.filters = [new flash.filters.BlurFilter((100 - fade) / 5, 0, 3)];
if (fade <= 0) {
this.filters = [new flash.filters.GlowFilter(16750848, 0.8, 10, 10, 2, 3)];
this.cacheAsBitmap = false;
this._visible = false;
this._alpha = 100;
this.onEnterFrame = "";
}
};
}
var fade;
this.filters = [new flash.filters.GlowFilter(16750848, 0.8, 10, 10, 2, 3)];
challengeSelect._visible = false;