STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/76665527?noj=FRM76665527-22DC" width="1" height="1"></div>

wwii-defense-invasion.swf

This is the info page for
Flash #124905

(Click the ID number above for more basic data on this flash file.)


Text
0%

Choose a Map

NEXT

PREVIOUS

W

<p align="left"></p>

Tower

Description

Type

MONEY:

500

SCORE:

0

LIFE:

100

Instructions

Hover the mouse over one of the towers on the left to see what they can do.  Click on a specific tower and place it on the green area.

Build more towers to destroy wave after wave  of creeps or upgrade your existing towers for more  stopping power.

The Game won't start until you place your first tower! Good luck!

Next Wave

Current Power

Damage
Range
Splash
Description1
Description2

Upgrade [**]

Upgrade Power

Damage
Range
Splash
Description1
Description2

Click anywhere on the
map to exit upgrade
screen.

Play Sounds

Mute Sounds

P

THE END

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

<p align="left"></p>

ActionScript [AS1/AS2]

Frame 1
function __com_mochibot__(swfid, mc, lv, trk) { var _local5; var _local4; var _local3; var _local7; var _local13; var _local10; var _local11; var _local2; var _local8; var _local12; _local2 = "__mochibot__"; _local8 = "mochibot.com"; _local4 = (_global ? _global : (_level0._root)); if (_local4[_local2 + swfid]) { return(_local4[_local2 + swfid]); } _local3 = System.security; _local5 = mc._root.getSWFVersion; _local7 = (_local5 ? (mc.getSWFVersion()) : ((_global ? 6 : 5))); if (!_local3) { _local3 = {}; } }
Frame 2
stop();
Frame 3
stop();
Frame 4
stop(); intromusic = new Sound(); intromusic.attachSound("intrito"); intromusic.start(0, 99);
Frame 5
stop();
Frame 6
stop();
Frame 7
stop();
Frame 8
stop();
Frame 9
_root.remove = true; _root.waves = []; stop(); stopAllSounds();
Frame 10
_root.remove = true; _root.waves = []; stop(); stopAllSounds();
Frame 11
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Instance of Symbol 198 MovieClip "deselect" in Frame 11
on (press) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; }
Instance of Symbol 284 MovieClip "creep1" in Frame 11
onClipEvent (load) { } onClipEvent (enterFrame) { if (_root.remove == true) { this.removeMovieClip(); } }
Instance of Symbol 296 MovieClip "info_message" in Frame 11
onClipEvent (load) { _visible = false; }
Instance of Symbol 311 MovieClip "timeline" in Frame 11
onClipEvent (load) { clearInterval(_root.levelInterval); } on (press) { if (!_root.hasGameStarted) { return(undefined); } if ((_root.wave >= 0) && ((_root.wave - 1) <= (_root.waves.length - 1))) { _root.score = _root.score + (_root.wave * (_root.maxCount - _root.count)); _root.gold = _root.gold + int(_root.gold * 0.03); _root.count = 1; _root.newLevel(); } } onClipEvent (enterFrame) { }
Instance of Symbol 324 MovieClip "UpgradeTowerInfo" in Frame 11
onClipEvent (load) { _visible = false; swapDepths(100000); }
Instance of Symbol 329 MovieClip in Frame 11
on (press) { if (_root.gold >= 30) { _root.marker.active = 1; _root.marker.tower = "cannon"; _root.marker.cost = 30; } _root.UpgradeTowerInfo._visible = false; } on (rollOver) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; _parent.info_message.title.text = _root.tower_cannon.title; _parent.info_message.desc.text = _root.tower_cannon.desc; _parent.info_message.type.text = _root.tower_cannon.type; _parent.info_message._visible = true; } on (rollOut) { _parent.info_message._visible = false; }
Instance of Symbol 330 MovieClip "tower_cannon" in Frame 11
onClipEvent (load) { title = "Machine Gun"; desc = "Medium attack speed, high damage, high range"; type = "Cost $30"; cost = 0; range = 120; rate = 5; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 15; splash = 0; slow = 0; poison = 0; level = 1; upgrades = [["Damage: 20\rRange: 120\rDebris:No\rSlow:No\rResidual:No\r", 40, 20, 120, 5, 0, 0, 0], ["Damage: 25\rRange: 120\rDebris:No\rSlow:No\rResidual:No\r", 60, 25, 120, 5, 0, 0, 0], ["Damage: 30\rRange: 120\rDebris:No\rSlow:No\rResidual:No\r", 110, 30, 120, 5, 0, 0, 0], ["Damage: 40\rRange: 120\rDebris:40\rSlow:No\rResidual:No\r", 170, 40, 120, 5, 40, 0, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.remove == true) { this.removeMovieClip(); } if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_cannonball", damage, splash, slow); } } } } }
Instance of Symbol 333 MovieClip "marker" in Frame 11
onClipEvent (load) { active = 0; } onClipEvent (enterFrame) { if (active == 1) { _x = ((int((_root._xmouse - 10) / 20) * 20) + 20); _y = ((int((_root._ymouse - 10) / 20) * 20) + 20); hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1); if (hitTestOnGrassMovieClip) { gotoAndStop (1); _root.ranger.gotoAndStop(1); } else { gotoAndStop (2); _root.ranger.gotoAndStop(2); } _root.ranger._x = _x; _root.ranger._y = _y; _root.ranger._width = _root["tower_" + tower].range * 2; _root.ranger._height = _root["tower_" + tower].range * 2; } } on (press) { hitTestOnGrassMovieClip = _root.grass.hitTest(_x, _y, 1); hitTestOnDeSelectMovieClip = _root.deselect.hitTest(_x, _y, 1); if (hitTestOnGrassMovieClip || (hitTestOnDeSelectMovieClip)) { if (hitTestOnGrassMovieClip && (!_root.hasGameFinished)) { _root.towerCount++; _root["tower_" + tower].duplicateMovieClip("t" + _root.towerCount, 500 + _root.towerCount); a = _root["t" + _root.towerCount]; a._x = _x; a._y = _y; a.active = 1; a.cost = cost; _root.gold = _root.gold - cost; _root.updateInfoBar(); if (!_root.hasGameStarted) { _root.newLevel(); _root.hasGameStarted = true; _root.instructions._visible = false; } } active = 0; _x = 1000; _root.selectedTower = ""; _root.ranger._x = 1000; _root.ranger._width = 10; _root.ranger._height = 10; } }
Instance of Symbol 348 MovieClip in Frame 11
on (press) { if (_root.gold >= 160) { _root.marker.active = 1; _root.marker.tower = "fire"; _root.marker.cost = 160; } _root.UpgradeTowerInfo._visible = false; } on (rollOver) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; _parent.info_message.title.text = _root.tower_fire.title; _parent.info_message.desc.text = _root.tower_fire.desc; _parent.info_message.type.text = _root.tower_fire.type; _parent.info_message._visible = true; } on (rollOut) { _parent.info_message._visible = false; }
Instance of Symbol 354 MovieClip "tower_fire" in Frame 11
onClipEvent (load) { title = "Cannon"; desc = "Fast attack speed, moderate damage, low range, splash damage to nearby enemies"; type = "Cost $160"; cost = 0; range = 80; rate = 4; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 5; splash = 40; slow = 0; poison = 0; level = 1; upgrades = [["Damage: 15\rRange: 80\rDebris:50\rSlow:No\rResidual:No\r", 90, 15, 80, 2, 50, 0, 0], ["Damage: 25\rRange: 80\rDebris:60\rSlow:No\rResidual:No\r", 150, 25, 80, 2, 60, 0, 0], ["Damage: 40\rRange: 80\rDebris:65\rSlow:No\rResidual:No\r", 190, 40, 80, 2, 65, 0, 0], ["Damage: 50\rRange: 80\rDebris:70\rSlow:20\rResidual:No\r", 250, 50, 80, 2, 70, 20, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.remove == true) { this.removeMovieClip(); } if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_fire", damage, splash, slow); } } } } }
Instance of Symbol 358 MovieClip in Frame 11
on (press) { if (_root.gold >= 60) { _root.marker.active = 1; _root.marker.tower = "water"; _root.marker.cost = 60; } _root.UpgradeTowerInfo._visible = false; } on (rollOver) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; _parent.info_message.title.text = _root.tower_water.title; _parent.info_message.desc.text = _root.tower_water.desc; _parent.info_message.type.text = _root.tower_water.type; _parent.info_message._visible = true; } on (rollOut) { _parent.info_message._visible = false; }
Instance of Symbol 359 MovieClip "tower_water" in Frame 11
onClipEvent (load) { title = "Medium Machine Gun"; desc = "Fast attack speed, low damage, low range, slows down nearby enemies, debris damage"; type = "Cost $60"; cost = 0; range = 80; rate = 2; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 3; splash = 10; slow = 25; poison = 0; level = 1; upgrades = [["Damage: 5\rRange: 80\rDebris:10\rSlow:40\rResidual:No\r", 70, 5, 80, 2, 10, 40, 0], ["Damage: 15\rRange: 80\rDebris:20\rSlow:60\rResidual:No\r", 140, 15, 80, 2, 20, 60, 0], ["Damage: 20\rRange: 80\rDebris:30\rSlow:65\rResidual:No\r", 180, 20, 80, 2, 30, 65, 0], ["Damage: 30\rRange: 80\rDebris:40\rSlow:70\rResidual:No\r", 230, 35, 80, 2, 40, 70, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.pauseyes == 0) { if (_root.remove == true) { this.removeMovieClip(); } if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_water", damage, splash, slow); } } } } } }
Instance of Symbol 368 MovieClip in Frame 11
on (press) { if (_root.gold >= 100) { _root.marker.active = 1; _root.marker.tower = "poison"; _root.marker.cost = 100; } _root.UpgradeTowerInfo._visible = false; } on (rollOver) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; _parent.info_message.title.text = _root.tower_poison.title; _parent.info_message.desc.text = _root.tower_poison.desc; _parent.info_message.type.text = _root.tower_poison.type; _parent.info_message._visible = true; } on (rollOut) { _parent.info_message._visible = false; }
Instance of Symbol 369 MovieClip "tower_poison" in Frame 11
onClipEvent (load) { title = "Big Machine Gun"; desc = "Fast attack speed, medium damage, low range, residual damage"; type = "Cost $100"; cost = 0; range = 80; rate = 8; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 5; splash = 0; slow = 0; poison = 5; level = 1; upgrades = [["Damage: 10\rRange: 80\rDebris:No\rSlow:No\rResidual:10\r", 50, 10, 80, 8, 0, 10], ["Damage: 15\rRange: 80\rDebris:No\rSlow:No\rResidual:15\r", 150, 15, 80, 8, 0, 15], ["Damage: 20\rRange: 80\rDebris:No\rSlow:No\rResidual:20\r", 300, 20, 80, 8, 0, 20], ["Damage: 30\rRange: 80\rDebris:No\rSlow:No\rResidual:30\r", 700, 30, 80, 8, 0, 30]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.remove == true) { this.removeMovieClip(); } if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_poison", damage, splash, slow, poison); } } } } }
Instance of Symbol 376 MovieClip in Frame 11
onClipEvent (load) { this.useHandCursor = false; } onClipEvent (enterFrame) { if (_root.gold < 30) { this._visible = true; } else { this._visible = false; } }
Instance of Symbol 377 MovieClip in Frame 11
onClipEvent (load) { this.useHandCursor = false; } onClipEvent (enterFrame) { if (_root.gold < 60) { this._visible = true; } else { this._visible = false; } }
Instance of Symbol 378 MovieClip in Frame 11
onClipEvent (load) { this.useHandCursor = false; } onClipEvent (enterFrame) { if (_root.gold < 160) { this._visible = true; } else { this._visible = false; } }
Instance of Symbol 379 MovieClip in Frame 11
onClipEvent (load) { this.useHandCursor = false; } onClipEvent (enterFrame) { if (_root.gold < 100) { this._visible = true; } else { this._visible = false; } }
Instance of Symbol 383 MovieClip in Frame 11
on (press) { if (_root.gold >= 300) { _root.marker.active = 1; _root.marker.tower = "five"; _root.marker.cost = 300; } _root.UpgradeTowerInfo._visible = false; } on (rollOver) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; _parent.info_message.title.text = _root.tower_five.title; _parent.info_message.desc.text = _root.tower_five.desc; _parent.info_message.type.text = _root.tower_five.type; _parent.info_message._visible = true; } on (rollOut) { _parent.info_message._visible = false; }
Instance of Symbol 384 MovieClip in Frame 11
onClipEvent (load) { this.useHandCursor = false; } onClipEvent (enterFrame) { if (_root.gold < 300) { this._visible = true; } else { this._visible = false; } }
Instance of Symbol 385 MovieClip "tower_five" in Frame 11
onClipEvent (load) { title = "Flak Cannon"; desc = "Good attack speed, high damage, high range"; type = "Cost $300"; cost = 0; range = 130; rate = 5; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 20; splash = 10; slow = 0; poison = 1; level = 1; upgrades = [["Damage: 30\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 80, 30, 120, 5, 0, 0, 0], ["Damage: 40\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 140, 40, 120, 5, 0, 0, 0], ["Damage: 50\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 190, 50, 120, 5, 0, 0, 0], ["Damage: 60\rRange: 120\rSplash:40\rSlow:No\rPoison:No\r", 230, 60, 120, 5, 40, 0, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.remove == true) { this.removeMovieClip(); } if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_five", damage, splash, slow); } } } } }
Instance of Symbol 394 MovieClip in Frame 11
on (press) { if (_root.gold >= 600) { _root.marker.active = 1; _root.marker.tower = "six"; _root.marker.cost = 600; } _root.UpgradeTowerInfo._visible = false; } on (rollOver) { _root.selectedTower = ""; _root.ranger._x = 3000; _root.ranger._width = 10; _root.ranger._height = 10; _root.UpgradeTowerInfo._visible = false; _parent.info_message.title.text = _root.tower_six.title; _parent.info_message.desc.text = _root.tower_six.desc; _parent.info_message.type.text = _root.tower_six.type; _parent.info_message._visible = true; } on (rollOut) { _parent.info_message._visible = false; }
Instance of Symbol 395 MovieClip in Frame 11
onClipEvent (load) { this.useHandCursor = false; } onClipEvent (enterFrame) { if (_root.gold < 600) { this._visible = true; } else { this._visible = false; } }
Instance of Symbol 396 MovieClip "tower_six" in Frame 11
onClipEvent (load) { title = "Mega Cannon"; desc = "Ultra attack speed, ultra damage, ultra range"; type = "Cost $600"; cost = 0; range = 150; rate = 6; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 30; splash = 15; slow = 5; poison = 1; level = 1; upgrades = [["Damage: 40\rRange: 120\rDebris:60\rSlow:10\rResidual:No\r", 100, 40, 120, 5, 60, 10, 0], ["Damage: 75\rRange: 120\rDebris:65\rSlow:15\rResidual:No\r", 150, 75, 120, 5, 65, 15, 0], ["Damage: 150\rRange: 120\rDebris:70\rSlow:20\rResidual:No\r", 200, 150, 120, 5, 70, 20, 0], ["Damage: 250\rRange: 120\rDebris:75\rSlow:25\rResidual:No\r", 250, 250, 120, 5, 75, 25, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.remove == true) { this.removeMovieClip(); } if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_six", damage, splash, slow); } } } } }
Frame 12
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Instance of Symbol 311 MovieClip "timeline" in Frame 12
onClipEvent (load) { clearInterval(_root.levelInterval); } on (press) { if (!_root.hasGameStarted) { return(undefined); } if ((_root.wave >= 0) && ((_root.wave - 1) <= (_root.waves.length - 1))) { _root.score = _root.score + (_root.wave * (_root.maxCount - _root.count)); _root.gold = _root.gold + int(_root.gold * 0.03); _root.count = 1; _root.newLevel(); } } onClipEvent (enterFrame) { }
Instance of Symbol 330 MovieClip "tower_cannon" in Frame 12
onClipEvent (load) { title = "Machine Gun"; desc = "Medium attack speed, high damage, high range"; type = "Cost $30"; cost = 0; range = 120; rate = 5; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 15; splash = 0; slow = 0; poison = 0; level = 1; upgrades = [["Damage: 20\rRange: 120\rDebris:No\rSlow:No\rResidual:No\r", 40, 20, 120, 5, 0, 0, 0], ["Damage: 25\rRange: 120\rDebris:No\rSlow:No\rResidual:No\r", 60, 25, 120, 5, 0, 0, 0], ["Damage: 30\rRange: 120\rDebris:No\rSlow:No\rResidual:No\r", 110, 30, 120, 5, 0, 0, 0], ["Damage: 40\rRange: 120\rDebris:40\rSlow:No\rResidual:No\r", 170, 40, 120, 5, 40, 0, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_cannonball", damage, splash, slow); } } } } }
Instance of Symbol 354 MovieClip "tower_fire" in Frame 12
onClipEvent (load) { title = "Cannon"; desc = "Fast attack speed, moderate damage, low range, splash damage to nearby enemies"; type = "Cost $160"; cost = 0; range = 80; rate = 4; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 5; splash = 40; slow = 0; poison = 0; level = 1; upgrades = [["Damage: 15\rRange: 80\rDebris:50\rSlow:No\rResidual:No\r", 90, 15, 80, 2, 50, 0, 0], ["Damage: 25\rRange: 80\rDebris:60\rSlow:No\rResidual:No\r", 150, 25, 80, 2, 60, 0, 0], ["Damage: 40\rRange: 80\rDebris:65\rSlow:No\rResidual:No\r", 190, 40, 80, 2, 65, 0, 0], ["Damage: 50\rRange: 80\rDebris:70\rSlow:20\rResidual:No\r", 250, 50, 80, 2, 70, 20, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_fire", damage, splash, slow); } } } } }
Instance of Symbol 359 MovieClip "tower_water" in Frame 12
onClipEvent (load) { title = "Medium Machine Gun"; desc = "Fast attack speed, low damage, low range, slows down nearby enemies, debris damage"; type = "Cost $60"; cost = 0; range = 80; rate = 2; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 3; splash = 10; slow = 25; poison = 0; level = 1; upgrades = [["Damage: 5\rRange: 80\rDebris:10\rSlow:40\rResidual:No\r", 70, 5, 80, 2, 10, 40, 0], ["Damage: 15\rRange: 80\rDebris:20\rSlow:60\rResidual:No\r", 140, 15, 80, 2, 20, 60, 0], ["Damage: 20\rRange: 80\rDebris:30\rSlow:65\rResidual:No\r", 180, 20, 80, 2, 30, 65, 0], ["Damage: 30\rRange: 80\rDebris:40\rSlow:70\rResidual:No\r", 230, 35, 80, 2, 40, 70, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if (_root.pauseyes == 0) { if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_water", damage, splash, slow); } } } } } }
Instance of Symbol 369 MovieClip "tower_poison" in Frame 12
onClipEvent (load) { title = "Big Machine Gun"; desc = "Fast attack speed, medium damage, low range, residual damage"; type = "Cost $100"; cost = 0; range = 80; rate = 8; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 5; splash = 0; slow = 0; poison = 5; level = 1; upgrades = [["Damage: 10\rRange: 80\rDebris:No\rSlow:No\rResidual:10\r", 50, 10, 80, 8, 0, 10], ["Damage: 15\rRange: 80\rDebris:No\rSlow:No\rResidual:15\r", 150, 15, 80, 8, 0, 15], ["Damage: 20\rRange: 80\rDebris:No\rSlow:No\rResidual:20\r", 300, 20, 80, 8, 0, 20], ["Damage: 30\rRange: 80\rDebris:No\rSlow:No\rResidual:30\r", 700, 30, 80, 8, 0, 30]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_poison", damage, splash, slow, poison); } } } } }
Instance of Symbol 385 MovieClip "tower_five" in Frame 12
onClipEvent (load) { title = "Flak Cannon"; desc = "Good attack speed, high damage, high range"; type = "Cost $300"; cost = 0; range = 130; rate = 5; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 20; splash = 10; slow = 0; poison = 1; level = 1; upgrades = [["Damage: 30\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 80, 30, 120, 5, 0, 0, 0], ["Damage: 40\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 140, 40, 120, 5, 0, 0, 0], ["Damage: 50\rRange: 120\rSplash:No\rSlow:No\rPoison:No\r", 190, 50, 120, 5, 0, 0, 0], ["Damage: 60\rRange: 120\rSplash:40\rSlow:No\rPoison:No\r", 230, 60, 120, 5, 40, 0, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_five", damage, splash, slow); } } } } }
Instance of Symbol 396 MovieClip "tower_six" in Frame 12
onClipEvent (load) { title = "Mega Cannon"; desc = "Ultra attack speed, ultra damage, ultra range"; type = "Cost $600"; cost = 0; range = 150; rate = 6; lastFire = rate; lastChecked = rate; creep = ""; target = 0; damage = 30; splash = 15; slow = 5; poison = 1; level = 1; upgrades = [["Damage: 40\rRange: 120\rDebris:60\rSlow:10\rResidual:No\r", 100, 40, 120, 5, 60, 10, 0], ["Damage: 75\rRange: 120\rDebris:65\rSlow:15\rResidual:No\r", 150, 75, 120, 5, 65, 15, 0], ["Damage: 150\rRange: 120\rDebris:70\rSlow:20\rResidual:No\r", 200, 150, 120, 5, 70, 20, 0], ["Damage: 250\rRange: 120\rDebris:75\rSlow:25\rResidual:No\r", 250, 250, 120, 5, 75, 25, 0]]; } on (press) { _root.towerInfo(this); } onClipEvent (enterFrame) { if ((active == 1) && (_root.creepArray.length > 0)) { lastChecked++; if (lastChecked >= rate) { lastChecked = 0; if (target == 0) { i = 0; while (i <= _root.creepArray.length) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < range) { target = 1; creep = _root.creepArray[i]; break; } i++; } } else if (("" + creep) == "") { target = 0; } else { d = Math.sqrt(Math.pow(this._x - creep._x, 2) + Math.pow(this._y - creep._y, 2)); if (d > range) { lastChecked = 999; target = 0; } else { _rotation = ((Math.atan2(creep._y - this._y, creep._x - this._x) * 180) / 3.141593); _root.fire(this, creep, 10, 1, 10, "projectile_six", damage, splash, slow); } } } } }
Frame 13
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 14
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 15
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 16
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 17
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 10) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 18
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 19
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 20
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 9) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 21
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 14) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 22
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 23
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 24
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 25
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 10) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 26
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 9) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 27
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 28
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 29
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 7) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 30
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 11) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 31
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 6) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 32
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 33
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 6) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 34
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 9) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 35
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 36
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 37
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 10) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 38
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 39
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 11) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Frame 40
function executeCallback() { if (_root.hasGameStarted) { if (_root.count >= _root.maxCount) { _root.newLevel(); } if (_root.wave < (_root.waves.length - 1)) { _root.count++; } else if (_root.currentNumberOfCreeps <= 0) { _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.remove = true; _root.gotoAndPlay(10); } } else { var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { Explosion("projectile_fire", b._x, b._y); b.removeMovieClip(); } _local2++; } } } function towerInfo(tower) { _root.selectedTower = tower; _root.ranger._x = tower._x; _root.ranger._y = tower._y; _root.ranger._width = tower.range * 2; _root.ranger._height = tower.range * 2; _root.UpgradeTowerInfo._visible = true; if (tower.upgrades.length >= tower.level) { _root.UpgradeTowerInfo.UpgradeInfoText.text = tower.upgrades[tower.level - 1][0]; _root.UpgradeTowerInfo.TowerInfoText.text = (((((((("Damage: " + tower.damage) + "\rRange: ") + tower.range) + "\rDebris: ") + (tower.splash ? "Yes" : "No")) + "\rSlow: ") + (tower.slow ? "Yes" : "No")) + "\rResidual: ") + (tower.poison ? "Yes" : "No"); _root.UpgradeTowerInfo.UpgradeButton.UpgradeButtonText.text = ("Upgrade [$" + tower.upgrades[tower.level - 1][1]) + "]"; _root.UpgradeTowerInfo.UpgradeButton._visible = true; } else { _root.UpgradeTowerInfo.f.text = ""; _root.UpgradeTowerInfo.UpgradeButton._visible = false; _root.UpgradeTowerInfo.h.text = ""; } } function newLevel() { _root.wave++; updateInfoBar(); if ((_root.wave - 1) < (_root.waves.length - 1)) { _root.inGameMessage(("<font color='#ffffff'><b>Start Wave: " + _root.wave) + " </b></font>"); _root["spawnInterval" + _root.wave] = setInterval(_root, "spawn", _root.waves[_root.wave][3], _root.wave, "creep1", _root.waves[_root.wave][2], _root.waves[_root.wave][1], _root.waves[_root.wave][4]); _root["creepEventInterval" + _root.wave] = setInterval(_root, "creepEvent", 500); _root["spawned" + _root.wave] = _root.waves[_root.wave][0]; } updateScore(); } function creepEvent() { i = 0; while (i <= _root.creepArray.length) { if (("" + _root.creepArray[i]) != "") { if (_root.creepArray[i].poison > 0) { _root.creepArray[i].health = _root.creepArray[i].health - ((_root.creepArray[i].poison * _root.creepArray[i].health) / 100); _root.creepArray[i].poison--; } } i++; } } function spawn(level, creep, speed, health, gold) { if (_root.contero == 0) { if (_root.wave == 30) { _root.theend._visible = true; } _root.nextwave._visible = true; _root.nextwave._visible = 1; } if (_root["spawned" + level] == 0) { } else { _root["spawned" + level]--; _root.creepCount++; _root.currentNumberOfCreeps++; _root[creep].duplicateMovieClip("c" + _root.creepCount, 1000 + _root.creepCount); c = _root["c" + _root.creepCount]; _root.creepArray[_root.creepArray.length] = c; c.creep.gotoAndStop(level); c._x = wp1._x; c._y = wp1._y; c.speed = speed; c.maxspeed = speed; c.targ = 2; c.rnd = random(10); c.health = health; c.maxHealth = health; c.isDead = 0; c.gold = gold; _root.oldtimer = getTimer(); _root.contero--; c.onEnterFrame = function () { if (_root.pauseyes == 0) { if (_root.oldTimer != getTimer()) { _root.newtimer = getTimer() - _root.oldtimer; } if (c.targ < 2) { c.targ = 2; } if (this.health <= 0) { _root.kill(this); } if (this.speed < this.maxspeed) { this.speed = this.speed + 0.1; } this.targX = (_root["wp" + this.targ]._x - 5) + this.rnd; this.targY = (_root["wp" + this.targ]._y - 5) + this.rnd; this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; _root.dt = getTimer() - _root.newtimer; this.r = this.dir + (Math.sin((getTimer() + (this.rnd * 100)) / 100) * 7); if ((this.creep._rotation + 10) < this.r) { this.creep._rotation = this.creep._rotation + 10; } else if ((this.creep._rotation - 10) > this.r) { this.creep._rotation = this.creep._rotation - 10; } else { this.creep._rotation = r; } this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 5) { this.targ++; if (this.targ > 8) { _root.leak(this); _root.updateInfoBar(); } } } else { _root.oldtimer = getTimer(); c.onEnterFrame = null; } this.health_bar.health._width = (30 / this.maxHealth) * this.health; this.health_bar._visible = true; }; } } function Explosion(type, x, y) { i = 1; while (i <= 10) { _root.explosionCount++; duplicateMovieClip (_root[type + "_explosion"], "explosion" + _root.explosionCount, 4900 + _root.explosionCount); a = _root["explosion" + _root.explosionCount]; a._x = x; a._y = y; a.rads = random(360); a.speed = (5 + random(20)) / 5; a._rotation = a.rads; a.onEnterFrame = function () { if (_root.pauseyes == 0) { this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); this._alpha = this._alpha - 20; if (this.speed > 0.5) { this.speed = this.speed - 0.5; } if (this._alpha <= 0) { this.removeMovieClip(); } } else { a.onEnterFrame = null; this.removeMovieClip(); } }; i++; } if (_root.explosionCount > 10) { _root.explosionCount = 0; } } function fire(from, to, speed, acc, maxspeed, projectile, damage, splash, slow, poison) { _root.particleCount++; _root[projectile].duplicateMovieClip("p" + _root.particleCount, 2000 + _root.particleCount); r = _root["p" + _root.particleCount]; dir = (Math.atan2(from._y - to._y, from._x - to._x) * 180) / 3.141593; rads = (dir * 3.141593) / 180; r._x = from._x; r._y = from._y; r._x = r._x - (Math.cos(rads) * (from._width / 2)); r._y = r._y - (Math.sin(rads) * (from._height / 2)); r.targ = to; if (("" + to) == "") { r.removeMovieClip(); } r.speed = speed; r.acc = acc; r.maxspeed = maxspeed; r.projectile = projectile; r.damage = damage; r.splash = splash; r.slow = slow; r.poison = poison; r.onEnterFrame = function () { if (_root.pauseyes == 0) { if (("" + this.targ) != "") { this.targX = this.targ._x; this.targY = this.targ._y; } else if (("" + this.targX) == "undefined") { this.removeMovieClip(); } this.dir = (Math.atan2(this.targY - this._y, this.targX - this._x) * 180) / 3.141593; this._rotation = this.dir + 90; this.rads = (this.dir * 3.141593) / 180; this._x = this._x + (Math.cos(this.rads) * this.speed); this._y = this._y + (Math.sin(this.rads) * this.speed); if (this.speed < this.maxspeed) { this.speed = this.speed + this.acc; } d = Math.sqrt(Math.pow(this._x - this.targX, 2) + Math.pow(this._y - this.targY, 2)); if (d < 10) { Explosion(projectile, this._x, this._y); if (this.slow > 0) { this.targ.speed = (this.targ.maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { this.targ.poison = this.poison; } if (this.splash > 0) { i = 0; while (i <= _root.creepArray.length) { if ((("" + _root.creepArray[i]) != "") && (_root.creepArray[i] != this.targ)) { d = Math.sqrt(Math.pow(this._x - _root.creepArray[i]._x, 2) + Math.pow(this._y - _root.creepArray[i]._y, 2)); if (d < this.splash) { _root.creepArray[i].health = _root.creepArray[i].health - (this.damage * (1 - (d / this.splash))); if (this.slow > 0) { _root.creepArray[i].speed = (_root.creepArray[i].maxspeed / 100) * (100 - this.slow); } if (this.poison > 0) { _root.creepArray[i].poison = int(this.poison * (d / this.splash)); } } } i++; } } this.targ.health = this.targ.health - this.damage; if (targ.health <= 0) { targ.isDead = 1; } metra = new Sound(this); metra.attachSound("metralleta"); metra.start(0, 1); metra.attachSound(""); this.removeMovieClip(); } if (_root.particleCount > 50) { _root.particleCount = 0; } } else { r.onEnterFrame = null; this.removeMovieClip(); } }; } function kill(creep) { _root.kills++; if (_root.kills >= _root.waves[_root.wave - 1][0]) { _root.kills = 0; } creep.onEnterFrame = function () { if (_root.pauseyes == 0) { _root.currentNumberOfCreeps--; _root.gold = _root.gold + creep.gold; updateScore(); updateInfoBar(); this.removeMovieClip(); } else { creep.onEnterFrame = null; } }; } function leak(creep) { _root.creepLeaks++; if (!_root.hasGameFinished) { creep._x = _root.wp0._x; creep._y = _root.wp0._y; creep.targ = 1; creep.removeMovieClip(); } else { creep.removeMovieClip(); } _root.health--; if (_root.health <= 0) { _root.health = 0; _root.hasGameStarted = false; if (!_root.hasGameFinished) { _root.inGameMessage("<font color='#ffffff'>Oh No! You let them break through, AHHHHGGGGRRRR!</font>"); } _root.hasGameFinished = true; _root.remove = true; _root.gotoAndPlay(9); } } function updateScore() { var _local3 = _root.gold; var _local2 = 1; while (_local2 <= _root.towerCount) { b = _root["t" + _local2]; if (("" + b) != "undefined") { _local3 = _local3 + b.cost; } _local2++; } _root.score = _root.score + _local3; } function upgrade() { a = _root.selectedTower; b = a.level - 1; if (int(a.upgrades[b][1]) <= _root.gold) { a.damage = int(a.upgrades[b][2]); a.range = a.upgrades[b][3]; a.rate = a.upgrades[b][4]; a.splash = a.upgrades[b][5]; a.slow = a.upgrades[b][6]; a.cost = a.cost + int(a.upgrades[b][1]); a.level++; _root.towerInfo(_root.selectedTower); _root.gold = _root.gold - int(a.upgrades[b][1]); updateInfoBar(); } updateScore(); } function updateInfoBar() { _root.InfoBar.GoldAmount.text = _root.gold; _root.InfoBar.ScoreAmount.text = _root.score; _root.InfoBar.HealthAmount.text = _root.health; } function inGameMessage(n) { _root.ingame_message.htmlText = (n + "<br>") + _root.ingame_message.htmlText; _root.ingame_message.vPosition = _root.ingame_message.maxVPosition; } stopAllSounds(); _root.waves = []; var remove = false; ambi = new Sound(this); ambi.attachSound("ambience"); ambi.start(0, 100); _root.wave = 0; _root.level = 0; stop(); _root.waves = [[10, 50, 2.5, 1000, 2], [10, 100, 3.5, 4000, 2], [10, 150, 2.5, 1500, 2], [10, 200, 1.5, 2000, 2], [10, 250, 3.5, 3000, 2], [5, 500, 2.5, 2000, 4], [10, 350, 2.5, 2000, 5], [15, 450, 3.5, 3000, 5], [15, 550, 2.5, 4000, 6], [10, 650, 1.5, 4000, 6], [10, 750, 3.5, 3500, 7], [15, 850, 3.5, 3500, 7], [15, 950, 2.5, 4000, 8], [10, 1050, 3.5, 4000, 8], [10, 1050, 2.5, 3500, 9], [15, 1150, 2.5, 3500, 9], [15, 1150, 3.5, 4000, 9], [15, 1200, 2.5, 4000, 15], [10, 1250, 2.5, 5000, 10], [10, 1330, 3.5, 4500, 10], [15, 1330, 2.5, 4000, 10], [15, 1350, 2.5, 4500, 10], [10, 1400, 3, 5000, 10], [10, 1500, 3, 5000, 10], [15, 1600, 2.5, 5000, 10], [15, 1700, 2.5, 5000, 10], [10, 1800, 2.5, 5000, 10], [15, 1900, 3, 5000, 10], [10, 2000, 3.5, 5000, 10], [15, 2100, 4, 5000, 20]]; _root.wave = 0; _root.hasGameStarted = false; _root.hasGameFinished = false; _root.towerCount = 0; _root.selectedTower = ""; _root.currentNumberOfCreeps = 0; _root.creepCount = 0; _root.creepArray = []; _root.creepLeaks = 0; _root.explosionCount = 0; _root.particleCount = 0; _root.kills = 0; _root.gold = 50; _root.count = 1; _root.maxCount = 3; _root.updateDuration = 2; _root.health = 100; _root.score = 0; _root.pauseyes = 0; _root.oldtimer = 0; _root.newtimer = 0; _root.dt = 0; _root.nextwave._visible = 0; _root.contero = _root.waves[_root.wave][0]; _root.wavecounter = 0; _root.theend._visible = false;
Symbol 13 MovieClip Frame 1
_parent.stop(); this.onEnterFrame = function () { if (_parent.getBytesTotal() > 1) { percent = int((_parent.getBytesLoaded() / _parent.getBytesTotal()) * 100); text_info.text = percent + "%"; bar_mask._xscale = percent; if (percent >= 100) { _root.gotoAndPlay(2); } } };
Symbol 61 MovieClip Frame 55
gotoAndPlay (6);
Symbol 62 MovieClip Frame 100
stop();
Symbol 63 MovieClip Frame 9
stop();
Symbol 65 Button
on (release) { getURL ("http://247gamesonline.com", "_self"); }
Symbol 68 Button
on (release) { gotoAndStop (4); }
Symbol 77 MovieClip Frame 1
_root.stop(); play();
Symbol 77 MovieClip Frame 168
stop();
Symbol 81 Button
on (release) { gotoAndStop (8); }
Symbol 82 Button
on (release) { getURL ("http://www.247gamesonline.com/?utm_medium=brandedgames_external&utm_campaign=ww2towerdefence&utm_source=host&utm_content=ingame", _blank); }
Symbol 88 Button
on (release) { gotoAndStop (6); }
Symbol 91 Button
on (release) { intromusic.stop(); gotoAndPlay (11); }
Symbol 94 Button
on (release) { intromusic.stop(); gotoAndPlay (12); }
Symbol 97 Button
on (release) { intromusic.stop(); gotoAndPlay (13); }
Symbol 100 Button
on (release) { intromusic.stop(); gotoAndPlay (14); }
Symbol 103 Button
on (release) { intromusic.stop(); gotoAndPlay (15); }
Symbol 106 Button
on (release) { intromusic.stop(); gotoAndPlay (16); }
Symbol 109 Button
on (release) { intromusic.stop(); gotoAndPlay (17); }
Symbol 112 Button
on (release) { intromusic.stop(); gotoAndPlay (18); }
Symbol 115 Button
on (release) { intromusic.stop(); gotoAndPlay (19); }
Symbol 118 Button
on (release) { intromusic.stop(); gotoAndPlay (20); }
Symbol 119 Button
on (release) { gotoAndStop (7); }
Symbol 122 Button
on (release) { gotoAndStop (5); }
Symbol 125 Button
on (release) { intromusic.stop(); gotoAndPlay (21); }
Symbol 128 Button
on (release) { intromusic.stop(); gotoAndPlay (22); }
Symbol 131 Button
on (release) { intromusic.stop(); gotoAndPlay (23); }
Symbol 134 Button
on (release) { intromusic.stop(); gotoAndPlay (24); }
Symbol 137 Button
on (release) { intromusic.stop(); gotoAndPlay (25); }
Symbol 140 Button
on (release) { intromusic.stop(); gotoAndPlay (26); }
Symbol 143 Button
on (release) { intromusic.stop(); gotoAndPlay (27); }
Symbol 146 Button
on (release) { intromusic.stop(); gotoAndPlay (28); }
Symbol 149 Button
on (release) { intromusic.stop(); gotoAndPlay (29); }
Symbol 152 Button
on (release) { intromusic.stop(); gotoAndPlay (30); }
Symbol 153 Button
on (release) { gotoAndStop (6); }
Symbol 156 Button
on (release) { intromusic.stop(); gotoAndPlay (31); }
Symbol 159 Button
on (release) { intromusic.stop(); gotoAndPlay (32); }
Symbol 162 Button
on (release) { intromusic.stop(); gotoAndPlay (33); }
Symbol 165 Button
on (release) { intromusic.stop(); gotoAndPlay (34); }
Symbol 168 Button
on (release) { intromusic.stop(); gotoAndPlay (35); }
Symbol 171 Button
on (release) { intromusic.stop(); gotoAndPlay (36); }
Symbol 174 Button
on (release) { intromusic.stop(); gotoAndPlay (37); }
Symbol 177 Button
on (release) { intromusic.stop(); gotoAndPlay (38); }
Symbol 180 Button
on (release) { intromusic.stop(); gotoAndPlay (39); }
Symbol 183 Button
on (release) { intromusic.stop(); gotoAndPlay (40); }
Symbol 186 Button
on (release) { gotoAndPlay (5); }
Symbol 189 Button
on (release) { gotoAndPlay (4); }
Symbol 190 Button
on (release) { getURL ("http://www.247gamesonline.com/?utm_medium=brandedgames_external&utm_campaign=ww2towerdefence&utm_source=host&utm_content=ingame", _blank); }
Symbol 280 MovieClip Frame 1
stop();
Symbol 290 MovieClip Frame 2
stop();
Symbol 311 MovieClip Frame 1
Instance of Symbol 309 MovieClip "tl" in Symbol 311 MovieClip Frame 1
onClipEvent (enterFrame) { _x = ((190 + (_root.wave * 100)) + (_root.count * (100 / _root.maxCount))); }
Symbol 314 Button
on (press) { if (!_root.hasGameStarted) { return(undefined); } if ((_root.wave >= 0) && ((_root.wave - 1) <= (_root.waves.length - 1))) { _root.score = _root.score + (_root.wave * (_root.maxCount - _root.count)); _root.gold = _root.gold + int(_root.gold * 0.03); _root.count = 1; _root.newLevel(); _root.contero = _root.waves[_root.wave][0]; _root.nextwave._visible = 0; _root.nextwave._visible = false; } }
Instance of Symbol 320 MovieClip "UpgradeButton" in Symbol 324 MovieClip Frame 1
on (press) { _root.upgrade(); }
Symbol 336 MovieClip Frame 1
stop();
Symbol 402 Button
on (release) { var s = new Sound(this); s.setVolume(100); _root.mutero._visible = true; }
Symbol 404 Button
on (release) { var s = new Sound(this); s.setVolume(0); _root.mutero._visible = false; }
Symbol 406 Button
on (release) { if (_root.pauseyes == 1) { _root.pauseyes = 0; } else { _root.pauseyes = 1; } }
Symbol 409 Button
on (release) { _root.remove = true; _root.hasGameStarted = false; _root.inGameMessage("<font color='#ffffff'>Great Job! You did, you saved us all!</font>"); _root.gotoAndPlay(10); }
Symbol 414 Button
on (press) { if (!_root.hasGameStarted) { return(undefined); } if ((_root.wave >= 0) && ((_root.wave - 1) <= (_root.waves.length - 1))) { _root.score = _root.score + (_root.wave * (_root.maxCount - _root.count)); _root.gold = _root.gold + int(_root.gold * 0.03); _root.count = 1; _root.newLevel(); _root.contero = _root.waves[_root.wave][0]; trace("this wave is: " + _root.waves[_root.wave + 1][0]); _root.nextwave._visible = 0; _root.nextwave._visible = false; } }

Library Items

Symbol 1 Sound [intrito]
Symbol 2 Sound [metralleta]
Symbol 3 Sound [ambience]
Symbol 4 FontUsed by:5 294 305 317 322 323
Symbol 5 EditableTextUses:4Used by:13
Symbol 6 GraphicUsed by:13
Symbol 7 GraphicUsed by:8 282
Symbol 8 MovieClipUses:7Used by:13
Symbol 9 GraphicUsed by:10
Symbol 10 MovieClipUses:9Used by:11
Symbol 11 MovieClipUses:10Used by:13
Symbol 12 GraphicUsed by:13
Symbol 13 MovieClipUses:5 6 8 11 12Used by:Timeline
Symbol 14 GraphicUsed by:Timeline
Symbol 15 BitmapUsed by:16
Symbol 16 GraphicUses:15Used by:63
Symbol 17 BitmapUsed by:18
Symbol 18 GraphicUses:17Used by:39 63
Symbol 19 GraphicUsed by:28
Symbol 20 BitmapUsed by:21
Symbol 21 GraphicUses:20Used by:28
Symbol 22 BitmapUsed by:23
Symbol 23 GraphicUses:22Used by:28
Symbol 24 BitmapUsed by:25
Symbol 25 GraphicUses:24Used by:28
Symbol 26 BitmapUsed by:27
Symbol 27 GraphicUses:26Used by:28
Symbol 28 MovieClipUses:19 21 23 25 27Used by:39 63
Symbol 29 GraphicUsed by:30
Symbol 30 MovieClipUses:29Used by:39 63
Symbol 31 GraphicUsed by:38
Symbol 32 BitmapUsed by:33
Symbol 33 GraphicUses:32Used by:38
Symbol 34 BitmapUsed by:35
Symbol 35 GraphicUses:34Used by:38
Symbol 36 BitmapUsed by:37
Symbol 37 GraphicUses:36Used by:38
Symbol 38 MovieClipUses:31 33 35 37Used by:63
Symbol 39 MovieClipUses:18 28 30Used by:63
Symbol 40 BitmapUsed by:41
Symbol 41 GraphicUses:40Used by:42
Symbol 42 MovieClipUses:41Used by:62
Symbol 43 BitmapUsed by:44
Symbol 44 GraphicUses:43Used by:52
Symbol 45 GraphicUsed by:52
Symbol 46 ShapeTweeningUsed by:52
Symbol 47 GraphicUsed by:52
Symbol 48 GraphicUsed by:52
Symbol 49 GraphicUsed by:52
Symbol 50 GraphicUsed by:52
Symbol 51 GraphicUsed by:52
Symbol 52 MovieClipUses:44 45 46 47 48 49 50 51Used by:53
Symbol 53 MovieClipUses:52Used by:62
Symbol 54 BitmapUsed by:55 56 57 58 59
Symbol 55 GraphicUses:54Used by:61
Symbol 56 GraphicUses:54Used by:61
Symbol 57 GraphicUses:54Used by:61
Symbol 58 GraphicUses:54Used by:61
Symbol 59 GraphicUses:54Used by:61
Symbol 60 GraphicUsed by:61
Symbol 61 MovieClipUses:55 56 57 58 59 60Used by:62
Symbol 62 MovieClipUses:42 53 61Used by:63
Symbol 63 MovieClipUses:16 18 28 30 38 39 62Used by:Timeline
Symbol 64 GraphicUsed by:65
Symbol 65 ButtonUses:64Used by:Timeline
Symbol 66 BitmapUsed by:67
Symbol 67 GraphicUses:66Used by:68
Symbol 68 ButtonUses:67Used by:Timeline
Symbol 69 GraphicUsed by:77
Symbol 70 BitmapUsed by:71
Symbol 71 GraphicUses:70Used by:77
Symbol 72 BitmapUsed by:73
Symbol 73 GraphicUses:72Used by:77
Symbol 74 BitmapUsed by:76
Symbol 75 BitmapUsed by:76
Symbol 76 GraphicUses:74 75Used by:77
Symbol 77 MovieClipUses:69 71 73 76Used by:Timeline
Symbol 78 BitmapUsed by:79
Symbol 79 GraphicUses:78Used by:Timeline
Symbol 80 GraphicUsed by:81 82 186 189 190
Symbol 81 ButtonUses:80Used by:Timeline
Symbol 82 ButtonUses:80Used by:Timeline
Symbol 83 GraphicUsed by:Timeline
Symbol 84 FontUsed by:85 87 121 292 293 295 297 298 299 300 301 302 304 313 316 319 321 400 403 405 408 415 420 425 430 435 440 445 450 455 460 465 470 475 480 485 490 495 500 505 510 515 520 525 530 535 540 545 550 555
Symbol 85 TextUses:84Used by:Timeline
Symbol 86 GraphicUsed by:88 119
Symbol 87 TextUses:84Used by:88 119
Symbol 88 ButtonUses:86 87Used by:Timeline
Symbol 89 BitmapUsed by:90
Symbol 90 GraphicUses:89Used by:91
Symbol 91 ButtonUses:90Used by:Timeline
Symbol 92 BitmapUsed by:93
Symbol 93 GraphicUses:92Used by:94
Symbol 94 ButtonUses:93Used by:Timeline
Symbol 95 BitmapUsed by:96
Symbol 96 GraphicUses:95Used by:97
Symbol 97 ButtonUses:96Used by:Timeline
Symbol 98 BitmapUsed by:99
Symbol 99 GraphicUses:98Used by:100
Symbol 100 ButtonUses:99Used by:Timeline
Symbol 101 BitmapUsed by:102
Symbol 102 GraphicUses:101Used by:103
Symbol 103 ButtonUses:102Used by:Timeline
Symbol 104 BitmapUsed by:105
Symbol 105 GraphicUses:104Used by:106
Symbol 106 ButtonUses:105Used by:Timeline
Symbol 107 BitmapUsed by:108
Symbol 108 GraphicUses:107Used by:109
Symbol 109 ButtonUses:108Used by:Timeline
Symbol 110 BitmapUsed by:111
Symbol 111 GraphicUses:110Used by:112
Symbol 112 ButtonUses:111Used by:Timeline
Symbol 113 BitmapUsed by:114
Symbol 114 GraphicUses:113Used by:115
Symbol 115 ButtonUses:114Used by:Timeline
Symbol 116 BitmapUsed by:117
Symbol 117 GraphicUses:116Used by:118
Symbol 118 ButtonUses:117Used by:Timeline
Symbol 119 ButtonUses:86 87Used by:Timeline
Symbol 120 GraphicUsed by:122 153
Symbol 121 TextUses:84Used by:122 153
Symbol 122 ButtonUses:120 121Used by:Timeline
Symbol 123 BitmapUsed by:124
Symbol 124 GraphicUses:123Used by:125
Symbol 125 ButtonUses:124Used by:Timeline
Symbol 126 BitmapUsed by:127
Symbol 127 GraphicUses:126Used by:128
Symbol 128 ButtonUses:127Used by:Timeline
Symbol 129 BitmapUsed by:130
Symbol 130 GraphicUses:129Used by:131
Symbol 131 ButtonUses:130Used by:Timeline
Symbol 132 BitmapUsed by:133
Symbol 133 GraphicUses:132Used by:134
Symbol 134 ButtonUses:133Used by:Timeline
Symbol 135 BitmapUsed by:136
Symbol 136 GraphicUses:135Used by:137
Symbol 137 ButtonUses:136Used by:Timeline
Symbol 138 BitmapUsed by:139
Symbol 139 GraphicUses:138Used by:140
Symbol 140 ButtonUses:139Used by:Timeline
Symbol 141 BitmapUsed by:142
Symbol 142 GraphicUses:141Used by:143
Symbol 143 ButtonUses:142Used by:Timeline
Symbol 144 BitmapUsed by:145
Symbol 145 GraphicUses:144Used by:146
Symbol 146 ButtonUses:145Used by:Timeline
Symbol 147 BitmapUsed by:148
Symbol 148 GraphicUses:147Used by:149
Symbol 149 ButtonUses:148Used by:Timeline
Symbol 150 BitmapUsed by:151
Symbol 151 GraphicUses:150Used by:152
Symbol 152 ButtonUses:151Used by:Timeline
Symbol 153 ButtonUses:120 121Used by:Timeline
Symbol 154 BitmapUsed by:155
Symbol 155 GraphicUses:154Used by:156
Symbol 156 ButtonUses:155Used by:Timeline
Symbol 157 BitmapUsed by:158
Symbol 158 GraphicUses:157Used by:159
Symbol 159 ButtonUses:158Used by:Timeline
Symbol 160 BitmapUsed by:161
Symbol 161 GraphicUses:160Used by:162
Symbol 162 ButtonUses:161Used by:Timeline
Symbol 163 BitmapUsed by:164
Symbol 164 GraphicUses:163Used by:165
Symbol 165 ButtonUses:164Used by:Timeline
Symbol 166 BitmapUsed by:167
Symbol 167 GraphicUses:166Used by:168
Symbol 168 ButtonUses:167Used by:Timeline
Symbol 169 BitmapUsed by:170
Symbol 170 GraphicUses:169Used by:171
Symbol 171 ButtonUses:170Used by:Timeline
Symbol 172 BitmapUsed by:173
Symbol 173 GraphicUses:172Used by:174
Symbol 174 ButtonUses:173Used by:Timeline
Symbol 175 BitmapUsed by:176
Symbol 176 GraphicUses:175Used by:177
Symbol 177 ButtonUses:176Used by:Timeline
Symbol 178 BitmapUsed by:179
Symbol 179 GraphicUses:178Used by:180
Symbol 180 ButtonUses:179Used by:Timeline
Symbol 181 BitmapUsed by:182
Symbol 182 GraphicUses:181Used by:183
Symbol 183 ButtonUses:182Used by:Timeline
Symbol 184 BitmapUsed by:185
Symbol 185 GraphicUses:184Used by:Timeline
Symbol 186 ButtonUses:80Used by:Timeline
Symbol 187 BitmapUsed by:188
Symbol 188 GraphicUses:187Used by:Timeline
Symbol 189 ButtonUses:80Used by:Timeline
Symbol 190 ButtonUses:80Used by:Timeline
Symbol 191 BitmapUsed by:192
Symbol 192 GraphicUses:191Used by:Timeline
Symbol 193 BitmapUsed by:194
Symbol 194 GraphicUses:193Used by:Timeline
Symbol 195 GraphicUsed by:196
Symbol 196 MovieClipUses:195Used by:Timeline
Symbol 197 GraphicUsed by:198  Timeline
Symbol 198 MovieClipUses:197Used by:Timeline
Symbol 199 BitmapUsed by:200
Symbol 200 GraphicUses:199Used by:201
Symbol 201 MovieClipUses:200Used by:280
Symbol 202 BitmapUsed by:203
Symbol 203 GraphicUses:202Used by:204
Symbol 204 MovieClipUses:203Used by:280
Symbol 205 BitmapUsed by:206
Symbol 206 GraphicUses:205Used by:207
Symbol 207 MovieClipUses:206Used by:280
Symbol 208 BitmapUsed by:209
Symbol 209 GraphicUses:208Used by:210
Symbol 210 MovieClipUses:209Used by:280
Symbol 211 BitmapUsed by:212
Symbol 212 GraphicUses:211Used by:213
Symbol 213 MovieClipUses:212Used by:280
Symbol 214 BitmapUsed by:215
Symbol 215 GraphicUses:214Used by:216
Symbol 216 MovieClipUses:215Used by:280
Symbol 217 BitmapUsed by:218
Symbol 218 GraphicUses:217Used by:219
Symbol 219 MovieClipUses:218Used by:280
Symbol 220 BitmapUsed by:221
Symbol 221 GraphicUses:220Used by:222
Symbol 222 MovieClipUses:221Used by:280
Symbol 223 BitmapUsed by:224
Symbol 224 GraphicUses:223Used by:225
Symbol 225 MovieClipUses:224Used by:280
Symbol 226 BitmapUsed by:227
Symbol 227 GraphicUses:226Used by:228
Symbol 228 MovieClipUses:227Used by:280
Symbol 229 BitmapUsed by:230
Symbol 230 GraphicUses:229Used by:231
Symbol 231 MovieClipUses:230Used by:280
Symbol 232 BitmapUsed by:233
Symbol 233 GraphicUses:232Used by:234
Symbol 234 MovieClipUses:233Used by:280
Symbol 235 BitmapUsed by:236
Symbol 236 GraphicUses:235Used by:237
Symbol 237 MovieClipUses:236Used by:280
Symbol 238 BitmapUsed by:239
Symbol 239 GraphicUses:238Used by:240
Symbol 240 MovieClipUses:239Used by:280
Symbol 241 BitmapUsed by:242
Symbol 242 GraphicUses:241Used by:243
Symbol 243 MovieClipUses:242Used by:280
Symbol 244 BitmapUsed by:245
Symbol 245 GraphicUses:244Used by:246
Symbol 246 MovieClipUses:245Used by:280
Symbol 247 BitmapUsed by:248
Symbol 248 GraphicUses:247Used by:249
Symbol 249 MovieClipUses:248Used by:280
Symbol 250 BitmapUsed by:251
Symbol 251 GraphicUses:250Used by:252
Symbol 252 MovieClipUses:251Used by:280
Symbol 253 BitmapUsed by:254
Symbol 254 GraphicUses:253Used by:255
Symbol 255 MovieClipUses:254Used by:280
Symbol 256 BitmapUsed by:257
Symbol 257 GraphicUses:256Used by:258
Symbol 258 MovieClipUses:257Used by:280
Symbol 259 BitmapUsed by:260
Symbol 260 GraphicUses:259Used by:261
Symbol 261 MovieClipUses:260Used by:280
Symbol 262 BitmapUsed by:263
Symbol 263 GraphicUses:262Used by:264
Symbol 264 MovieClipUses:263Used by:280
Symbol 265 BitmapUsed by:266
Symbol 266 GraphicUses:265Used by:267
Symbol 267 MovieClipUses:266Used by:280
Symbol 268 BitmapUsed by:269
Symbol 269 GraphicUses:268Used by:270
Symbol 270 MovieClipUses:269Used by:280
Symbol 271 BitmapUsed by:272
Symbol 272 GraphicUses:271Used by:273
Symbol 273 MovieClipUses:272Used by:280
Symbol 274 BitmapUsed by:275
Symbol 275 GraphicUses:274Used by:276
Symbol 276 MovieClipUses:275Used by:280
Symbol 277 BitmapUsed by:278
Symbol 278 GraphicUses:277Used by:279
Symbol 279 MovieClipUses:278Used by:280
Symbol 280 MovieClipUses:201 204 207 210 213 216 219 222 225 228 231 234 237 240 243 246 249 252 255 258 261 264 267 270 273 276 279Used by:284
Symbol 281 GraphicUsed by:283
Symbol 282 MovieClipUses:7Used by:283
Symbol 283 MovieClipUses:281 282Used by:284
Symbol 284 MovieClipUses:280 283Used by:Timeline
Symbol 285 BitmapUsed by:286
Symbol 286 GraphicUses:285Used by:Timeline
Symbol 287 GraphicUsed by:290
Symbol 288 FontUsed by:289
Symbol 289 EditableTextUses:288Used by:290
Symbol 290 MovieClipUses:287 289Used by:Timeline
Symbol 291 GraphicUsed by:Timeline
Symbol 292 EditableTextUses:84Used by:Timeline
Symbol 293 EditableTextUses:84Used by:296
Symbol 294 EditableTextUses:4Used by:296
Symbol 295 EditableTextUses:84Used by:296
Symbol 296 MovieClipUses:293 294 295Used by:Timeline
Symbol 297 TextUses:84Used by:303
Symbol 298 EditableTextUses:84Used by:303
Symbol 299 TextUses:84Used by:303
Symbol 300 EditableTextUses:84Used by:303
Symbol 301 TextUses:84Used by:303
Symbol 302 EditableTextUses:84Used by:303
Symbol 303 MovieClipUses:297 298 299 300 301 302Used by:Timeline
Symbol 304 EditableTextUses:84Used by:306
Symbol 305 EditableTextUses:4Used by:306
Symbol 306 MovieClipUses:304 305Used by:Timeline
Symbol 307 GraphicUsed by:311
Symbol 308 GraphicUsed by:309
Symbol 309 MovieClipUses:308Used by:311
Symbol 310 GraphicUsed by:311
Symbol 311 MovieClipUses:307 309 310Used by:Timeline
Symbol 312 GraphicUsed by:314 414
Symbol 313 TextUses:84Used by:314 414
Symbol 314 ButtonUses:312 313Used by:Timeline
Symbol 315 GraphicUsed by:324
Symbol 316 TextUses:84Used by:324
Symbol 317 EditableTextUses:4Used by:324
Symbol 318 GraphicUsed by:320
Symbol 319 EditableTextUses:84Used by:320
Symbol 320 MovieClipUses:318 319Used by:324
Symbol 321 TextUses:84Used by:324
Symbol 322 EditableTextUses:4Used by:324
Symbol 323 TextUses:4Used by:324
Symbol 324 MovieClipUses:315 316 317 320 321 322 323Used by:Timeline
Symbol 325 GraphicUsed by:329 330 348 354 358 359 368 369 383 385 394 396
Symbol 326 BitmapUsed by:327
Symbol 327 GraphicUses:326Used by:328
Symbol 328 MovieClipUses:327Used by:329 330
Symbol 329 MovieClipUses:325 328Used by:Timeline
Symbol 330 MovieClipUses:325 328Used by:Timeline
Symbol 331 GraphicUsed by:333
Symbol 332 GraphicUsed by:333
Symbol 333 MovieClipUses:331 332Used by:Timeline
Symbol 334 GraphicUsed by:336
Symbol 335 GraphicUsed by:336
Symbol 336 MovieClipUses:334 335Used by:Timeline
Symbol 337 BitmapUsed by:338
Symbol 338 GraphicUses:337Used by:339
Symbol 339 MovieClipUses:338Used by:340
Symbol 340 MovieClipUses:339Used by:Timeline
Symbol 341 BitmapUsed by:342
Symbol 342 GraphicUses:341Used by:343
Symbol 343 MovieClipUses:342Used by:344 353 364 370 390 398
Symbol 344 MovieClipUses:343Used by:Timeline
Symbol 345 BitmapUsed by:346
Symbol 346 GraphicUses:345Used by:347
Symbol 347 MovieClipUses:346Used by:348 354
Symbol 348 MovieClipUses:325 347Used by:Timeline
Symbol 349 BitmapUsed by:350
Symbol 350 GraphicUses:349Used by:351
Symbol 351 MovieClipUses:350Used by:352
Symbol 352 MovieClipUses:351Used by:Timeline
Symbol 353 MovieClipUses:343Used by:Timeline
Symbol 354 MovieClipUses:325 347Used by:Timeline
Symbol 355 BitmapUsed by:356
Symbol 356 GraphicUses:355Used by:357
Symbol 357 MovieClipUses:356Used by:358 359
Symbol 358 MovieClipUses:325 357Used by:Timeline
Symbol 359 MovieClipUses:325 357Used by:Timeline
Symbol 360 BitmapUsed by:361
Symbol 361 GraphicUses:360Used by:362
Symbol 362 MovieClipUses:361Used by:363
Symbol 363 MovieClipUses:362Used by:Timeline
Symbol 364 MovieClipUses:343Used by:Timeline
Symbol 365 BitmapUsed by:366
Symbol 366 GraphicUses:365Used by:367
Symbol 367 MovieClipUses:366Used by:368 369
Symbol 368 MovieClipUses:325 367Used by:Timeline
Symbol 369 MovieClipUses:325 367Used by:Timeline
Symbol 370 MovieClipUses:343Used by:Timeline
Symbol 371 BitmapUsed by:372
Symbol 372 GraphicUses:371Used by:373
Symbol 373 MovieClipUses:372Used by:374
Symbol 374 MovieClipUses:373Used by:Timeline
Symbol 375 GraphicUsed by:376 377 378 379 384 395
Symbol 376 MovieClipUses:375Used by:Timeline
Symbol 377 MovieClipUses:375Used by:Timeline
Symbol 378 MovieClipUses:375Used by:Timeline
Symbol 379 MovieClipUses:375Used by:Timeline
Symbol 380 BitmapUsed by:381
Symbol 381 GraphicUses:380Used by:382
Symbol 382 MovieClipUses:381Used by:383 385
Symbol 383 MovieClipUses:325 382Used by:Timeline
Symbol 384 MovieClipUses:375Used by:Timeline
Symbol 385 MovieClipUses:325 382Used by:Timeline
Symbol 386 BitmapUsed by:387
Symbol 387 GraphicUses:386Used by:388
Symbol 388 MovieClipUses:387Used by:389 397
Symbol 389 MovieClipUses:388Used by:Timeline
Symbol 390 MovieClipUses:343Used by:Timeline
Symbol 391 BitmapUsed by:392
Symbol 392 GraphicUses:391Used by:393
Symbol 393 MovieClipUses:392Used by:394 396
Symbol 394 MovieClipUses:325 393Used by:Timeline
Symbol 395 MovieClipUses:375Used by:Timeline
Symbol 396 MovieClipUses:325 393Used by:Timeline
Symbol 397 MovieClipUses:388Used by:Timeline
Symbol 398 MovieClipUses:343Used by:Timeline
Symbol 399 GraphicUsed by:402 404
Symbol 400 TextUses:84Used by:402
Symbol 401 GraphicUsed by:402 404
Symbol 402 ButtonUses:399 400 401Used by:Timeline
Symbol 403 TextUses:84Used by:404
Symbol 404 ButtonUses:399 403 401Used by:Timeline
Symbol 405 TextUses:84Used by:406
Symbol 406 ButtonUses:405Used by:Timeline
Symbol 407 GraphicUsed by:409
Symbol 408 TextUses:84Used by:409
Symbol 409 ButtonUses:407 408Used by:Timeline
Symbol 410 BitmapUsed by:411
Symbol 411 GraphicUses:410Used by:Timeline
Symbol 412 GraphicUsed by:413
Symbol 413 MovieClipUses:412Used by:Timeline
Symbol 414 ButtonUses:312 313Used by:Timeline
Symbol 415 EditableTextUses:84Used by:Timeline
Symbol 416 BitmapUsed by:417
Symbol 417 GraphicUses:416Used by:Timeline
Symbol 418 GraphicUsed by:419
Symbol 419 MovieClipUses:418Used by:Timeline
Symbol 420 EditableTextUses:84Used by:Timeline
Symbol 421 BitmapUsed by:422
Symbol 422 GraphicUses:421Used by:Timeline
Symbol 423 GraphicUsed by:424
Symbol 424 MovieClipUses:423Used by:Timeline
Symbol 425 EditableTextUses:84Used by:Timeline
Symbol 426 BitmapUsed by:427
Symbol 427 GraphicUses:426Used by:Timeline
Symbol 428 GraphicUsed by:429
Symbol 429 MovieClipUses:428Used by:Timeline
Symbol 430 EditableTextUses:84Used by:Timeline
Symbol 431 BitmapUsed by:432
Symbol 432 GraphicUses:431Used by:Timeline
Symbol 433 GraphicUsed by:434
Symbol 434 MovieClipUses:433Used by:Timeline
Symbol 435 EditableTextUses:84Used by:Timeline
Symbol 436 BitmapUsed by:437
Symbol 437 GraphicUses:436Used by:Timeline
Symbol 438 GraphicUsed by:439
Symbol 439 MovieClipUses:438Used by:Timeline
Symbol 440 EditableTextUses:84Used by:Timeline
Symbol 441 BitmapUsed by:442
Symbol 442 GraphicUses:441Used by:Timeline
Symbol 443 GraphicUsed by:444
Symbol 444 MovieClipUses:443Used by:Timeline
Symbol 445 EditableTextUses:84Used by:Timeline
Symbol 446 BitmapUsed by:447
Symbol 447 GraphicUses:446Used by:Timeline
Symbol 448 GraphicUsed by:449
Symbol 449 MovieClipUses:448Used by:Timeline
Symbol 450 EditableTextUses:84Used by:Timeline
Symbol 451 BitmapUsed by:452
Symbol 452 GraphicUses:451Used by:Timeline
Symbol 453 GraphicUsed by:454
Symbol 454 MovieClipUses:453Used by:Timeline
Symbol 455 EditableTextUses:84Used by:Timeline
Symbol 456 BitmapUsed by:457
Symbol 457 GraphicUses:456Used by:Timeline
Symbol 458 GraphicUsed by:459
Symbol 459 MovieClipUses:458Used by:Timeline
Symbol 460 EditableTextUses:84Used by:Timeline
Symbol 461 BitmapUsed by:462
Symbol 462 GraphicUses:461Used by:Timeline
Symbol 463 GraphicUsed by:464
Symbol 464 MovieClipUses:463Used by:Timeline
Symbol 465 EditableTextUses:84Used by:Timeline
Symbol 466 BitmapUsed by:467
Symbol 467 GraphicUses:466Used by:Timeline
Symbol 468 GraphicUsed by:469
Symbol 469 MovieClipUses:468Used by:Timeline
Symbol 470 EditableTextUses:84Used by:Timeline
Symbol 471 BitmapUsed by:472
Symbol 472 GraphicUses:471Used by:Timeline
Symbol 473 GraphicUsed by:474
Symbol 474 MovieClipUses:473Used by:Timeline
Symbol 475 EditableTextUses:84Used by:Timeline
Symbol 476 BitmapUsed by:477
Symbol 477 GraphicUses:476Used by:Timeline
Symbol 478 GraphicUsed by:479
Symbol 479 MovieClipUses:478Used by:Timeline
Symbol 480 EditableTextUses:84Used by:Timeline
Symbol 481 BitmapUsed by:482
Symbol 482 GraphicUses:481Used by:Timeline
Symbol 483 GraphicUsed by:484
Symbol 484 MovieClipUses:483Used by:Timeline
Symbol 485 EditableTextUses:84Used by:Timeline
Symbol 486 BitmapUsed by:487
Symbol 487 GraphicUses:486Used by:Timeline
Symbol 488 GraphicUsed by:489
Symbol 489 MovieClipUses:488Used by:Timeline
Symbol 490 EditableTextUses:84Used by:Timeline
Symbol 491 BitmapUsed by:492
Symbol 492 GraphicUses:491Used by:Timeline
Symbol 493 GraphicUsed by:494
Symbol 494 MovieClipUses:493Used by:Timeline
Symbol 495 EditableTextUses:84Used by:Timeline
Symbol 496 BitmapUsed by:497
Symbol 497 GraphicUses:496Used by:Timeline
Symbol 498 GraphicUsed by:499
Symbol 499 MovieClipUses:498Used by:Timeline
Symbol 500 EditableTextUses:84Used by:Timeline
Symbol 501 BitmapUsed by:502
Symbol 502 GraphicUses:501Used by:Timeline
Symbol 503 GraphicUsed by:504
Symbol 504 MovieClipUses:503Used by:Timeline
Symbol 505 EditableTextUses:84Used by:Timeline
Symbol 506 BitmapUsed by:507
Symbol 507 GraphicUses:506Used by:Timeline
Symbol 508 GraphicUsed by:509
Symbol 509 MovieClipUses:508Used by:Timeline
Symbol 510 EditableTextUses:84Used by:Timeline
Symbol 511 BitmapUsed by:512
Symbol 512 GraphicUses:511Used by:Timeline
Symbol 513 GraphicUsed by:514
Symbol 514 MovieClipUses:513Used by:Timeline
Symbol 515 EditableTextUses:84Used by:Timeline
Symbol 516 BitmapUsed by:517
Symbol 517 GraphicUses:516Used by:Timeline
Symbol 518 GraphicUsed by:519
Symbol 519 MovieClipUses:518Used by:Timeline
Symbol 520 EditableTextUses:84Used by:Timeline
Symbol 521 BitmapUsed by:522
Symbol 522 GraphicUses:521Used by:Timeline
Symbol 523 GraphicUsed by:524
Symbol 524 MovieClipUses:523Used by:Timeline
Symbol 525 EditableTextUses:84Used by:Timeline
Symbol 526 BitmapUsed by:527
Symbol 527 GraphicUses:526Used by:Timeline
Symbol 528 GraphicUsed by:529
Symbol 529 MovieClipUses:528Used by:Timeline
Symbol 530 EditableTextUses:84Used by:Timeline
Symbol 531 BitmapUsed by:532
Symbol 532 GraphicUses:531Used by:Timeline
Symbol 533 GraphicUsed by:534
Symbol 534 MovieClipUses:533Used by:Timeline
Symbol 535 EditableTextUses:84Used by:Timeline
Symbol 536 BitmapUsed by:537
Symbol 537 GraphicUses:536Used by:Timeline
Symbol 538 GraphicUsed by:539
Symbol 539 MovieClipUses:538Used by:Timeline
Symbol 540 EditableTextUses:84Used by:Timeline
Symbol 541 BitmapUsed by:542
Symbol 542 GraphicUses:541Used by:Timeline
Symbol 543 GraphicUsed by:544
Symbol 544 MovieClipUses:543Used by:Timeline
Symbol 545 EditableTextUses:84Used by:Timeline
Symbol 546 BitmapUsed by:547
Symbol 547 GraphicUses:546Used by:Timeline
Symbol 548 GraphicUsed by:549
Symbol 549 MovieClipUses:548Used by:Timeline
Symbol 550 EditableTextUses:84Used by:Timeline
Symbol 551 BitmapUsed by:552
Symbol 552 GraphicUses:551Used by:Timeline
Symbol 553 GraphicUsed by:554
Symbol 554 MovieClipUses:553Used by:Timeline
Symbol 555 EditableTextUses:84Used by:Timeline

Instance Names

"grass"Frame 11Symbol 196 MovieClip
"deselect"Frame 11Symbol 198 MovieClip
"creep1"Frame 11Symbol 284 MovieClip
"wp1"Frame 11Symbol 290 MovieClip
"wp2"Frame 11Symbol 290 MovieClip
"wp3"Frame 11Symbol 290 MovieClip
"wp4"Frame 11Symbol 290 MovieClip
"wp5"Frame 11Symbol 290 MovieClip
"wp6"Frame 11Symbol 290 MovieClip
"wp7"Frame 11Symbol 290 MovieClip
"wp8"Frame 11Symbol 290 MovieClip
"ingame_message"Frame 11Symbol 292 EditableText
"info_message"Frame 11Symbol 296 MovieClip
"InfoBar"Frame 11Symbol 303 MovieClip
"instructions"Frame 11Symbol 306 MovieClip
"timeline"Frame 11Symbol 311 MovieClip
"nextwave"Frame 11Symbol 314 Button
"UpgradeTowerInfo"Frame 11Symbol 324 MovieClip
"tower_cannon"Frame 11Symbol 330 MovieClip
"marker"Frame 11Symbol 333 MovieClip
"ranger"Frame 11Symbol 336 MovieClip
"projectile_cannonball"Frame 11Symbol 340 MovieClip
"projectile_cannonball_explosion"Frame 11Symbol 344 MovieClip
"projectile_fire"Frame 11Symbol 352 MovieClip
"projectile_fire_explosion"Frame 11Symbol 353 MovieClip
"tower_fire"Frame 11Symbol 354 MovieClip
"tower_water"Frame 11Symbol 359 MovieClip
"projectile_water"Frame 11Symbol 363 MovieClip
"projectile_water_explosion"Frame 11Symbol 364 MovieClip
"tower_poison"Frame 11Symbol 369 MovieClip
"projectile_poison_explosion"Frame 11Symbol 370 MovieClip
"projectile_poison"Frame 11Symbol 374 MovieClip
"tower_five"Frame 11Symbol 385 MovieClip
"projectile_five"Frame 11Symbol 389 MovieClip
"projectile_five_explosion"Frame 11Symbol 390 MovieClip
"tower_six"Frame 11Symbol 396 MovieClip
"projectile_six"Frame 11Symbol 397 MovieClip
"projectile_six_explosion"Frame 11Symbol 398 MovieClip
"desmutero"Frame 11Symbol 402 Button
"mutero"Frame 11Symbol 404 Button
"theend"Frame 11Symbol 409 Button
"grass"Frame 12Symbol 413 MovieClip
"timeline"Frame 12Symbol 311 MovieClip
"nextwave"Frame 12Symbol 414 Button
"ingame_message"Frame 12Symbol 415 EditableText
"tower_cannon"Frame 12Symbol 330 MovieClip
"tower_fire"Frame 12Symbol 354 MovieClip
"tower_water"Frame 12Symbol 359 MovieClip
"tower_poison"Frame 12Symbol 369 MovieClip
"tower_five"Frame 12Symbol 385 MovieClip
"tower_six"Frame 12Symbol 396 MovieClip
"grass"Frame 13Symbol 419 MovieClip
"ingame_message"Frame 13Symbol 420 EditableText
"grass"Frame 14Symbol 424 MovieClip
"ingame_message"Frame 14Symbol 425 EditableText
"grass"Frame 15Symbol 429 MovieClip
"ingame_message"Frame 15Symbol 430 EditableText
"grass"Frame 16Symbol 434 MovieClip
"ingame_message"Frame 16Symbol 435 EditableText
"grass"Frame 17Symbol 439 MovieClip
"wp9"Frame 17Symbol 290 MovieClip
"wp10"Frame 17Symbol 290 MovieClip
"ingame_message"Frame 17Symbol 440 EditableText
"grass"Frame 18Symbol 444 MovieClip
"ingame_message"Frame 18Symbol 445 EditableText
"grass"Frame 19Symbol 449 MovieClip
"ingame_message"Frame 19Symbol 450 EditableText
"grass"Frame 20Symbol 454 MovieClip
"wp9"Frame 20Symbol 290 MovieClip
"ingame_message"Frame 20Symbol 455 EditableText
"grass"Frame 21Symbol 459 MovieClip
"wp10"Frame 21Symbol 290 MovieClip
"wp11"Frame 21Symbol 290 MovieClip
"wp12"Frame 21Symbol 290 MovieClip
"wp13"Frame 21Symbol 290 MovieClip
"wp14"Frame 21Symbol 290 MovieClip
"ingame_message"Frame 21Symbol 460 EditableText
"grass"Frame 22Symbol 464 MovieClip
"ingame_message"Frame 22Symbol 465 EditableText
"grass"Frame 23Symbol 469 MovieClip
"ingame_message"Frame 23Symbol 470 EditableText
"grass"Frame 24Symbol 474 MovieClip
"ingame_message"Frame 24Symbol 475 EditableText
"grass"Frame 25Symbol 479 MovieClip
"wp9"Frame 25Symbol 290 MovieClip
"wp10"Frame 25Symbol 290 MovieClip
"ingame_message"Frame 25Symbol 480 EditableText
"grass"Frame 26Symbol 484 MovieClip
"ingame_message"Frame 26Symbol 485 EditableText
"grass"Frame 27Symbol 489 MovieClip
"ingame_message"Frame 27Symbol 490 EditableText
"grass"Frame 28Symbol 494 MovieClip
"ingame_message"Frame 28Symbol 495 EditableText
"grass"Frame 29Symbol 499 MovieClip
"ingame_message"Frame 29Symbol 500 EditableText
"grass"Frame 30Symbol 504 MovieClip
"wp8"Frame 30Symbol 290 MovieClip
"wp9"Frame 30Symbol 290 MovieClip
"wp10"Frame 30Symbol 290 MovieClip
"wp11"Frame 30Symbol 290 MovieClip
"ingame_message"Frame 30Symbol 505 EditableText
"grass"Frame 31Symbol 509 MovieClip
"ingame_message"Frame 31Symbol 510 EditableText
"grass"Frame 32Symbol 514 MovieClip
"wp7"Frame 32Symbol 290 MovieClip
"wp8"Frame 32Symbol 290 MovieClip
"ingame_message"Frame 32Symbol 515 EditableText
"grass"Frame 33Symbol 519 MovieClip
"ingame_message"Frame 33Symbol 520 EditableText
"grass"Frame 34Symbol 524 MovieClip
"wp7"Frame 34Symbol 290 MovieClip
"wp8"Frame 34Symbol 290 MovieClip
"wp9"Frame 34Symbol 290 MovieClip
"ingame_message"Frame 34Symbol 525 EditableText
"grass"Frame 35Symbol 529 MovieClip
"ingame_message"Frame 35Symbol 530 EditableText
"grass"Frame 36Symbol 534 MovieClip
"ingame_message"Frame 36Symbol 535 EditableText
"grass"Frame 37Symbol 539 MovieClip
"wp9"Frame 37Symbol 290 MovieClip
"wp10"Frame 37Symbol 290 MovieClip
"ingame_message"Frame 37Symbol 540 EditableText
"grass"Frame 38Symbol 544 MovieClip
"ingame_message"Frame 38Symbol 545 EditableText
"grass"Frame 39Symbol 549 MovieClip
"wp11"Frame 39Symbol 290 MovieClip
"ingame_message"Frame 39Symbol 550 EditableText
"grass"Frame 40Symbol 554 MovieClip
"ingame_message"Frame 40Symbol 555 EditableText
"text_info"Symbol 13 MovieClip Frame 1Symbol 5 EditableText
"bar_mask"Symbol 13 MovieClip Frame 1Symbol 8 MovieClip
"health"Symbol 283 MovieClip Frame 1Symbol 282 MovieClip
"creep"Symbol 284 MovieClip Frame 1Symbol 280 MovieClip
"health_bar"Symbol 284 MovieClip Frame 1Symbol 283 MovieClip
"title"Symbol 296 MovieClip Frame 1Symbol 293 EditableText
"desc"Symbol 296 MovieClip Frame 1Symbol 294 EditableText
"type"Symbol 296 MovieClip Frame 1Symbol 295 EditableText
"GoldAmount"Symbol 303 MovieClip Frame 1Symbol 298 EditableText
"ScoreAmount"Symbol 303 MovieClip Frame 1Symbol 300 EditableText
"HealthAmount"Symbol 303 MovieClip Frame 1Symbol 302 EditableText
"title"Symbol 306 MovieClip Frame 1Symbol 304 EditableText
"desc"Symbol 306 MovieClip Frame 1Symbol 305 EditableText
"tl"Symbol 311 MovieClip Frame 1Symbol 309 MovieClip
"UpgradeButtonText"Symbol 320 MovieClip Frame 1Symbol 319 EditableText
"TowerInfoText"Symbol 324 MovieClip Frame 1Symbol 317 EditableText
"UpgradeButton"Symbol 324 MovieClip Frame 1Symbol 320 MovieClip
"UpgradeInfoText"Symbol 324 MovieClip Frame 1Symbol 322 EditableText

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata not present, AS1/AS2.
ExportAssets (56)Timeline Frame 1Symbol 1 as "intrito"
ExportAssets (56)Timeline Frame 1Symbol 2 as "metralleta"
ExportAssets (56)Timeline Frame 1Symbol 3 as "ambience"




http://swfchan.com/25/124905/info.shtml
Created: 28/2 -2019 21:08:47 Last modified: 28/2 -2019 21:08:47 Server time: 22/12 -2024 21:16:37