Frame 1
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
Frame 2
gotoAndPlay ("InitOnce");
Frame 4
function soundGun(ID) {
if (((((ID == 39) or (ID == 40)) or (ID < 33)) or (GunPack[ID].position == 0)) or (GunPack[ID].position == GunPack[ID].duration)) {
GunPack[ID].start();
}
}
function Muzic(ID) {
i = 0;
while (i < MusicPack.length) {
MusicPack[i].stop();
i++;
}
MusicPack[ID].start(0.05, 9999);
}
function Zound(ID) {
i = 0;
while (i < SoundPack.length) {
SoundPack[i].stop();
i++;
}
SoundPack[ID].start(0.05, 9999);
}
var choosenMap = 1;
var choosenMode = 1;
var GunPack = new Array();
var i = 0;
while (i < 39) {
var j = i;
if (j < 10) {
j = "0" + j;
}
Music0 = new Sound();
if ((j >= 20) and (j <= 25)) {
j = "04";
}
if ((j >= 29) and (j <= 31)) {
j = "05";
}
if ((j > 26) and (j <= 28)) {
j = "26";
}
Music0.attachSound("gun" + j);
GunPack.push(Music0);
i++;
}
Music0 = new Sound();
Music0.attachSound("gun32");
GunPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("gun32");
GunPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("gun33");
GunPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("gun33");
GunPack.push(Music0);
var SoundPack = new Array();
Music0 = new Sound();
Music0.attachSound("Sound0");
SoundPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Sound1");
SoundPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Sound2");
SoundPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Sound1");
SoundPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Sound3");
SoundPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Sound4");
SoundPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Sound5");
SoundPack.push(Music0);
var MusicPack = new Array();
Music0 = new Sound();
Music0.attachSound("Music0");
MusicPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Music1");
MusicPack.push(Music0);
Music0 = new Sound();
Music0.attachSound("Music2");
MusicPack.push(Music0);
Frame 5
Muzic(0);
stop();
Frame 6
stop();
Frame 7
stop();
Map1.onRelease = function () {
choosenMode = myComboBox.getChoosen();
choosenMap = 1;
_root.gotoAndStop("MainGame");
};
Map2.onRelease = function () {
choosenMode = myComboBox.getChoosen();
choosenMap = 2;
_root.gotoAndStop("MainGame");
};
Map3.onRelease = function () {
choosenMode = myComboBox.getChoosen();
choosenMap = 3;
_root.gotoAndStop("MainGame");
};
Map4.onRelease = function () {
choosenMode = myComboBox.getChoosen();
choosenMap = 4;
_root.gotoAndStop("MainGame");
};
myComboBox.cb1.onRollOver = function () {
Detail.text = "You can test your tower Ability and effectiveness by this mode.";
};
myComboBox.cb2.onRollOver = function () {
Detail.text = "Easy mode is normal play mode but the enemy has a lower health.";
};
myComboBox.cb3.onRollOver = function () {
Detail.text = "Hard mode is normal play mode but the enemy has more health than easy mode.";
};
Map1.onRollOver = function () {
Detail.text = "In this straight line road the undead will walk along the path.";
};
Map2.onRollOver = function () {
Detail.text = "In this road the undead will split if they found an intersections. You need to carefully place your armed citizens";
};
Map3.onRollOver = function () {
Detail.text = "This snake road is the longest path from the other maps.";
};
Map4.onRollOver = function () {
Detail.text = "In this circular road. The game will be in different mode, you need to kill the undead before its number reach 100.";
};
Frame 8
Path = function () {
this.init.apply(this, arguments);
};
Path.prototype.init = function (start_x, start_y) {
this._segments = [];
this._length = 0;
if (arguments.length) {
this.moveTo(start_x, start_y);
} else {
this.moveTo(0, 0);
}
};
Path.prototype.curveToAccuracy = 10;
Path.prototype.clear = function () {
this.init(0, 0);
};
Path.prototype.moveTo = function (start_x, start_y) {
this._position = {_x:start_x, _y:start_y};
return(this);
};
Path.prototype.lineTo = function (end_x, end_y) {
var _local3 = end_x - this._position._x;
var _local2 = end_y - this._position._y;
var _local4 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
this._segments[this._segments.length] = {d:_local4, start:this._position, end:{_x:end_x, _y:end_y}, type:"L"};
this._length = this._length + _local4;
this._position = {_x:end_x, _y:end_y};
return(this);
};
Path.prototype.circleTo = (Path.prototype.circleCWTo = function (end_x, end_y, arc, dir) {
if (dir == undefined) {
dir = "CW";
}
if (arc == undefined) {
arc = 0.5;
}
if (arc > 1) {
arc = 1;
} else if (arc <= 0) {
return(this.lineTo(end_x, end_y));
}
if (dir == "CCW") {
arc = 1 - arc;
}
var _local3 = {_x:(this._position._x + end_x) / 2, _y:(this._position._y + end_y) / 2};
var _local5 = end_x - this._position._x;
var _local4 = end_y - this._position._y;
var _local12 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
var _local8 = _local12 / 2;
var _local9 = _local8 / Math.tan(arc * Math.PI);
var _local11 = _local8 / Math.sin(arc * Math.PI);
var _local10 = Math.atan2(_local4, _local5) + (Math.PI/2);
_local3._x = _local3._x + (Math.cos(_local10) * _local9);
_local3._y = _local3._y + (Math.sin(_local10) * _local9);
var _local18 = Math.atan2(this._position._y - _local3._y, this._position._x - _local3._x);
var _local16 = Math.atan2(end_y - _local3._y, end_x - _local3._x);
if (dir == "CW") {
if (_local16 < _local18) {
_local16 = _local16 + (Math.PI*2);
}
} else if (_local18 < _local16) {
_local18 = _local18 + (Math.PI*2);
}
_local12 = _local11 * Math.abs(_local16 - _local18);
this._segments[this._segments.length] = {d:_local12, r:_local11, a1:_local18, a2:_local16, o:_local3, dir:dir, type:"C"};
this._length = this._length + _local12;
this._position = {_x:end_x, _y:end_y};
return(this);
});
Path.prototype.circleCCWTo = function (end_x, end_y, arc) {
return(this.circleTo.call(this, end_x, end_y, arc, "CCW"));
};
Path.prototype.curveTo = function (con_x, con_y, end_x, end_y) {
var _local3 = this.divideBezier(this._position._x, this._position._y, con_x, con_y, end_x, end_y);
this._segments[this._segments.length] = {d:_local3.d, start:this._position, con:{_x:con_x, _y:con_y}, end:{_x:end_x, _y:end_y}, segs:_local3, type:"B"};
this._length = this._length + _local3.d;
this._position = {_x:end_x, _y:end_y};
return(this);
};
Path.prototype.divideBezier = function (x1, y1, x2, y2, x3, y3) {
var _local2;
var _local15;
var _local14;
var _local12;
var _local11;
var _local9;
var _local8;
var _local7;
var _local6;
var _local29;
var _local13 = [];
var _local5 = {_x:x1, _y:y1};
var _local22 = x2 - x1;
var _local20 = y2 - y1;
var _local21 = x3 - x2;
var _local19 = y3 - y2;
var _local16 = Math.atan2;
var _local18 = Math.sqrt;
var _local17 = 0;
var _local36;
var _local3;
var _local10;
var _local30 = _local16(_local20, _local22);
var _local4 = 1;
while (_local4 < this.curveToAccuracy) {
_local2 = _local4 / this.curveToAccuracy;
_local15 = x1 + (_local22 * _local2);
_local12 = (x2 + (_local21 * _local2)) - _local15;
_local14 = y1 + (_local20 * _local2);
_local11 = (y2 + (_local19 * _local2)) - _local14;
_local7 = _local15 + (_local12 * _local2);
_local6 = _local14 + (_local11 * _local2);
_local9 = _local7 - _local5._x;
_local8 = _local6 - _local5._y;
_local29 = _local18((_local9 * _local9) + (_local8 * _local8));
_local17 = _local17 + _local29;
_local10 = _local16(_local11, _local12);
_local3 = _local10 - _local30;
if (_local3 > Math.PI) {
_local3 = _local3 - (Math.PI*2);
} else if (_local3 < -3.14159265358979) {
_local3 = _local3 + (Math.PI*2);
}
_local13[_local13.length] = {d:_local29, start:_local5, end:{_x:_local7, _y:_local6}, a:{base:_local30, d:_local3}};
_local30 = _local10;
_local5 = {_x:_local7, _y:_local6};
_local4++;
}
_local9 = x3 - _local5._x;
_local8 = y3 - _local5._y;
_local29 = _local18((_local9 * _local9) + (_local8 * _local8));
_local17 = _local17 + _local29;
_local10 = _local16(_local19, _local21);
_local13[_local13.length] = {d:_local29, start:_local5, end:{_x:x3, _y:y3}, a:{base:_local30, d:_local10 - _local30}};
_local13.d = _local17;
return(_local13);
};
Path.prototype.setInBezier = function (obj, t, s, orient) {
if (t < 0) {
t = 0;
} else if (t > 1) {
t = 1;
}
var _local6 = s.d * t;
var _local2;
var _local3 = 0;
var _local4 = s.length + 1;
var _local1 = 1;
while (_local1 < _local4) {
_local2 = s[_local1 - 1];
if ((_local1 == _local4) || ((_local3 + _local2.d) >= _local6)) {
break;
}
_local3 = _local3 + _local2.d;
_local1++;
}
t = (_local6 - _local3) / _local2.d;
var _local9 = _local2.end._x - _local2.start._x;
var _local8 = _local2.end._y - _local2.start._y;
obj._x = _local2.start._x + (_local9 * t);
obj._y = _local2.start._y + (_local8 * t);
if (orient) {
obj._rotation = ((_local2.a.base + (_local2.a.d * t)) * 180) / Math.PI;
}
};
Path.prototype.traverse = function (obj, t, orient) {
if (t < 0) {
t = 0;
} else if (t > 1) {
t = 1;
}
var _local7 = this._length * t;
var _local3;
var _local4 = 0;
var _local5 = this._segments.length + 1;
var _local2 = 1;
while (_local2 < _local5) {
_local3 = this._segments[_local2 - 1];
if ((_local2 == _local5) || ((_local4 + _local3.d) >= _local7)) {
break;
}
_local4 = _local4 + _local3.d;
_local2++;
}
t = (_local7 - _local4) / _local3.d;
switch (_local3.type) {
case "L" :
var _local11 = _local3.end._x - _local3.start._x;
var _local10 = _local3.end._y - _local3.start._y;
obj._x = _local3.start._x + (_local11 * t);
obj._y = _local3.start._y + (_local10 * t);
if (orient) {
obj._rotation = (Math.atan2(_local10, _local11) * 180) / Math.PI;
}
break;
case "C" :
var _local12 = _local3.a1;
var _local13 = _local3.a2;
var _local9 = _local12 + ((_local13 - _local12) * t);
obj._x = _local3.o._x + (Math.cos(_local9) * _local3.r);
obj._y = _local3.o._y + (Math.sin(_local9) * _local3.r);
if (orient) {
obj._rotation = ((_local3.dir == "CW") ? (((_local9 * 180) / Math.PI) + 90) : (((_local9 * 180) / Math.PI) - 90));
}
break;
case "B" :
this.setInBezier(obj, t, _local3.segs, orient);
}
return(this);
};
Path.prototype.mcCircleTo = function (cen_x, cen_y, a1, a2, r) {
var _local5 = Math.cos;
var _local6 = Math.sin;
var _local14 = Math.abs(a2 - a1);
var _local13 = Math.floor(_local14 / (Math.PI/4)) + 1;
var _local11 = _local14 / _local13;
var _local12 = _local11 / 2;
var _local8 = r / _local5(_local12);
this.moveTo(cen_x + (_local5(a1) * r), cen_y + (_local6(a1) * r));
var _local3 = 0;
while (_local3 < _local13) {
a2 = a1 + _local12;
a1 = a1 + _local11;
this.curveTo(cen_x + (_local5(a2) * _local8), cen_y + (_local6(a2) * _local8), cen_x + (_local5(a1) * r), cen_y + (_local6(a1) * r));
_local3++;
}
return(this);
};
Path.prototype.draw = function (mc) {
var _local3 = this._segments;
var _local5 = _local3.length;
var _local2 = 0;
while (_local2 < _local5) {
switch (_local3[_local2].type) {
case "L" :
mc.moveTo(_local3[_local2].start._x, _local3[_local2].start._y);
mc.lineTo(_local3[_local2].end._x, _local3[_local2].end._y);
break;
case "C" :
if (_local3[_local2].dir == "CW") {
this.mcCircleTo.call(mc, _local3[_local2].o._x, _local3[_local2].o._y, _local3[_local2].a1, _local3[_local2].a2, _local3[_local2].r);
} else {
this.mcCircleTo.call(mc, _local3[_local2].o._x, _local3[_local2].o._y, _local3[_local2].a2, _local3[_local2].a1, _local3[_local2].r);
}
break;
case "B" :
mc.moveTo(_local3[_local2].start._x, _local3[_local2].start._y);
mc.curveTo(_local3[_local2].con._x, _local3[_local2].con._y, _local3[_local2].end._x, _local3[_local2].end._y);
}
_local2++;
}
return(this);
};
function mouseMoveHandler() {
}
function createMap(ID) {
road.gotoAndStop(ID);
roadTrap.gotoAndStop(ID);
TreeImg.gotoAndStop(ID);
RoadPNG.gotoAndStop(ID);
game.ID = ID;
if (ID == 1) {
game._loop = true;
var _local1 = new Array();
_local1[0] = {x:154, y:2};
_local1[1] = {x:154, y:166};
_local1[2] = {x:61, y:166};
_local1[3] = {x:61, y:404};
_local1[4] = {x:159, y:404};
_local1[5] = {x:159, y:280};
_local1[6] = {x:245, y:280};
_local1[7] = {x:245, y:128};
_local1[8] = {x:382, y:128};
_local1[9] = {x:382, y:362};
_local1[10] = {x:248, y:362};
_local1[11] = {x:248, y:471};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -20;
_local1[i].y = _local1[i].y + 2;
i++;
}
enemyPath1 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath1.lineTo(_local1[i].x, _local1[i].y);
i++;
}
enemyPath2 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath2.lineTo(_local1[i].x, _local1[i].y);
i++;
}
enemyPath3 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath3.lineTo(_local1[i].x, _local1[i].y);
i++;
}
} else if (ID == 2) {
game._loop = true;
var _local1 = new Array();
_local1[0] = {x:330, y:3};
_local1[1] = {x:330, y:255};
_local1[2] = {x:240, y:255};
_local1[3] = {x:240, y:347};
_local1[4] = {x:285, y:347};
_local1[5] = {x:285, y:470};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -20;
_local1[i].y = _local1[i].y + 0;
i++;
}
enemyPath1 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath1.lineTo(_local1[i].x, _local1[i].y);
i++;
}
_local1[0] = {x:330, y:3};
_local1[1] = {x:330, y:120};
_local1[2] = {x:240, y:120};
_local1[3] = {x:240, y:346};
_local1[4] = {x:285, y:346};
_local1[5] = {x:285, y:470};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -20;
_local1[i].y = _local1[i].y + 0;
i++;
}
enemyPath2 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath2.lineTo(_local1[i].x, _local1[i].y);
i++;
}
_local1[0] = {x:330, y:3};
_local1[1] = {x:330, y:120};
_local1[2] = {x:240, y:120};
_local1[3] = {x:240, y:165};
_local1[4] = {x:105, y:165};
_local1[5] = {x:105, y:348};
_local1[6] = {x:285, y:348};
_local1[7] = {x:285, y:470};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -20;
_local1[i].y = _local1[i].y + 0;
i++;
}
enemyPath3 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath3.lineTo(_local1[i].x, _local1[i].y);
i++;
}
} else if (ID == 3) {
game._loop = true;
var _local1 = new Array();
_local1[0] = {x:-23, y:354};
_local1[1] = {x:100, y:354};
_local1[2] = {x:100, y:127};
_local1[3] = {x:195, y:127};
_local1[4] = {x:195, y:354};
_local1[5] = {x:288, y:354};
_local1[6] = {x:288, y:128};
_local1[7] = {x:377, y:128};
_local1[8] = {x:377, y:355};
_local1[9] = {x:466, y:355};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -24;
_local1[i].y = _local1[i].y + 0;
i++;
}
enemyPath1 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath1.lineTo(_local1[i].x, _local1[i].y);
i++;
}
enemyPath2 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath2.lineTo(_local1[i].x, _local1[i].y);
i++;
}
enemyPath3 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath3.lineTo(_local1[i].x, _local1[i].y);
i++;
}
} else if (ID == 4) {
game._loop = true;
var _local1 = new Array();
_local1[0] = {x:-20, y:367};
_local1[1] = {x:57, y:367};
_local1[2] = {x:57, y:227};
_local1[3] = {x:145, y:227};
_local1[4] = {x:145, y:185};
_local1[5] = {x:285, y:185};
_local1[6] = {x:285, y:320};
_local1[7] = {x:145, y:320};
_local1[8] = {x:145, y:227};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -24;
_local1[i].y = _local1[i].y + -6;
i++;
}
enemyPath1 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath1.lineTo(_local1[i].x, _local1[i].y);
i++;
}
_local1 = new Array();
_local1[0] = {x:235, y:5};
_local1[1] = {x:235, y:92};
_local1[2] = {x:57, y:92};
_local1[3] = {x:57, y:412};
_local1[4] = {x:377, y:412};
_local1[5] = {x:377, y:92};
_local1[6] = {x:235, y:92};
i = 0;
while (i < _local1.length) {
_local1[i].x = _local1[i].x + -24;
_local1[i].y = _local1[i].y + -6;
i++;
}
enemyPath2 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath2.lineTo(_local1[i].x, _local1[i].y);
i++;
}
enemyPath3 = new Path(_local1[0].x, _local1[0].y);
i = 1;
while (i < _local1.length) {
enemyPath3.lineTo(_local1[i].x, _local1[i].y);
i++;
}
}
}
function init() {
Muzic(-1);
_quality = "Medium";
Level = -1;
maxLevel = 100;
prepareLevel = 2;
if (!game._loop) {
prepareLevel = 0;
}
enemyStackDelay = 0;
Money = 100;
Health = 100;
_root.NavigationBar.upgrade.upgradeEffect._visible = false;
_root.UpgradePanel._visible = false;
PanelRUSure._visible = false;
PanelRUSure.BtnYes.onRelease = function () {
_root.gotoAndStop("MainMenu");
_root.uninit();
};
PanelRUSure.BtnNo.onRelease = function () {
this._parent._visible = false;
};
_root.DialogGun._visible = false;
delete timeOut;
if (choosenMode == 1) {
_root.rangeUnlocked = true;
_root.meleeUnlocked = true;
timeOut = 1800;
Money = 8000;
var _local3 = 0;
while (_local3 < 500) {
enemyStack.push((_local3 % 13) + 1);
enemyStackHealth.push(999999);
_local3++;
}
}
firstNext = false;
if (choosenMode == 3) {
game.difficult = 3;
}
GradienBGDetail.setMask(Detail);
if (game._loop) {
DisplayNextWave.GradienBGnextWave.setMask(DisplayNextWave.nextWave);
DisplayNextWave.nextWave.text = "Next: -";
} else {
DisplayNextWave._visible = false;
}
guns.gotoAndStop(guns._totalframes);
}
function uninit() {
}
function moveEnemy(enemy) {
var _local5 = enemyPath3._length / this["enemyPath" + enemy._path]._length;
enemy.t = enemy.t + (((enemy.dt * enemy.tMod) * enemy.tPoi) * _local5);
if (enemy.tModDelay > 0) {
enemy.tModDelay--;
} else {
enemy.tMod = 1;
}
if (enemy.tPoiDelay > 0) {
enemy.tPoiDelay--;
} else {
enemy.tPoi = 1;
}
if (enemy._path == 1) {
enemyPath1.traverse(enemy, enemy.t / 100, true);
} else if (enemy._path == 2) {
enemyPath2.traverse(enemy, enemy.t / 100, true);
} else {
enemyPath3.traverse(enemy, enemy.t / 100, true);
}
if (enemy.t > 100) {
if (game._loop) {
enemy.t = 0;
if (game.ID == 4) {
if (enemy._path == 1) {
enemy.t = 35.7;
} else {
enemy.t = 6.375;
}
}
} else {
enemy.t = 0;
_root.Health = _root.Health - 5;
}
} else if (enemy.health <= 0) {
game.kill = game.kill + 1;
game.score = game.score + enemy._maxHealth;
if (enemyProperty[enemy._currentframe][__ENEXTFORM] <= 0) {
_root.Money = _root.Money + calcMoney(enemy.level);
}
if (enemyProperty[enemy._currentframe][__ENEXTFORM] > 0) {
createEnemy(enemyProperty[enemy._currentframe][__ENEXTFORM], enemy.t, int(enemy._maxHealth / 2), enemy._path);
}
enemy.removeMovieClip();
}
enemy.enemyHealth.gotoAndStop(int((enemy.health * 100) / enemy._maxHealth));
enemy.enemyHealth._rotation = -enemy._rotation;
var _local4 = new Object({x:enemy._x - 5, y:enemy._y - 10});
container.localToGlobal(_local4);
enemy.globalToLocal(_local4);
enemy.enemyHealth._x = _local4.x;
enemy.enemyHealth._y = _local4.y;
}
function createEnemy(_Level, _start, _health, pos) {
var _local2 = container.attachMovie("enemies", "enemies" + _root.inc, container.getNextHighestDepth());
_local2.attachMovie("enemyHealth", "enemyHealth", 1);
_local2.enemyHealth.gotoAndStop(100);
_root.inc++;
_local2._y = -100;
if (pos == undefined) {
if (firstsecond == 3) {
_local2._path = 3;
firstsecond = 1;
} else if (firstsecond == 2) {
_local2._path = 2;
firstsecond = 3;
if (game.ID == 4) {
_local2._path = 3;
firstsecond = 1;
}
} else {
_local2._path = 1;
firstsecond = 2;
}
} else {
_local2._path = pos;
}
_local2.health = _health;
_local2._maxHealth = _local2.health;
_local2.level = Level;
_local2.gotoAndStop(_Level);
if (_start == undefined) {
_local2.t = 0;
} else {
_local2.t = _start;
}
_local2.dt = 0.075;
if (Math.floor((_local2._currentframe - 1) / 4) == 4) {
_local2.dt = 0.15;
}
if (Math.floor((_local2._currentframe - 1) / 4) == 3) {
_local2.dt = 0.0375;
}
_local2.dt = enemyProperty[_local2._currentframe][__ESPEED];
_local2.tMod = 1;
_local2.tModDelay = 0;
_local2.tPoi = 1;
_local2.tPoiDelay = 0;
_local2._xscale = 50;
_local2._yscale = 50;
}
function orderByName(a, b) {
var _local2 = a._name;
var _local1 = b._name;
if (_local2 < _local1) {
return(-1);
}
if (_local2 > _local1) {
return(1);
}
return(0);
}
function main() {
if ((timeOut != undefined) and firstNext) {
if ((timeOut--) < 0) {
_root.gotoAndStop("GameOver");
_root.uninit();
}
}
if (_root.DialogEnemy.title.text != enemyProperty[levelProperty[(Level + 1) % 10][0]][0]) {
_root.DialogEnemy.title.text = enemyProperty[levelProperty[(Level + 1) % 10][0]][0];
var _local5 = "";
_local5 = _local5 + (("Health: " + generateHealth(Level + 1)) + newline);
_local5 = _local5 + (("Speed: " + enemyProperty[levelProperty[(Level + 1) % 10][0]][2]) + newline);
if (enemyProperty[levelProperty[(Level + 1) % 10][0]][3] == 1) {
_local5 = _local5 + "Ground Units\n";
} else {
_local5 = _local5 + "Air Units\n";
}
if (enemyProperty[levelProperty[(Level + 1) % 10][0]][5] == 1) {
_local5 = _local5 + "Immune\n";
}
_root.DialogEnemy.content.text = _local5;
_root.DialogEnemy.pic.gotoAndStop(levelProperty[(Level + 1) % 10][0]);
_root.DialogEnemy.pic.enemy.stop();
_root.DialogEnemy.BtnSell.SellText.text = "Next";
}
_root.enemyText.text = enemyProperty[levelProperty[(Level + 1) % 10][0]][0];
if (Key.isDown(80)) {
enemyStack.push(2);
enemyStackHealth.push(2);
}
if ((((!isCheat) and Key.isDown(81)) and Key.isDown(87)) and Key.isDown(69)) {
_root.Money = _root.Money + 1000;
isCheat = true;
} else if (((!Key.isDown(81)) and (!Key.isDown(87))) and (!Key.isDown(69))) {
isCheat = false;
}
if (NavigationBar.BtnPause._currentframe <= 2) {
var _local2 = [];
enemyCount = 0;
var _local3 = 2;
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 5) == "tower") {
if ((!_root.selectedTower.isDragging) and (!_root.selectedTower.area._visible)) {
_local2.push(mc);
}
}
}
_local2.sort(orderByName);
i = 0;
while (i < _local2.length) {
_local2[i].swapDepths(_local3++);
i++;
}
_local2 = [];
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
moveEnemy(mc);
enemyCount++;
}
if ((!_root.selectedTower.isDragging) and (!_root.selectedTower.area._visible)) {
if (mc._name.substr(0, 7) == "enemies") {
_local2.push(mc);
}
}
}
_local2.sort(orderByName);
i = 0;
while (i < _local2.length) {
_local2[i].swapDepths(_local3++);
i++;
}
if (game._loop and (enemyCount >= game._limitLoop)) {
_root.Health = 0;
}
if (firstStop == undefined) {
firstStop = true;
}
if (((true and (enemyCount <= 0)) and (enemyStack.length <= 0)) and (prepareLevel <= 0)) {
if (firstStop) {
firstStop = false;
for (i in _root.container) {
mc = _root.container[i];
if (((mc._name.substr(0, 6) == "towers") and (mc._currentframe > 33)) and (mc._currentframe < 39)) {
delete mc.onEnterFrame;
delete mc.onRelease;
mc.removeMovieClip();
}
}
}
} else {
firstStop = true;
}
if (((enemyCount <= 0) and (enemyStack.length <= 0)) and (Level >= maxLevel)) {
_root.gotoAndStop("GameEnd");
}
if (choosenMode != 1) {
if ((enemyCount <= 0) and (enemyStack.length <= 0)) {
NavigationBar.BtnSkip._visible = true;
} else {
NavigationBar.BtnSkip._visible = false;
}
}
if (game._loop and firstNext) {
var _local6 = Math.floor(prepareLevel / 30);
if (_local6 < 0) {
_local6 = "-";
}
DisplayNextWave.nextWave.text = "Next: " + _local6;
if ((prepareLevel < 1) and (enemyStack.length <= 0)) {
if (Level > 50) {
prepareLevel = 600;
} else {
prepareLevel = 750;
}
NavigationBar.BtnSkip._visible = true;
}
if ((prepareLevel--) == 1) {
Level++;
if (Level >= maxLevel) {
_root.gotoAndStop("GameEnd");
}
i = 1;
while (i <= 20) {
enemyStack.push(levelProperty[Level % 10][0]);
enemyStackHealth.push(generateHealth(Level));
i++;
}
_root.Money = _root.Money + ((Math.floor(Level / 6) + 1) * 10);
}
}
enemyStackDelay--;
if ((firstNext and (enemyStack.length > 0)) and (enemyStackDelay <= 0)) {
if (choosenMode == 1) {
enemyStackDelay = 72;
} else {
enemyStackDelay = 36;
}
createEnemy(enemyStack.shift(), 0, enemyStackHealth.shift());
}
qwe = false;
i = 2;
while (i <= 5) {
if ((_root.selectedTower._currentframe + 1) == i) {
} else {
if (i <= _root.selectedTower._currentframe) {
if (_root.NavigationBar.upgrade["Lv" + i]._currentframe != 3) {
_root.NavigationBar.upgrade["Lv" + i].gotoAndStop(3);
}
} else if (_root.NavigationBar.upgrade["Lv" + i]._currentframe != 1) {
_root.NavigationBar.upgrade["Lv" + i].gotoAndStop(1);
}
if (((_root.selectedTower._price * _root.TowerPriceUpgrade[_root.selectedTower._currentframe]) <= _root.Money) and (_root.NavigationBar.upgrade["Lv" + int(_root.selectedTower._currentframe + 1)]._currentframe != 2)) {
_root.NavigationBar.upgrade["Lv" + int(_root.selectedTower._currentframe + 1)].gotoAndStop(2);
}
if (_root.NavigationBar.upgrade["Lv" + int(_root.selectedTower._currentframe + 1)]._currentframe == 2) {
qwe = true;
}
}
i++;
}
if ((qwe and (!_root.tutup._visible)) and (!_root.selectedTower.isDragging)) {
_root.NavigationBar.upgrade.upgradeEffect._visible = true;
_root.NavigationBar.upgrade.upgradeEffect.upgradeEffect1.text = _root.selectedTower._price * _root.TowerPriceUpgrade[_root.selectedTower._currentframe];
_root.NavigationBar.upgrade.upgradeEffect.upgradeEffect2.text = Math.floor((_root.selectedTower._width * _root.TowerAreaUpgrade[_root.selectedTower._currentframe]) / 100);
_root.NavigationBar.upgrade.upgradeEffect.upgradeEffect3.text = _root.selectedTower._TowerDelay * _root.TowerDelayUpgrade[_root.selectedTower._currentframe];
_root.NavigationBar.upgrade.upgradeEffect.upgradeEffect4.text = _root.selectedTower._TowerDamage * _root.TowerDamageUpgrade[_root.selectedTower._currentframe];
} else {
_root.NavigationBar.upgrade.upgradeEffect._visible = false;
}
if (Key.isDown(78)) {
_root.firstNext = true;
var _local4 = 0;
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
_local4++;
}
}
if (_root.game._loop) {
_local4 = 1;
}
if (((_root.Level < _root.maxLevel) and (_root.enemyStack.length < 1)) and (_local4 < 1)) {
_root.Level++;
for (i in _root.container) {
mc = _root.container[i];
if (((mc._name.substr(0, 6) == "towers") and (mc._currentframe > 33)) and (mc._currentframe < 39)) {
delete mc.onEnterFrame;
delete mc.onRelease;
mc.removeMovieClip();
}
}
i = 1;
while (i <= 20) {
_root.enemyStack.push(_root.levelProperty[_root.Level % 10][0]);
_root.enemyStackHealth.push(_root.generateHealth(_root.Level));
i++;
}
_root.Money = _root.Money + ((Math.floor(_root.Level / 6) + 1) * 10);
}
}
}
i = 1;
while (i <= 38) {
if (i == 6) {
i = 32;
}
if (_root.TowerProperty[i][__PRICE] <= _root.Money) {
if ((((i < 32) or (i > 33)) or ((i == 32) and _root.rangeUnlocked)) or ((i == 33) and _root.meleeUnlocked)) {
NavigationBar["btn" + i]._visible = false;
}
} else {
NavigationBar["btn" + i]._visible = true;
}
i++;
}
var _local8 = "Enemy: " + enemyCount;
if (timeOut != undefined) {
var _local7 = "Time: " + int(timeOut / 30);
} else if (Level < 0) {
var _local7 = "Level: -";
} else {
var _local7 = "Level: " + Level;
}
_root.Timer.text = _local7;
_root.EnemyCount.text = _local8;
_root.Detail.text = (((("Health: " + _root.Health) + " ") + _local7) + " ") + _local8;
_root.NavigationBar.Money.text = Money;
_root.NavigationBar.Score.text = game.score;
_root.NavigationBar.Kill.text = game.kill;
_root.HealthBar.Bar._xscale = _root.Health;
if (_root.HealthBar.Bar._xscale < 0) {
_root.HealthBar.Bar._xscale = 0;
}
if (_root.Health <= 0) {
_root.gotoAndStop("GameOver");
_root.uninit();
}
}
function addtower(mode) {
_root.DialogGun._visible = true;
_root.DialogGun.BtnSell._visible = false;
_root.DialogGun.title.text = TowerProperty[mode][__NAME];
var _local6 = (("Damage: " + _root.TowerProperty[mode][__DAMAGE]) + "\nDelay: ") + _root.TowerProperty[mode][__DELAY];
if (_root.TowerProperty[mode][__SPLASH] == 1) {
_local6 = _local6 + "\nSplash";
} else if (_root.TowerProperty[mode][__SPLASH] == 2) {
_local6 = _local6 + "\nLine Attack";
} else if (_root.TowerProperty[mode][__SPLASH] == 3) {
_local6 = _local6 + "\nAttack surrounding";
}
if (_root.TowerProperty[mode][__GNDAIR] == 1) {
_local6 = _local6 + "\nGround units Only";
} else if (_root.TowerProperty[mode][__GNDAIR] == 3) {
_local6 = _local6 + "\nAir and Ground";
}
if ((mode >= 20) and (mode <= 22)) {
_local6 = _local6 + (("\nSteal " + (15 * (mode - 19))) + "%");
}
_root.DialogGun.content.text = _local6;
_root.DialogGun.gun.gotoAndStop(mode);
for (var i in _root.UpgradePanel) {
_root.UpgradePanel[i].removeMovieClip();
}
var _local13 = _root.UpgradePanel.createEmptyMovieClip("upgradeTowerTitle", 0);
var _local10 = _local13.createTextField("newText", 1, 0, 0, 300, 20);
_local10.text = TowerProperty[mode][__NAME];
var _local12 = new TextFormat();
_local12.font = "VerdanaLocal";
_local10.setTextFormat(_local12);
_local10.embedFonts = true;
var allow = true;
getMaxTower();
if ((mode == 32) and (!_root.rangeUnlocked)) {
allow = false;
}
if ((mode == 33) and (!_root.meleeUnlocked)) {
allow = false;
}
if ((_root.TowerProperty[mode][__PRICE] <= _root.Money) and allow) {
if (_root.selectedTower.isDragging) {
delete _root.selectedTower.onEnterFrame;
delete _root.selectedTower.onRelease;
_root.selectedTower.removeMovieClip();
}
for (var i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 6) == "towers") {
mc.area._visible = false;
}
}
setTutup(true);
_root.NavigationBar.TitleTower.gotoAndStop(mode);
_root.NavigationBar.upgrade._visible = false;
_root.NavigationBar.upgrade.upgradeEffect._visible = false;
var _local3 = container.attachMovie("TowerType", "towers" + _root.inc, container.getNextHighestDepth());
_root.inc++;
_local3._price = _root.TowerProperty[mode][__PRICE];
_local3.isDragging = true;
_local3._x = _root._xmouse;
_local3._y = _root._ymouse;
_local3.gotoAndStop(mode);
_local3._updateDelay = 30;
if (mode == 37) {
_local3._charges = 10;
}
_local3._TowerDamage = _root.TowerProperty[mode][__DAMAGE];
_local3._TowerDelay = _root.TowerProperty[mode][__DELAY];
_local3.turret._xscale = __towerSize;
_local3.turret._yscale = __towerSize;
_local3.area._xscale = _root.TowerProperty[mode][__AREA];
_local3.area._yscale = _root.TowerProperty[mode][__AREA];
_local3.Effect._xscale = (_local3.Effect._yscale = _root.TowerProperty[mode][__AREA]);
_local3.speed = _root.TowerProperty[mode][__SPEED];
Nav(_local3);
_root.selectedTower = _local3;
_local3.onRelease = function () {
_root.DialogGun._visible = false;
if (this.isDragging and (this._alpha == 100)) {
stopDrag();
this.area._visible = false;
this.isDragging = false;
setTutup(true);
_root.Money = _root.Money - _root.TowerProperty[mode][__PRICE];
if ((game._loop and (this._currentframe > 33)) and (this._currentframe < 39)) {
this._remainingTime = 1800;
}
} else if (this.isDragging and (this._alpha != 100)) {
delete this.onEnterFrame;
delete this.onRelease;
this.removeMovieClip();
this.isDragging = false;
setTutup(true);
} else if ((!this.isDragging) and (!this.area._visible)) {
for (var _local3 in _root.container) {
mc = _root.container[_local3];
if (mc._name.substr(0, 6) == "towers") {
mc.area._visible = false;
}
}
this.swapDepths(1);
this.area._visible = true;
_root.NavigationBar.TitleTower.gotoAndStop(this._currentframe);
_root.NavigationBar.upgrade._visible = true;
_root.NavigationBar.upgrade.upgradeEffect._visible = false;
_root.selectedTower = this;
_root.updateUpgradePanel(this._currentframe);
setTutup(false);
var _local3 = 2;
while (_local3 <= 5) {
if (_local3 <= _root.selectedTower._currentframe) {
_root.NavigationBar.upgrade["Lv" + _local3].gotoAndStop(3);
} else {
_root.NavigationBar.upgrade["Lv" + _local3].gotoAndStop(1);
}
if ((this._price * _root.TowerPriceUpgrade[_root.selectedTower._currentframe]) < _root.Money) {
_root.NavigationBar.upgrade["Lv" + int(_root.selectedTower._currentframe + 1)].gotoAndStop(2);
}
_local3++;
}
Nav(this);
} else if (!this.isDragging) {
this.area._visible = false;
setTutup(true);
_root.NavigationBar.upgrade.upgradeEffect._visible = false;
}
};
_local3.onEnterFrame = function () {
if (this.isDragging) {
this._x = Math.floor((_xmouse + (skipScale / 2)) / skipScale) * skipScale;
this._y = Math.floor((_ymouse + (skipScale / 2)) / skipScale) * skipScale;
hit = false;
sudut = 0;
while (sudut <= 360) {
dx = Math.sin((sudut * Math.PI) / 180);
if (isNaN(dx)) {
dx = 1;
}
dy = Math.cos((sudut * Math.PI) / 180);
if (isNaN(dy)) {
dy = 1;
}
_xx = this._x - (((10 * __towerSize) / 100) * dx);
_yy = this._y - (((10 * __towerSize) / 100) * dx);
if (this._currentframe > 33) {
if (!_root.roadTrap.hitTest(_xx, _yy, true)) {
hit = true;
break;
}
} else if (_root.road.hitTest(_xx, _yy, true)) {
hit = true;
break;
}
sudut = sudut + 45;
}
if (!hit) {
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 6) == "towers") {
if (mc == this) {
continue;
}
var dx = (mc._x - this._x);
var dy = (mc._y - this._y);
var _local4 = Math.sqrt((dx * dx) + (dy * dy));
if (_local4 < ((32 * __towerSize) / 100)) {
hit = true;
break;
}
}
}
}
if ((((this._y < 48) or (this._y > 422)) or (this._x < 18)) or (this._x > 380)) {
hit = true;
}
if (hit) {
this._alpha = 50;
} else {
this._alpha = 100;
}
} else if (NavigationBar.BtnPause._currentframe <= 2) {
if (TowerProperty[this._currentframe][__SPLASH] == 3) {
this._delay--;
if (this._delay <= 0) {
this._delay = this._TowerDelay;
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
if (this.area.hitTest(mc._x, mc._y, true)) {
if (choosenMode != 1) {
mc.health = mc.health - this._TowerDamage;
}
if (this.Effect._currentframe == 1) {
this.Effect.gotoAndPlay(2);
}
soundShot(this._currentframe);
hitEnemy(mc._x, mc._y, mc.health);
if (timeOut != undefined) {
game.score = game.score + this._TowerDamage;
}
}
}
}
soundShot(0);
}
} else if (((this.ttarget._x == undefined) or (this.ttarget._y == undefined)) or (!this.area.hitTest(this.ttarget._x, this.ttarget._y, true))) {
this._delay--;
if (this._delay <= 0) {
this._delay = this._TowerDelay;
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
if (this.area.hitTest(mc._x, mc._y, true)) {
allow = true;
if ((TowerProperty[this._currentframe][__GNDAIR] != enemyProperty[mc._currentframe][__EGNDAIR]) and (TowerProperty[this._currentframe][__GNDAIR] != 3)) {
allow = false;
}
if (allow) {
this.ttarget = mc;
this._delay = 0;
}
}
}
}
}
} else {
this._delay--;
if (this._delay <= 0) {
var dx = (this.ttarget._x - this._x);
var dy = (this.ttarget._y - this._y);
var distance = Math.sqrt((dx * dx) + (dy * dy));
var angle = Math.acos(dy / distance);
if (dx < 0) {
var _local6 = (180 + ((angle * 180) / Math.PI)) + 0;
} else {
var _local6 = 180 - ((angle * 180) / Math.PI);
}
var _local5 = ((this.turret._rotation < 0) ? (360 - Math.abs(this.turret._rotation)) : (this.turret._rotation));
angle = _local6 - _local5;
var _local7 = false;
if (_local5 != _local6) {
if (angle > 0) {
angle = ((angle > 180) ? (((_local5 + 360) - _local6) * -1) : angle);
} else {
angle = ((angle < -180) ? ((_local6 + 360) - _local5) : angle);
}
if (angle < -10) {
angle = -10;
} else if (angle > 10) {
angle = 10;
} else {
_local7 = true;
}
if (!((this._currentframe >= 34) and (this._currentframe <= 38))) {
this.turret._rotation = this.turret._rotation + angle;
this.Melee._rotation = this.turret._rotation;
this.Magic._rotation = this.turret._rotation;
} else {
_local7 = true;
}
}
if (_local7) {
soundShot(this._currentframe);
this._delay = this._TowerDelay;
var _local3 = container.attachMovie("bullet", "bullet" + _root.inc, container.getNextHighestDepth());
_root.inc++;
_local3.swapDepths(0);
if ((this._currentframe == 5) or ((this._currentframe >= 26) and (this._currentframe <= 31))) {
_local3.gotoAndStop(8);
} else if ((this._currentframe >= 17) and (this._currentframe <= 19)) {
_local3.gotoAndStop(9);
} else {
_local3.gotoAndStop(7);
}
if ((this._currentframe >= 20) and (this._currentframe <= 22)) {
_local3._visible = false;
}
if ((TowerProperty[this._currentframe][__GNDAIR] == 1) and (this.Melee._currentframe == 1)) {
this.Melee.gotoAndPlay(2);
}
if (((this._currentframe == 5) or ((this._currentframe >= 29) and (this._currentframe <= 31))) and (this.Magic._currentframe == 1)) {
this.Magic.gotoAndPlay(2);
}
_local3.ttarget = this.ttarget;
_local3.tturret = this;
_local3._xscale = 30;
_local3._yscale = 30;
dx = this.ttarget._x - this._x;
dy = this.ttarget._y - this._y;
distance = Math.sqrt((dx * dx) + (dy * dy));
angle = Math.acos(dy / distance);
if (dx < 0) {
_local3.sudut = ((angle * 180) / Math.PI) + 0;
} else {
_local3.sudut = ((-angle) * 180) / Math.PI;
}
_local3._rotation = _local3.sudut;
_local3._x = this._x;
_local3._y = this._y;
_local3.speed = this.speed;
_local3.power = this._TowerDamage;
_local3._delaySplashPierce = 0;
_local3.onEnterFrame = function () {
if (TowerProperty[this.tturret._currentframe][__SPLASH] != 2) {
if (this.ttarget.health <= 0) {
} else {
dx = this.ttarget._x - this._x;
dy = this.ttarget._y - this._y;
distance = Math.sqrt((dx * dx) + (dy * dy));
angle = Math.acos(dy / distance);
if (dx < 0) {
this.sudut = ((angle * 180) / Math.PI) + 0;
} else {
this.sudut = ((-angle) * 180) / Math.PI;
}
}
}
dx = Math.sin((this.sudut * Math.PI) / 180);
if (isNaN(dx)) {
dx = 1;
}
dy = Math.cos((this.sudut * Math.PI) / 180);
if (isNaN(dy)) {
dy = 1;
}
this._x = this._x - (this.speed * dx);
this._y = this._y + (this.speed * dy);
if ((this_x < 0) or (this._x > 640)) {
delete this.onEnterFrame;
delete this.onRelease;
this.removeMovieClip();
}
if ((this_y < 0) or (this._y > 440)) {
delete this.onEnterFrame;
delete this.onRelease;
this.removeMovieClip();
}
if (!this.tturret.hitTest(this)) {
delete this.onEnterFrame;
delete this.onRelease;
this.removeMovieClip();
}
if (TowerProperty[this.tturret._currentframe][__SPLASH] == 2) {
if ((this._delaySplashPierce--) <= -3) {
this._delaySplashPierce = 0;
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
if (mc.hitTest(this)) {
if (choosenMode != 1) {
mc.health = mc.health - this.power;
}
hitEnemy(mc._x, mc._y, mc.health);
if (timeOut != undefined) {
game.score = game.score + this.power;
}
var _local3 = container.attachMovie("AnimatedBlood", "AnimatedBlood" + (count++), container.getNextHighestDepth());
_local3._x = mc._x;
_local3._y = mc._y;
}
}
}
}
} else if (this.ttarget.hitTest(this)) {
if (choosenMode != 1) {
if ((this.tturret._currentframe >= 20) and (this.tturret._currentframe <= 22)) {
if (Math.random() < (0.15 * (this.tturret._currentframe - 19))) {
_root.Money = _root.Money + ((1 * (this.tturret._currentframe - 19)) * 5);
var _local3 = container.attachMovie("StealMoney", "StealMoney" + (count++), container.getNextHighestDepth());
_local3._x = this.ttarget._x;
_local3._y = this.ttarget._y;
}
}
}
if (this.ttarget._currentframe <= 4) {
qwe = this.ttarget._currentframe;
} else {
qwe = Math.floor((this.ttarget._currentframe - 1) / 4) + 4;
}
if (choosenMode != 1) {
this.ttarget.health = this.ttarget.health - (this.power * TowerEffective[this.tturret._currentframe][qwe]);
}
hitEnemy(this.ttarget._x, this.ttarget._y, this.ttarget.health);
if (timeOut != undefined) {
game.score = game.score + (this.power * TowerEffective[this.tturret._currentframe][qwe]);
}
if ((enemyProperty[this.ttarget._currentframe][__ENOFREEZE] == 0) and (TowerProperty[this.tturret._currentframe][__FREEZE] > 0)) {
this.ttarget.tModDelay = TowerProperty[this.tturret._currentframe][__FREEZE];
this.ttarget.tMod = 0.5;
}
if (TowerProperty[this.tturret._currentframe][__SPLASH] > 0) {
var splash = container.attachMovie("Splash", "Splash" + _root.inc, container.getNextHighestDepth());
_root.inc++;
splash._visible = false;
splash._x = this.ttarget._x;
splash._y = this.ttarget._y;
splash._xscale = this.tturret._currentframe * 20;
splash._yscale = this.tturret._currentframe * 20;
if (this.tturret._currentframe == 3) {
splash.gotoAndStop(1);
}
if (this.tturret._currentframe == 4) {
splash.gotoAndStop(2);
}
if (this.tturret._currentframe == 5) {
splash.gotoAndStop(3);
}
if (this.tturret._currentframe == 6) {
splash.gotoAndStop(4);
}
splash.tturret = this.tturret;
splash.power = Math.floor(this.power / 2);
if ((this.tturret._currentframe >= 29) and (this.tturret._currentframe <= 31)) {
splash._visible = true;
splash.power = Math.floor(this.power);
splash.gotoAndStop(4);
splash._xscale = 100;
splash._yscale = 100;
}
splash.onEnterFrame = function () {
if (this._currentframe == 4) {
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
if (mc.hitTest(this)) {
allow = true;
if (int(mc._inked._name.substr(6, 99)) < int(this._name.substr(6, 99))) {
allow = true;
mc._inked = this;
} else {
allow = false;
}
if ((TowerProperty[this.tturret._currentframe][__GNDAIR] != enemyProperty[mc._currentframe][__EGNDAIR]) and (TowerProperty[this.tturret._currentframe][__GNDAIR] != 3)) {
allow = false;
}
if (allow) {
if (choosenMode != 1) {
mc.health = mc.health - this.power;
}
if (timeOut != undefined) {
game.score = game.score + this.power;
}
}
}
}
}
} else if (this.splash._currentframe == 3) {
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
if (mc.hitTest(this)) {
allow = true;
if ((TowerProperty[this.tturret._currentframe][__GNDAIR] != enemyProperty[mc._currentframe][__EGNDAIR]) and (TowerProperty[this.tturret._currentframe][__GNDAIR] != 3)) {
allow = false;
}
if (allow) {
if (choosenMode != 1) {
mc.health = mc.health - this.power;
}
if (timeOut != undefined) {
game.score = game.score + this.power;
}
}
if ((enemyProperty[mc._currentframe][__ENOFREEZE] == 0) and (TowerProperty[this.tturret._currentframe][__FREEZE] > 0)) {
mc.tModDelay = TowerProperty[this.tturret._currentframe][__FREEZE];
mc.tMod = 0.5;
}
}
}
}
}
};
}
delete this.onEnterFrame;
delete this.onRelease;
this.removeMovieClip();
}
};
if (this._charges != undefined) {
if ((this._charges--) <= 0) {
delete this.onEnterFrame;
delete this.onRelease;
this.removeMovieClip();
}
}
}
}
}
if ((this._remainingTime != undefined) and firstNext) {
if ((this._remainingTime--) <= 0) {
this.removeMovieClip();
}
}
}
};
}
}
function Nav(tower) {
if (tower.isDragging) {
_root.NavigationBar.upgradeEffect1.text = _root.TowerProperty[tower._currentframe][__PRICE];
} else {
_root.NavigationBar.upgradeEffect1.text = _root.TowerProperty[tower._currentframe][__PRICE];
}
_root.NavigationBar.upgradeEffect2.text = Math.floor(tower._width);
_root.NavigationBar.upgradeEffect3.text = tower._TowerDelay;
_root.NavigationBar.upgradeEffect4.text = tower._TowerDamage;
_root.NavigationBar.upgradeEffect5.text = "";
if (tower._currentframe == 2) {
_root.NavigationBar.upgradeEffect5.text = "Poison";
}
if (tower._currentframe == 3) {
_root.NavigationBar.upgradeEffect5.text = "Air Only";
}
if (tower._currentframe == 4) {
_root.NavigationBar.upgradeEffect5.text = "Freeze";
}
if (tower._currentframe == 5) {
_root.NavigationBar.upgradeEffect5.text = "Splash";
}
_root.NavigationBar.upgrade.SellPrice.text = Math.floor(tower._price / 2);
_root.NavigationBar.SellPrice.text = Math.floor(tower._price / 2);
}
function updateUpgradePanel(ID) {
for (var _local6 in _root.UpgradePanel) {
_root.UpgradePanel[_local6].removeMovieClip();
}
var _local3 = _root.UpgradePanel.attachMovie("DialogUpgrade", "DialogUpgrade", 0);
_local3.title.text = TowerProperty[ID][__NAME];
_local3.ID = ID;
var _local5 = (("Damage: " + _root.TowerProperty[_local3.ID][__DAMAGE]) + "\nDelay: ") + _root.TowerProperty[_local3.ID][__DELAY];
if (_root.TowerProperty[_local3.ID][__SPLASH] == 1) {
_local5 = _local5 + "\nSplash";
} else if (_root.TowerProperty[_local3.ID][__SPLASH] == 2) {
_local5 = _local5 + "\nLine Attack";
} else if (_root.TowerProperty[_local3.ID][__SPLASH] == 3) {
_local5 = _local5 + "\nAttack surrounding";
}
if (_root.TowerProperty[_local3.ID][__GNDAIR] == 1) {
_local5 = _local5 + "\nGround units Only";
} else if (_root.TowerProperty[_local3.ID][__GNDAIR] == 3) {
_local5 = _local5 + "\nAir and Ground";
}
if ((_local3.ID >= 20) and (_local3.ID <= 22)) {
_local5 = _local5 + (("\nSteal " + (15 * (_local3.ID - 19))) + "%");
}
_local3.content.text = _local5;
_local3.gun.gotoAndStop(_local3.ID);
_local3.temp.onRelease = function () {
};
if (!((_root.selectedTower._currentframe >= 34) and (_root.selectedTower._currentframe <= 38))) {
_local3.BtnSell.SellText.text = ("Sell(" + Math.floor(_root.selectedTower._price / 2)) + ")";
_local3.BtnSell.onRelease = function () {
if (((_root.selectedTower._currentframe < 34) or (_root.selectedTower._currentframe > 38)) and (!_root.tutup._visible)) {
var _local3 = _root.attachMovie("PanelRUSureSell", "PanelRUSureSell", 1);
_local3._x = Stage.width / 2;
_local3._y = Stage.height / 2;
_local3.sellPrice = Math.floor(_root.selectedTower._price / 2);
_local3.sellTower = _root.selectedTower;
_local3.BtnYes.onRelease = function () {
_root.Money = _root.Money + this._parent.sellPrice;
this._parent.sellTower.removeMovieClip();
_root.setTutup(true);
this._parent.removeMovieClip();
};
_local3.BtnNo.onRelease = function () {
this._parent.removeMovieClip();
};
}
};
_local3.BtnSell.onRollOver = function () {
this.gotoAndStop(2);
};
_local3.BtnSell.onRollOut = function () {
this.gotoAndStop(1);
};
} else {
_local3.BtnSell._visible = false;
}
var _local6 = 0;
while (_local6 < TowerUpgradesType[ID].length) {
_local3 = _root.UpgradePanel.attachMovie("DialogUpgrade", "DialogUpgrade" + _local6, _local6 + 1);
_local3.ID = TowerUpgradesType[ID][_local6] + 1;
_local3.title.text = ((TowerProperty[_local3.ID][__NAME] + " (") + TowerProperty[_local3.ID][__PRICE]) + ")";
_local5 = (("Damage: " + _root.TowerProperty[_local3.ID][__DAMAGE]) + "\nDelay: ") + _root.TowerProperty[_local3.ID][__DELAY];
if (_root.TowerProperty[_local3.ID][__SPLASH] == 1) {
_local5 = _local5 + "\nSplash";
} else if (_root.TowerProperty[_local3.ID][__SPLASH] == 2) {
_local5 = _local5 + "\nLine Attack";
} else if (_root.TowerProperty[_local3.ID][__SPLASH] == 3) {
_local5 = _local5 + "\nAttack surrounding";
}
if (_root.TowerProperty[_local3.ID][__GNDAIR] == 1) {
_local5 = _local5 + "\nGround units Only";
} else if (_root.TowerProperty[_local3.ID][__GNDAIR] == 3) {
_local5 = _local5 + "\nAir and Ground";
}
if ((_local3.ID >= 20) and (_local3.ID <= 22)) {
_local5 = _local5 + (("\nSteal " + (15 * (_local3.ID - 19))) + "%");
}
_local3.content.text = _local5;
_local3.gun.gotoAndStop(_local3.ID);
_local3._y = (_local6 + 1) * _local3._height;
_local3.BtnSell.SellText.text = "Upgrade";
_local3.BtnSell.onRollOver = function () {
this.gotoAndStop(2);
};
_local3.BtnSell.onRollOut = function () {
this.gotoAndStop(1);
};
_local3.temp.onRelease = function () {
};
_local3.BtnSell.ID = _local3.ID;
_local3.BtnSell.onRelease = function () {
if (!_root.tutup._visible) {
if ((_root.Money >= _root.TowerProperty[this.ID][__PRICE]) and (typeof(_root.selectedTower.upgradeBar) != "movieclip")) {
_root.Money = _root.Money - _root.TowerProperty[this.ID][__PRICE];
var _local3 = _root.selectedTower.attachMovie("upgradeBar", "upgradeBar", 1);
if (firstNext) {
_local3._delay = (_local3._maxDelay = _root.selectedTower._updateDelay);
} else {
_local3._delay = (_local3._maxDelay = 0);
}
_root.selectedTower._updateDelay = _root.selectedTower._updateDelay * 3;
_local3.ID = this.ID;
_local3._parent._delay = 3;
_local3.onEnterFrame = function () {
this._parent._delay = 3;
this.gotoAndStop(101 - int((100 * this._delay) / this._maxDelay));
if ((this._delay--) <= 0) {
this._parent.gotoAndStop(this.ID);
this._parent.turret._xscale = (this._parent.turret._yscale = __towerSize);
_root.Nav(this._parent);
this.removeMovieClip();
}
};
_root.selectedTower._TowerDamage = _root.TowerProperty[this.ID][__DAMAGE];
_root.selectedTower._TowerDelay = _root.TowerProperty[this.ID][__DELAY];
_root.selectedTower.area._xscale = _root.TowerProperty[this.ID][__AREA];
_root.selectedTower.area._yscale = _root.TowerProperty[this.ID][__AREA];
_root.selectedTower.speed = _root.TowerProperty[this.ID][__SPEED];
_root.selectedTower._price = _root.selectedTower._price + _root.TowerProperty[this.ID][__PRICE];
updateUpgradePanel(this.ID);
}
}
};
_local3._alpha = 30;
_local3.onEnterFrame = function () {
if (_root.Money >= _root.TowerProperty[this.ID][__PRICE]) {
this._alpha = 100;
} else {
this._alpha = 30;
}
};
_local6++;
}
}
function getMaxTower() {
var _local3 = false;
var _local2 = false;
var _local10 = false;
var _local9 = false;
var _local8 = false;
var _local7 = false;
var _local6 = false;
var _local5 = false;
var _local4 = false;
var _local12 = false;
var _local11 = false;
for (i in _root.container) {
mc = _root.container[i];
if ((mc._name.substr(0, 6) == "towers") and true) {
if (mc._currentframe == 8) {
_local3 = true;
}
if (mc._currentframe == 11) {
_local2 = true;
}
if (mc._currentframe == 13) {
_local10 = true;
}
if (mc._currentframe == 16) {
_local9 = true;
}
if (mc._currentframe == 19) {
_local8 = true;
}
if (mc._currentframe == 22) {
_local7 = true;
}
if (mc._currentframe == 25) {
_local6 = true;
}
if (mc._currentframe == 28) {
_local5 = true;
}
if (mc._currentframe == 31) {
_local4 = true;
}
}
}
if ((((((((_local3 and _local2) and _local10) and _local9) and _local8) and _local7) and _local6) and _local5) and _local4) {
_root.meleeUnlocked = true;
_root.rangeUnlocked = true;
return(3);
}
if (((_local7 and _local6) and _local5) and _local4) {
_root.meleeUnlocked = true;
return(2);
}
if ((((_local3 and _local2) and _local10) and _local9) and _local8) {
_root.rangeUnlocked = true;
return(1);
}
return(0);
}
function generateHealth(i) {
var _local2 = 0.7;
return(int(((((i + 1) * (i + 1)) * 10) * _local2) * enemyProperty[levelProperty[i % 10][0]][__EHEALTH]));
}
function calcMoney(i) {
var _local1 = Math.floor((i / 5) + 1) * 5;
return(_local1);
}
function setTutup(_set) {
_root.tutup._visible = _set;
_root.UpgradePanel._visible = !_set;
}
function setEnemyDialog(_set) {
_root.DialogEnemy._visible = _set;
if (true and _root.tutup._visible) {
_root.tutup._visible = false;
}
if (_set) {
for (var _local3 in _root.UpgradePanel) {
_root.UpgradePanel[_local3].removeMovieClip();
}
for (var _local3 in _root.container) {
var _local2 = _root.container[_local3];
if (_local2._name.substr(0, 6) == "towers") {
_local2.area._visible = false;
}
}
}
}
function hitEnemy(x, y, _health) {
if (_health <= 0) {
var _local2 = container.attachMovie("hitWithCoin", "hitWithCoin" + _root.inc, container.getNextHighestDepth());
} else {
var _local2 = container.attachMovie("hitWithoutCoin", "hitWithoutCoin" + _root.inc, container.getNextHighestDepth());
}
_root.inc++;
_local2._x = x;
_local2._y = y;
}
function soundShot(ID) {
soundGun(ID);
}
function outTower(mode) {
if (!_root.selectedTower.isDragging) {
_root.DialogGun._visible = false;
} else {
inTower(_root.selectedTower._currentframe);
}
}
function inTower(mode) {
if (tutup._visible) {
_root.DialogGun._visible = true;
_root.DialogGun.BtnSell._visible = true;
_root.DialogGun.BtnSell.SellText.text = "Cost:" + TowerProperty[mode][__PRICE];
_root.DialogGun.title.text = TowerProperty[mode][__NAME];
var _local3 = (("Damage: " + _root.TowerProperty[mode][__DAMAGE]) + "\nDelay: ") + _root.TowerProperty[mode][__DELAY];
if (_root.TowerProperty[mode][__SPLASH] == 1) {
_local3 = _local3 + "\nSplash";
} else if (_root.TowerProperty[mode][__SPLASH] == 2) {
_local3 = _local3 + "\nLine Attack";
} else if (_root.TowerProperty[mode][__SPLASH] == 3) {
_local3 = _local3 + "\nAttack surrounding";
}
if (_root.TowerProperty[mode][__GNDAIR] == 1) {
_local3 = _local3 + "\nGround units Only";
} else if (_root.TowerProperty[mode][__GNDAIR] == 3) {
_local3 = _local3 + "\nAir and Ground";
}
if ((mode >= 20) and (mode <= 22)) {
_local3 = _local3 + (("\nSteal " + (15 * (mode - 19))) + "%");
}
_root.DialogGun.content.text = _local3;
_root.DialogGun.gun.gotoAndStop(mode);
}
}
var TowerUpgradesType = [[], [5], [8, 11], [13, 16], [19, 22], [25, 28], [6], [7], [], [10], [10], [], [12], [], [14], [15], [], [17], [18], [], [20], [21], [], [23], [24], [], [26], [27], [], [30], [], [], [38], [40], [], [], [], [], [], [39], [], [41], []];
var skipScale = 2;
var __towerSize = 70;
var __NAME = 0;
var __SPEED = 1;
var __AREA = 2;
var __DAMAGE = 3;
var __DELAY = 4;
var __GNDAIR = 5;
var __SPLASH = 6;
var __PRICE = 7;
var __FREEZE = 8;
TowerProperty = [[], ["Handgun", 10, 80, 5, 11, 3, 0, 15, 0], ["Schmidt Scout", 8, 120, 3, 9, 3, 0, 30, 0], ["Ingram Mac-10", 12, 80, 5, 6, 3, 0, 30, 0], ["Thugs", 8, 50, 3, 9, 1, 0, 100, 0], ["Monk", 8, 70, 5, 9, 3, 0, 50, 0], ["228 Compact", 10, 85, 9, 11, 3, 0, 25, 0], ["Night Hawk .50C", 10, 90, 20, 11, 3, 0, 50, 0], ["Magnum", 10, 95, 40, 11, 3, 0, 75, 0], ["Krieg 552", 8, 120, 16, 12, 3, 0, 75, 0], ["D3/AU-1", 8, 120, 50, 12, 3, 0, 150, 0], ["Krieg 550 Commando", 8, 120, 120, 12, 3, 0, 400, 0], ["Heavy Rifle", 8, 150, 60, 20, 3, 0, 200, 0], ["Magnum Sniper Rifle", 8, 180, 160, 18, 3, 0, 500, 0], ["KM Ump45", 12, 90, 8, 6, 3, 0, 50, 0], ["Clarion 5.56", 12, 90, 20, 6, 3, 0, 120, 0], ["Maverick M4A1 Carbine", 12, 90, 60, 6, 3, 0, 300, 0], ["Tactical Shotgun", 12, 75, 25, 40, 3, 1, 125, 0], ["M1897 Riot TEXAS Shotgun", 12, 75, 60, 40, 3, 1, 250, 0], ["Leone 12 Guage Super", 12, 75, 200, 40, 3, 1, 500, 0], ["Pick Pocket", 8, 60, 5, 9, 1, 0, 100, 0], ["Thieft", 8, 60, 10, 9, 1, 0, 200, 0], ["Robber", 8, 60, 20, 9, 1, 0, 300, 0], ["Knife", 8, 80, 10, 9, 1, 2, 75, 0], ["Sword", 8, 80, 30, 9, 1, 2, 180, 0], ["Qatar", 8, 80, 80, 9, 1, 2, 400, 0], ["Priest", 8, 70, 10, 40, 3, 3, 75, 0], ["Cardinal", 8, 70, 30, 40, 3, 3, 180, 0], ["Pope", 8, 70, 80, 40, 3, 3, 400, 0], ["Mage", 8, 100, 25, 80, 3, 1, 75, 0], ["Sorcerrer", 8, 100, 70, 80, 3, 1, 180, 0], ["Wizard", 8, 100, 200, 80, 3, 1, 400, 0], ["M-2 Machine Gun", 8, 120, 100, 6, 3, 0, 2500, 0], ["Bloody Chain Saw", 8, 50, 500, 10, 1, 0, 2500, 0], ["Spike Road", 8, 20, 80, 9, 1, 0, 20, 0], ["Flaming Road", 8, 20, 80, 9, 3, 0, 20, 0], ["Mud Road", 8, 20, 1, 9, 1, 1, 20, 96], ["Mine Road", 8, 20, 200, 9, 3, 0, 20, 0], ["Holy Symbol", 8, 20, 10, 9, 3, 0, 20, 48], ["M-2 Machine Gun 2", 8, 120, 250, 6, 3, 0, 5000, 0], ["M-2 Machine Gun 3", 8, 120, 600, 6, 3, 0, 10000, 0], ["Bloody Chain Saw 2", 8, 50, 1250, 10, 1, 0, 5000, 0], ["Bloody Chain Saw 3", 8, 50, 3000, 10, 1, 0, 10000, 0]];
var i = 0;
while (i < TowerProperty.length) {
TowerProperty[i][__DAMAGE] = TowerProperty[i][__DAMAGE] * 2;
i++;
}
fscommand ("allowscale", false);
fscommand ("allowscale", false);
var inc = 100;
var isDragging = false;
var game = new Object({_loop:true, _limitLoop:100, difficult:2, ID:1, score:0, kill:0});
var myObj = new Object();
Mouse.addListener(myObj);
myObj.onMouseDown = function () {
};
myObj.onMouseMove = mouseMoveHandler;
var __ENAME = 0;
var __EHEALTH = 1;
var __ESPEED = 2;
var __EGNDAIR = 3;
var __ENEXTFORM = 4;
var __ENOFREEZE = 5;
enemyProperty = [["Poring", 1, 1, 1, 0, 0], ["Zombie", 1, 0.0875, 1, 0, 0], ["Bat", 1, 0.0875, 2, 0, 0], ["Skeleton", 1, 0.0875, 1, 0, 1], ["Crow", 1, 0.0875, 2, 0, 0], ["Vampire", 0.66, 0.0875, 1, 3, 0], ["Banshee", 0.8, 0.1875, 2, 0, 0], ["Human", 0.66, 0.0875, 1, 8, 0], ["Werewolf", 1, 0.35, 1, 0, 0], ["Ghost", 1, 0.0875, 2, 0, 0], ["Mumi", 1, 0.05, 1, 2, 0], ["Cursed Man", 0.66, 0.0875, 1, 12, 0], ["Lesser Demon", 1, 0.0875, 1, 13, 0], ["Devil", 1, 0.0875, 1, 0, 0]];
var levelProperty = [[1, 10, 20], [2, 40, 20], [3, 70, 20], [4, 100, 20], [5, 150, 20], [6, 100, 20], [7, 250, 20], [9, 450, 20], [10, 500, 20], [11, 500, 20], [1, 10, 20], [2, 40, 20], [3, 70, 20], [4, 100, 20], [5, 150, 20], [6, 100, 20], [7, 250, 20], [9, 450, 20], [10, 500, 20], [11, 500, 20]];
var EnemyWaves = [1, 5, 9, 13, 17, 21, 2, 6, 10, 14, 18, 22, 3, 7, 11, 15, 19, 23, 4, 8, 12, 16, 20, 24, 4, 8, 12, 16, 20, 24];
var EnemyHealth = [3, 11, 27, 100, 50, 1000, 150, 170, 200, 300, 180, 3000, 400, 470, 500, 999, 480, 10000, 1200, 2000, 4000, 8000, 5000, 100000, 6000, 9000, 12000, 18000, 10000, 100000];
var TowerSpeed = [0, 8, 12, 12, 3, 8, 12];
var TowerArea = [0, 80, 100, 100, 70, 70, 200];
var TowerAreaUpgrade = [0, 110, 120, 120, 105, 110, 105];
var TowerDamage = [0, 5, 2, 7, 1, 7, 125];
var TowerDamageUpgrade = [0, 2, 2, 2, 2, 2, 2];
var TowerDelay = [0, 9, 7, 5, 12, 12, 48];
var TowerDelayUpgrade = [0, 0.9, 0.8, 0.9, 0.9, 0.9, 0.9];
var TowerPrice = [0, 25, 25, 25, 5, 25, 125];
var TowerFirstPrice = [0, 20, 20, 20, 50, 20, 500];
var TowerPriceUpgrade = [0, 2, 2, 2, 2, 2, 2];
var TowerFreezeDelay = [0, 48, 58, 68, 78, 88];
var TowerEffective = new Array();
var i = 0;
while (i <= 42) {
TowerEffective[i] = new Array();
var j = 0;
while (j <= 14) {
TowerEffective[i][j] = 1;
j++;
}
i++;
}
TowerEffective[26][9] = 3;
TowerEffective[27][9] = 3;
TowerEffective[28][9] = 3;
TowerEffective[29][10] = 3;
TowerEffective[30][10] = 3;
TowerEffective[31][10] = 3;
var enemyPath1;
var enemyPath2;
var enemyStack = new Array();
var enemyStackHealth = new Array();
createMap(choosenMap);
init();
stop();
Instance of Symbol 1010 MovieClip "controler" in Frame 8
onClipEvent (enterFrame) {
_root.main();
}
Instance of Symbol 1012 MovieClip in Frame 8
on (release) {
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 6) == "towers") {
mc.area._visible = false;
}
}
_root.setTutup(true);
}
Frame 9
stop();
Frame 10
fscommand ("allowscale", "false");
fscommand ("showmenu", "false");
Muzic(2);
stop();
Symbol 29 MovieClip Frame 35
stop();
Symbol 36 Button
on (release) {
getURL ("http://www.dailyfreegames.com/games/arcade-games/burger-queen.html", "_blank");
}
Symbol 37 Button
on (release) {
getURL ("http://www.dailyfreegames.com/games/action-games/mad-spaceship.html", "_blank");
}
Symbol 38 Button
on (release) {
getURL ("http://www.dailyfreegames.com/games/dress-up-games/angelina-jolie-dress-up.html", "_blank");
}
Symbol 39 Button
on (release) {
getURL ("http://www.dailyfreegames.com/games/dress-up-games/dragon-ball-dress-up.html", "_blank");
}
Symbol 40 Button
on (release) {
getURL ("http://www.dailyfreegames.com/games/adventure-games/prince-of-thomond.html", "_blank");
}
Symbol 43 Button
on (release) {
getURL ("http://dailyfreegames.com", "_blank");
}
Symbol 44 MovieClip Frame 1
stop();
MochiAd.showPreloaderAd({id:"1289a31796da8bc5", res:"640x480"});
Symbol 1274 MovieClip [__Packages.MochiAd] Frame 0
class MochiAd
{
function MochiAd () {
}
static function getVersion() {
return("1.5");
}
static function showPreloaderAd(options) {
var _local27 = {clip:_root, ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:16747008, background:16777161, outline:13994812, ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}};
options = _parseOptions(options, _local27);
var clip = options.clip;
var _local23 = 11000;
var _local26 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local14 = _getRes(options);
var _local4 = _local14[0];
var _local13 = _local14[1];
mc._x = _local4 * 0.5;
mc._y = _local13 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk._x = _local4 * -0.5;
chk._y = _local13 * -0.5;
var _local7 = chk.createEmptyMovieClip("_mochiad_bar", 4);
_local7._x = 10;
_local7._y = _local13 - 20;
var _local22 = options.color;
delete options.color;
var _local19 = options.background;
delete options.background;
var _local24 = options.outline;
delete options.outline;
var _local5 = _local7.createEmptyMovieClip("_outline", 1);
_local5.beginFill(_local19);
_local5.moveTo(0, 0);
_local5.lineTo(_local4 - 20, 0);
_local5.lineTo(_local4 - 20, 10);
_local5.lineTo(0, 10);
_local5.lineTo(0, 0);
_local5.endFill();
var _local3 = _local7.createEmptyMovieClip("_inside", 2);
_local3.beginFill(_local22);
_local3.moveTo(0, 0);
_local3.lineTo(_local4 - 20, 0);
_local3.lineTo(_local4 - 20, 10);
_local3.lineTo(0, 10);
_local3.lineTo(0, 0);
_local3.endFill();
_local3._xscale = 0;
var _local6 = _local7.createEmptyMovieClip("_outline", 3);
_local6.lineStyle(0, _local24, 100);
_local6.moveTo(0, 0);
_local6.lineTo(_local4 - 20, 0);
_local6.lineTo(_local4 - 20, 10);
_local6.lineTo(0, 10);
_local6.lineTo(0, 0);
chk.ad_msec = _local23;
chk.ad_timeout = _local26;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adLoaded = function (width, height) {
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec;
};
chk.onEnterFrame = function () {
var _local6 = this._parent._parent;
var _local12 = this._parent._mochiad_ctr;
var _local5 = getTimer() - this.started;
var _local3 = false;
var _local4 = _local6.getBytesTotal();
var _local8 = _local6.getBytesLoaded();
var _local10 = (100 * _local8) / _local4;
var _local11 = (100 * _local5) / chk.ad_msec;
var _local9 = this._mochiad_bar._inside;
var _local2 = Math.min(100, Math.min(_local10 || 0, _local11));
_local2 = Math.max(this.last_pcnt, _local2);
this.last_pcnt = _local2;
_local9._xscale = _local2;
if (!chk.showing) {
var _local7 = _local12.getBytesTotal();
if ((_local7 > 0) || (typeof(_local7) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local5 > chk.ad_timeout) {
_local3 = true;
}
}
if (_local5 > chk.ad_msec) {
_local3 = true;
}
if (((_local4 > 0) && (_local8 >= _local4)) && (_local3)) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
}
}
};
}
static function showTimedAd(options) {
var _local13 = {clip:_root, ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function () {
this.clip.stop();
}, ad_finished:function () {
this.clip.play();
}};
options = _parseOptions(options, _local13);
var clip = options.clip;
var _local10 = 11000;
var _local12 = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!load(options)) {
options.ad_finished();
return(undefined);
}
options.ad_started();
var mc = clip._mochiad;
mc.onUnload = function () {
options.ad_finished();
};
var _local5 = _getRes(options);
var _local14 = _local5[0];
var _local11 = _local5[1];
mc._x = _local14 * 0.5;
mc._y = _local11 * 0.5;
var chk = mc.createEmptyMovieClip("_mochiad_wait", 3);
chk.ad_msec = _local10;
chk.ad_timeout = _local12;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function () {
var _local2 = 100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time));
if (_local2 > 0) {
this._parent._alpha = _local2;
} else {
var _local3 = this._parent._parent;
MochiAd.unload(_local3);
delete this.onEnterFrame;
}
};
mc.lc.adjustProgress = function (msec) {
var _local2 = this.mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = msec - 250;
};
chk.onEnterFrame = function () {
var _local5 = this._parent._mochiad_ctr;
var _local4 = getTimer() - this.started;
var _local2 = false;
if (!chk.showing) {
var _local3 = _local5.getBytesTotal();
if ((_local3 > 0) || (typeof(_local3) == "undefined")) {
chk.showing = true;
chk.started = getTimer();
} else if (_local4 > chk.ad_timeout) {
_local2 = true;
}
}
if (_local4 > chk.ad_msec) {
_local2 = true;
}
if (_local2) {
if (this.server_control) {
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
}
}
};
}
static function _allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function _loadCommunicator(options) {
var _local25 = {clip:_root, com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = _parseOptions(options, _local25);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local18 = options.clip;
var _local20 = "_mochiad_com_" + options.id;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local18[_local20]) {
return(_local18[_local20].lc);
}
var _local21 = options.com_server + options.id;
_allowDomains(_local21);
delete options.id;
delete options.com_server;
var _local24 = options.depth;
delete options.depth;
var _local17 = _local18.createEmptyMovieClip(_local20, _local24);
var _local11 = _local17.createEmptyMovieClip("_mochiad_com", 1);
for (var _local15 in options) {
_local11[_local15] = options[_local15];
}
var _local6 = new LocalConnection();
var _local16 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local6.mc = _local17;
_local6.name = _local16;
_local6.allowDomain = function (d) {
return(true);
};
_local6.allowInsecureDomain = _local6.allowDomain;
_local6.connect(_local16);
_local17.lc = _local6;
_local11.lc = _local16;
_local6._id = 0;
_local6._queue = [];
_local6.rpcResult = function (cb) {
cb = parseInt(cb);
var _local4 = this._callbacks[cb];
if (!_local4) {
return(undefined);
}
delete this._callbacks[cb];
var _local5 = [];
var _local3 = 2;
while (_local3 < _local4.length) {
_local5.push(_local4[_local3]);
_local3++;
}
_local3 = 1;
while (_local3 < arguments.length) {
_local5.push(arguments[_local3]);
_local3++;
}
var _local6 = _local4[1];
var _local7 = _local4[0];
if (_local7 && (typeof(_local6) == "string")) {
_local6 = _local7[_local6];
}
if (_local6) {
_local6.apply(_local7, _local5);
}
};
_local6._didConnect = function (endpoint) {
this._endpoint = endpoint;
var _local4 = this._queue;
delete this._queue;
var _local5 = this.doSend;
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
_local5.apply(this, _local3);
_local2++;
}
};
_local6.doSend = function (args, cbobj, cbfn) {
if (this._endpoint == null) {
var _local4 = [];
var _local3 = 0;
while (_local3 < arguments.length) {
_local4.push(arguments[_local3]);
_local3++;
}
this._queue.push(_local4);
return(undefined);
}
this._id = this._id + 1;
var _local5 = this._id;
if ((cbfn === undefined) || (cbfn === null)) {
cbfn = cbobj;
}
this._callbacks[_local5] = [cbobj, cbfn];
var _local7 = new LocalConnection();
var _local9 = _local7.send(this._endpoint, "rpc", _local5, args);
};
_local6._callbacks = {};
_local6._callbacks[0] = [_local6, "_didConnect"];
_local11.st = getTimer();
_local11.loadMovie(_local21 + ".swf", "POST");
return(_local6);
}
static function fetchHighScores(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["fetchHighScores", options];
_local1.doSend(["fetchHighScores", options], callbackObj, callbackMethod);
return(true);
}
static function sendHighScore(options, callbackObj, callbackMethod) {
var _local1 = _loadCommunicator({id:options.id});
if (!_local1) {
return(false);
}
var _local4 = ["sendHighScore", options];
_local1.doSend(["sendHighScore", options], callbackObj, callbackMethod);
return(true);
}
static function load(options) {
var _local13 = {clip:_root, server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = _parseOptions(options, _local13);
options.swfv = options.clip.getSWFVersion() || 6;
options.mav = getVersion();
var _local7 = options.clip;
if (!_isNetworkAvailable()) {
return(null);
}
if (_local7._mochiad_loaded) {
return(null);
}
var _local12 = options.depth;
delete options.depth;
var _local6 = _local7.createEmptyMovieClip("_mochiad", _local12);
var _local11 = _getRes(options);
options.res = (_local11[0] + "x") + _local11[1];
options.server = options.server + options.id;
delete options.id;
_local7._mochiad_loaded = true;
var _local4 = _local6.createEmptyMovieClip("_mochiad_ctr", 1);
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
if (_local7._url.indexOf("http") != 0) {
options.no_page = true;
}
var _local10 = _local4.server;
delete _local4.server;
var _local14 = _allowDomains(_local10);
_local6.onEnterFrame = function () {
if (this._mochiad_ctr._url != this._url) {
this.onEnterFrame = function () {
if (!this._mochiad_ctr) {
delete this.onEnterFrame;
MochiAd.unload(this._parent);
}
};
}
};
var _local5 = new LocalConnection();
var _local9 = ["", Math.floor(new Date().getTime()), random(999999)].join("_");
_local5.mc = _local6;
_local5.name = _local9;
_local5.hostname = _local14;
_local5.allowDomain = function (d) {
return(true);
};
_local5.allowInsecureDomain = _local5.allowDomain;
_local5.connect(_local9);
_local6.lc = _local5;
_local4.lc = _local9;
_local4.st = getTimer();
_local4.loadMovie(_local10 + ".swf", "POST");
return(_local6);
}
static function unload(clip) {
if (typeof(clip) == "undefined") {
clip = _root;
}
if (clip.clip && (clip.clip._mochiad)) {
clip = clip.clip;
}
if (!clip._mochiad) {
return(false);
}
clip._mochiad.removeMovieClip();
delete clip._mochiad_loaded;
delete clip._mochiad;
return(true);
}
static function _isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function _getRes(options) {
var _local3 = options.clip.getBounds();
var _local2 = 0;
var _local1 = 0;
if (typeof(options.res) != "undefined") {
var _local4 = options.res.split("x");
_local2 = parseFloat(_local4[0]);
_local1 = parseFloat(_local4[1]);
} else {
_local2 = _local3.xMax - _local3.xMin;
_local1 = _local3.yMax - _local3.yMin;
}
if ((_local2 == 0) || (_local1 == 0)) {
_local2 = Stage.width;
_local1 = Stage.height;
}
return([_local2, _local1]);
}
static function _parseOptions(options, defaults) {
var _local4 = {};
for (var _local8 in defaults) {
_local4[_local8] = defaults[_local8];
}
if (options) {
for (var _local8 in options) {
_local4[_local8] = options[_local8];
}
}
if (_root.mochiad_options) {
var _local5 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2].split("=");
_local4[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local4);
}
}
Symbol 68 MovieClip Frame 5
this._parent.removeMovieClip();
Symbol 70 MovieClip Frame 5
this._parent.removeMovieClip();
Symbol 72 MovieClip Frame 5
this._parent.removeMovieClip();
Symbol 84 MovieClip Frame 31
this._parent.removeMovieClip();
Symbol 84 MovieClip Frame 129
this._parent.removeMovieClip();
Symbol 85 MovieClip [Splash] Frame 1
stop();
Symbol 718 MovieClip Frame 1
stop();
Symbol 731 MovieClip [hitWithCoin] Frame 17
this.removeMovieClip();
Symbol 732 MovieClip [hitWithoutCoin] Frame 17
this.removeMovieClip();
Symbol 736 MovieClip [AnimatedBlood] Frame 7
this.removeMovieClip();
Symbol 751 MovieClip Frame 1
stop();
Symbol 752 MovieClip Frame 1
stop();
Symbol 759 MovieClip Frame 1
stop();
Symbol 763 MovieClip Frame 1
stop();
Symbol 763 MovieClip Frame 25
stop();
Symbol 916 MovieClip [StealMoney] Frame 5
this.removeMovieClip();
Symbol 943 MovieClip Frame 1
stop();
Symbol 963 Button
on (release) {
_root.gotoAndPlay("MapMenu");
}
Symbol 967 Button
on (release) {
getURL ("http://dailyfreegames.com", "_blank");
}
Symbol 970 Button
on (release) {
getURL ("http://www.dailyfreegames.com/free-games.html", "_blank");
}
Symbol 973 Button
on (release) {
_root.gotoAndPlay("Instruction");
}
Symbol 977 MovieClip Frame 60
gotoAndStop (71);
Symbol 977 MovieClip Frame 71
stop();
var _delay = 48;
this.onEnterFrame = function () {
if ((Math.random() < 0.03) and ((_delay--) < 0)) {
_delay = 48;
gotoAndPlay ("loop");
}
};
Symbol 1008 MovieClip Frame 1
stop();
Symbol 1009 MovieClip Frame 1
function getChoosen() {
if (cb1._currentframe == 2) {
return(1);
}
if (cb2._currentframe == 2) {
return(2);
}
if (cb3._currentframe == 2) {
return(3);
}
}
cb2.gotoAndStop(2);
cb1.onRelease = function () {
cb1.gotoAndStop(2);
cb2.gotoAndStop(1);
cb3.gotoAndStop(1);
};
cb2.onRelease = function () {
cb1.gotoAndStop(1);
cb2.gotoAndStop(2);
cb3.gotoAndStop(1);
};
cb3.onRelease = function () {
cb1.gotoAndStop(1);
cb2.gotoAndStop(1);
cb3.gotoAndStop(2);
};
Symbol 1017 MovieClip Frame 1
stop();
Symbol 1022 MovieClip Frame 1
stop();
Symbol 1039 MovieClip Frame 1
stop();
Symbol 1045 MovieClip Frame 1
stop();
Symbol 1045 MovieClip Frame 3
stop();
Symbol 1049 MovieClip Frame 1
stop();
Symbol 1052 Button
on (release) {
_root.PanelRUSure._visible = true;
}
Symbol 1055 Button
on (release) {
if (_root.choosenMode == 1) {
this.BtnSkip._visible = false;
}
_root.firstNext = true;
var enemyCount = 0;
for (i in _root.container) {
mc = _root.container[i];
if (mc._name.substr(0, 7) == "enemies") {
enemyCount++;
}
}
if (_root.game._loop) {
if (((enemyCount <= 0) and (_root.enemyStack.length <= 0)) and (_root.prepareLevel > 0)) {
_root.prepareLevel = 2;
this.BtnSkip._visible = false;
}
enemyCount = 1;
}
if (((_root.Level < _root.maxLevel) and (_root.enemyStack.length < 1)) and (enemyCount < 1)) {
_root.Level++;
i = 1;
while (i <= 20) {
_root.enemyStack.push(_root.levelProperty[_root.Level % 10][0]);
_root.enemyStackHealth.push(_root.generateHealth(_root.Level));
i++;
}
_root.Money = _root.Money + ((Math.floor(_root.Level / 6) + 1) * 10);
}
}
Symbol 1063 Button
on (release) {
_root.addtower(1);
}
on (rollOut) {
_root.outTower(1);
}
on (dragOut) {
_root.outTower(1);
}
on (rollOver) {
_root.inTower(1);
}
Symbol 1066 Button
on (release) {
_root.addtower(2);
}
on (rollOut) {
_root.outTower(2);
}
on (dragOut) {
_root.outTower(2);
}
on (rollOver) {
_root.inTower(2);
}
Symbol 1069 Button
on (release) {
_root.addtower(3);
}
on (rollOut) {
_root.outTower(3);
}
on (dragOut) {
_root.outTower(3);
}
on (rollOver) {
_root.inTower(3);
}
Symbol 1072 Button
on (release) {
_root.addtower(4);
}
on (rollOut) {
_root.outTower(4);
}
on (dragOut) {
_root.outTower(4);
}
on (rollOver) {
_root.inTower(4);
}
Symbol 1074 Button
on (release) {
_root.addtower(5);
}
on (rollOut) {
_root.outTower(5);
}
on (dragOut) {
_root.outTower(5);
}
on (rollOver) {
_root.inTower(5);
}
Symbol 1097 Button
on (release) {
_root.addtower(32);
}
on (rollOut) {
_root.outTower(32);
}
on (dragOut) {
_root.outTower(32);
}
on (rollOver) {
_root.inTower(32);
}
Symbol 1099 Button
on (release) {
_root.addtower(34);
}
on (rollOut) {
_root.outTower(34);
}
on (dragOut) {
_root.outTower(34);
}
on (rollOver) {
_root.inTower(34);
}
Symbol 1101 Button
on (release) {
_root.addtower(35);
}
on (rollOut) {
_root.outTower(35);
}
on (dragOut) {
_root.outTower(35);
}
on (rollOver) {
_root.inTower(35);
}
Symbol 1103 Button
on (release) {
_root.addtower(36);
}
on (rollOut) {
_root.outTower(36);
}
on (dragOut) {
_root.outTower(36);
}
on (rollOver) {
_root.inTower(36);
}
Symbol 1105 Button
on (release) {
_root.addtower(37);
}
on (rollOut) {
_root.outTower(37);
}
on (dragOut) {
_root.outTower(37);
}
on (rollOver) {
_root.inTower(37);
}
Symbol 1107 Button
on (release) {
_root.addtower(38);
}
on (rollOut) {
_root.outTower(38);
}
on (dragOut) {
_root.outTower(38);
}
on (rollOver) {
_root.inTower(38);
}
Symbol 1109 Button
on (release) {
_root.addtower(33);
}
on (rollOut) {
_root.outTower(33);
}
on (dragOut) {
_root.outTower(33);
}
on (rollOver) {
_root.inTower(33);
}
Instance of Symbol 1039 MovieClip "BtnPause" in Symbol 1121 MovieClip Frame 1
on (rollOver) {
this.nextFrame();
}
on (rollOut) {
this.prevFrame();
}
on (release) {
if (this._currentframe <= 2) {
this.gotoAndStop(this._currentframe + 2);
} else {
this.gotoAndStop(this._currentframe - 2);
}
}
Instance of Symbol 1045 MovieClip in Symbol 1121 MovieClip Frame 1
on (rollOver) {
this.nextFrame();
}
on (rollOut) {
this.prevFrame();
}
on (release) {
if (this._currentframe <= 2) {
this.gotoAndStop(this._currentframe + 2);
_root.MusicPack[0].setVolume(0);
} else {
this.gotoAndStop(this._currentframe - 2);
_root.MusicPack[0].setVolume(100);
}
}
Symbol 1141 MovieClip [fps] Frame 1
function calcFPS() {
numFrames++;
var _local1 = getTimer();
var _local2 = (_local1 - startTime) / 1000;
var _local4 = Math.round(numFrames / _local2);
var _local3 = int(1000 / (_local1 - oldTimer));
fpsField.text = _local3;
oldTimer = _local1;
}
var startTime = getTimer();
var numFrames = 0;
var oldTimer = 0;
this.onEnterFrame = calcFPS;
Symbol 1142 Button
on (release) {
_root.gotoAndStop("MainGame");
}
Symbol 1263 Button
on (release) {
_root.gotoAndPlay("MainMenu");
}
Symbol 1264 MovieClip Frame 235
_root.Muzic(1);
Symbol 1264 MovieClip Frame 530
stop();
Symbol 1269 Button
on (release) {
_root.gotoAndStop("MainGame");
}
Symbol 1271 Button
on (release) {
_root.gotoAndStop("MainMenu");
}
Symbol 1273 MovieClip Frame 1
score.text = "Your Score:\n" + _root.game.score;