Section 1
//Action_4 (Besieged_fla.Action_4)
package Besieged_fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class Action_4 extends MovieClip {
public function Action_4(){
addFrameScript(0, frame1);
}
public function onComplete(_arg1:Event):void{
MovieClip(parent).gotoAndPlay("loaded");
}
public function progressHandler(_arg1:ProgressEvent):void{
var _local2:int;
_local2 = Math.round(((_arg1.target.bytesLoaded / _arg1.target.bytesTotal) * 100));
MovieClip(parent).gotoAndStop(_local2);
}
function frame1(){
MovieClip(root).stop();
if (root.loaderInfo.bytesLoaded == root.loaderInfo.bytesTotal){
MovieClip(parent).gotoAndPlay("loaded");
};
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, progressHandler);
root.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
}
}
}//package Besieged_fla
Section 2
//dynamicAu_132 (Besieged_fla.dynamicAu_132)
package Besieged_fla {
import flash.display.*;
import flash.text.*;
public dynamic class dynamicAu_132 extends MovieClip {
public var auIconText:TextField;
}
}//package Besieged_fla
Section 3
//dynamicXP_134 (Besieged_fla.dynamicXP_134)
package Besieged_fla {
import flash.display.*;
import flash.text.*;
public dynamic class dynamicXP_134 extends MovieClip {
public var xpIconText:TextField;
}
}//package Besieged_fla
Section 4
//enemytime_211 (Besieged_fla.enemytime_211)
package Besieged_fla {
import flash.display.*;
public dynamic class enemytime_211 extends MovieClip {
public var timeBar:MovieClip;
public var maskBar:MovieClip;
}
}//package Besieged_fla
Section 5
//flags_112 (Besieged_fla.flags_112)
package Besieged_fla {
import flash.display.*;
public dynamic class flags_112 extends MovieClip {
public function flags_112(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Besieged_fla
Section 6
//Instructions_193 (Besieged_fla.Instructions_193)
package Besieged_fla {
import flash.events.*;
import flash.display.*;
public dynamic class Instructions_193 extends MovieClip {
public var towersIns:SimpleButton;
public var missionObjectives:SimpleButton;
public var awardsIns:SimpleButton;
public var structuresIns:SimpleButton;
public var goldAndResources:SimpleButton;
public var howToPlay:SimpleButton;
public var enemiesIns:SimpleButton;
public var castle:SimpleButton;
public function Instructions_193(){
addFrameScript(0, frame1);
}
public function gotoMissionObjectives(_arg1:MouseEvent):void{
gotoAndStop("missionobjectives");
}
public function gotoGoldAndResources(_arg1:MouseEvent):void{
gotoAndStop("goldandresources");
}
public function gotoAwardsIns(_arg1:MouseEvent):void{
gotoAndStop("awards");
}
public function gotoCastle(_arg1:MouseEvent):void{
gotoAndStop("castle");
}
function frame1(){
howToPlay.addEventListener(MouseEvent.MOUSE_UP, gotoHowToPlay, false, 0, true);
castle.addEventListener(MouseEvent.MOUSE_UP, gotoCastle, false, 0, true);
towersIns.addEventListener(MouseEvent.MOUSE_UP, gotoTowersIns, false, 0, true);
structuresIns.addEventListener(MouseEvent.MOUSE_UP, gotoStructuresIns, false, 0, true);
goldAndResources.addEventListener(MouseEvent.MOUSE_UP, gotoGoldAndResources, false, 0, true);
enemiesIns.addEventListener(MouseEvent.MOUSE_UP, gotoEnemiesIns, false, 0, true);
missionObjectives.addEventListener(MouseEvent.MOUSE_UP, gotoMissionObjectives, false, 0, true);
awardsIns.addEventListener(MouseEvent.MOUSE_UP, gotoAwardsIns, false, 0, true);
stop();
}
public function gotoEnemiesIns(_arg1:MouseEvent):void{
gotoAndStop("enemies");
}
public function gotoHowToPlay(_arg1:MouseEvent):void{
gotoAndStop("howtoplay");
}
public function gotoStructuresIns(_arg1:MouseEvent):void{
gotoAndStop("structures");
}
public function gotoTowersIns(_arg1:MouseEvent):void{
gotoAndStop("towers");
}
}
}//package Besieged_fla
Section 7
//levelsUnlockedMC_176 (Besieged_fla.levelsUnlockedMC_176)
package Besieged_fla {
import flash.display.*;
import flash.text.*;
public dynamic class levelsUnlockedMC_176 extends MovieClip {
public var levelsUnlockedText:TextField;
}
}//package Besieged_fla
Section 8
//loadED_5 (Besieged_fla.loadED_5)
package Besieged_fla {
import flash.display.*;
public dynamic class loadED_5 extends MovieClip {
public function loadED_5(){
addFrameScript(39, frame40);
}
function frame40(){
stop();
}
}
}//package Besieged_fla
Section 9
//NG_AD_OBJECT_WITH_PRELOADER_1 (Besieged_fla.NG_AD_OBJECT_WITH_PRELOADER_1)
package Besieged_fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class NG_AD_OBJECT_WITH_PRELOADER_1 extends MovieClip {
public var ng_ad:MovieClip;
public var NG_Button:SimpleButton;
public function NG_AD_OBJECT_WITH_PRELOADER_1(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
public function startAd(_arg1){
var _local2:URLLoader;
_local2 = new URLLoader(new URLRequest(_arg1));
_local2.addEventListener(Event.COMPLETE, ad_Loaded);
}
function frame1(){
Security.allowDomain("70.87.128.99");
Security.allowInsecureDomain("70.87.128.99");
Security.allowDomain("ads.shizmoo.com");
Security.allowInsecureDomain("ads.shizmoo.com");
Security.allowDomain("www.cpmstar.com");
Security.allowInsecureDomain("www.cpmstar.com");
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
if (NewgroundsAPI.getAdURL()){
startAd(NewgroundsAPI.getAdURL());
};
NewgroundsAPI.addEventListener(NewgroundsAPI.ADS_APPROVED, startAd);
NG_Button.addEventListener(MouseEvent.CLICK, loadNGSite);
stop();
}
public function ad_Loaded(_arg1:Event){
var _local2:*;
var _local3:Loader;
_local2 = String(_arg1.target.data);
_local3 = new Loader();
_local3.load(new URLRequest(_local2));
ng_ad.addChild(_local3);
}
}
}//package Besieged_fla
Section 10
//NG_TANK_9 (Besieged_fla.NG_TANK_9)
package Besieged_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NG_TANK_9 extends MovieClip {
public var NG_Logo:SimpleButton;
public function NG_TANK_9(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
function frame1(){
NG_Logo.addEventListener(MouseEvent.CLICK, loadNGSite);
}
}
}//package Besieged_fla
Section 11
//NGI_INTRO_11 (Besieged_fla.NGI_INTRO_11)
package Besieged_fla {
import flash.display.*;
public dynamic class NGI_INTRO_11 extends MovieClip {
public function NGI_INTRO_11(){
addFrameScript(264, frame265);
}
function frame265(){
MovieClip(parent).gotoAndPlay(3);
}
}
}//package Besieged_fla
Section 12
//NGI_MASK_CUBE_15 (Besieged_fla.NGI_MASK_CUBE_15)
package Besieged_fla {
import flash.display.*;
public dynamic class NGI_MASK_CUBE_15 extends MovieClip {
public function NGI_MASK_CUBE_15(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package Besieged_fla
Section 13
//NGI_MASK_IN_14 (Besieged_fla.NGI_MASK_IN_14)
package Besieged_fla {
import flash.display.*;
public dynamic class NGI_MASK_IN_14 extends MovieClip {
public function NGI_MASK_IN_14(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
}
}
}//package Besieged_fla
Section 14
//qualityButton_216 (Besieged_fla.qualityButton_216)
package Besieged_fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class qualityButton_216 extends MovieClip {
public function qualityButton_216(){
addFrameScript(0, frame1);
}
public function changeQuality2(_arg1:MouseEvent):void{
MovieClip(parent).changeQuality();
}
public function enlarge(_arg1:MouseEvent):void{
scaleX = 1.1;
scaleY = 1.1;
}
function frame1(){
stop();
buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, enlarge, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OUT, unlarge, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, changeQuality2, false, 0, true);
}
public function unlarge(_arg1:MouseEvent):void{
scaleX = 1;
scaleY = 1;
}
}
}//package Besieged_fla
Section 15
//SoundDump_23 (Besieged_fla.SoundDump_23)
package Besieged_fla {
import flash.display.*;
public dynamic class SoundDump_23 extends MovieClip {
public function SoundDump_23(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Besieged_fla
Section 16
//timeCounter_217 (Besieged_fla.timeCounter_217)
package Besieged_fla {
import flash.display.*;
import flash.text.*;
public dynamic class timeCounter_217 extends MovieClip {
public var time:TextField;
}
}//package Besieged_fla
Section 17
//toggleBox_230 (Besieged_fla.toggleBox_230)
package Besieged_fla {
import flash.display.*;
public dynamic class toggleBox_230 extends MovieClip {
public function toggleBox_230(){
addFrameScript(0, frame1);
}
function frame1(){
buttonMode = true;
stop();
}
}
}//package Besieged_fla
Section 18
//toggleQuality_231 (Besieged_fla.toggleQuality_231)
package Besieged_fla {
import flash.display.*;
public dynamic class toggleQuality_231 extends MovieClip {
public function toggleQuality_231(){
addFrameScript(0, frame1);
}
function frame1(){
buttonMode = true;
stop();
}
}
}//package Besieged_fla
Section 19
//X_LOAD_2 (Besieged_fla.X_LOAD_2)
package Besieged_fla {
import flash.events.*;
import flash.display.*;
public dynamic class X_LOAD_2 extends MovieClip {
public var NGButton:SimpleButton;
public function X_LOAD_2(){
addFrameScript(100, frame101, 150, frame151, 164, frame165);
}
function frame151(){
NGButton.addEventListener(MouseEvent.CLICK, PlayMovie);
}
function frame165(){
stop();
}
public function PlayMovie(_arg1:Event){
gotoAndStop("end");
MovieClip(root).play();
}
function frame101(){
play();
}
}
}//package Besieged_fla
Section 20
//None (fl.transitions.easing.None)
package fl.transitions.easing {
public class None {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.transitions.easing
Section 21
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tween extends EventDispatcher {
private var _position:Number;// = NAN
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var isPlaying:Boolean;// = false
public var begin:Number;// = NAN
private var _fps:Number;// = NAN
private var _time:Number;// = NAN
public var change:Number;// = NAN
private var _finish:Number;// = NAN
public var looping:Boolean;// = false
private var _intervalID:uint;// = 0
public var func:Function;
private var _timer:Timer;// = null
private var _startTime:Number;// = NAN
public var prop:String;// = ""
private var _duration:Number;// = NAN
public var obj:Object;// = null
public var useSeconds:Boolean;// = false
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
isPlaying = false;
obj = null;
prop = "";
func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
begin = NaN;
change = NaN;
useSeconds = false;
prevTime = NaN;
prevPos = NaN;
looping = false;
_duration = NaN;
_time = NaN;
_fps = NaN;
_position = NaN;
_startTime = NaN;
_intervalID = 0;
_finish = NaN;
_timer = null;
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean;
_local2 = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function get duration():Number{
return (this._duration);
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function get FPS():Number{
return (this._fps);
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function get time():Number{
return (this._time);
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
}
}//package fl.transitions
Section 22
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var time:Number;// = NAN
public var position:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_LOOP:String = "motionLoop";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_RESUME:String = "motionResume";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
time = NaN;
position = NaN;
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 23
//Achievements (Achievements)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class Achievements extends MovieClip {
public var lock:MovieClip;
public function Achievements(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25, 25, frame26, 26, frame27, 27, frame28, 28, frame29, 29, frame30, 30, frame31, 31, frame32, 32, frame33, 33, frame34, 34, frame35, 35, frame36, 36, frame37, 37, frame38, 38, frame39, 39, frame40, 40, frame41);
}
function frame10(){
if (MovieClip(parent).award.cannonTowers1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame14(){
if (MovieClip(parent).award.farmsPlaced2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame18(){
if (MovieClip(parent).award.minesPlaced3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame3(){
if (MovieClip(parent).award.circleTowers3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame6(){
if (MovieClip(parent).award.squareTowers3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame7(){
if (MovieClip(parent).award.pentagonTowers1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame1(){
stop();
if (MovieClip(parent).award.circleTowers1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame19(){
if (MovieClip(parent).award.trainingCentersPlaced1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame12(){
if (MovieClip(parent).award.cannonTowers3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame13(){
if (MovieClip(parent).award.farmsPlaced1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame17(){
if (MovieClip(parent).award.minesPlaced2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame4(){
if (MovieClip(parent).award.squareTowers1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame5(){
if (MovieClip(parent).award.squareTowers2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame9(){
if (MovieClip(parent).award.pentagonTowers3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame22(){
if (MovieClip(parent).award.enemiesKilledTier1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame16(){
if (MovieClip(parent).award.minesPlaced1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame8(){
if (MovieClip(parent).award.pentagonTowers2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame21(){
if (MovieClip(parent).award.trainingCentersPlaced3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame2(){
if (MovieClip(parent).award.circleTowers2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame15(){
if (MovieClip(parent).award.farmsPlaced3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame23(){
if (MovieClip(parent).award.enemiesKilledTier2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame24(){
if (MovieClip(parent).award.enemiesKilledTier3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame28(){
if (MovieClip(parent).award.resourcesEarned1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame36(){
if (MovieClip(parent).award.completedCampaign){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame20(){
if (MovieClip(parent).award.trainingCentersPlaced2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame30(){
if (MovieClip(parent).award.resourcesEarned3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame31(){
if (MovieClip(parent).award.allTowersPlaced){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame25(){
if (MovieClip(parent).award.moneyEarned1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame27(){
if (MovieClip(parent).award.moneyEarned3){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame11(){
if (MovieClip(parent).award.cannonTowers2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame34(){
if (MovieClip(parent).award.allLevelTenTowers){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame35(){
if (MovieClip(parent).award.levelTenCastle){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame37(){
if (MovieClip(parent).award.survival1){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame29(){
if (MovieClip(parent).award.resourcesEarned2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame33(){
if (MovieClip(parent).award.levelTenTowerAward){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame40(){
if (MovieClip(parent).award.ultimateFail){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame41(){
if (MovieClip(parent).award.pumpkinEater){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame39(){
if (MovieClip(parent).award.gotAllAwards){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame26(){
if (MovieClip(parent).award.moneyEarned2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame32(){
if (MovieClip(parent).award.allResourceItemsPlaced){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
function frame38(){
if (MovieClip(parent).award.survival2){
lock.alpha = 0;
} else {
lock.alpha = 1;
};
}
}
}//package
Section 24
//animateAU (animateAU)
package {
import flash.display.*;
public dynamic class animateAU extends MovieClip {
public var auIcon:MovieClip;
public function animateAU(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25);
}
function frame3(){
alpha = 0.66;
}
function frame1(){
blendMode = BlendMode.LAYER;
mouseEnabled = false;
alpha = 0;
}
function frame22(){
alpha = 0.4;
}
function frame25(){
stop();
parent.removeChild(this);
}
function frame23(){
alpha = 0.2;
}
function frame4(){
alpha = 1;
}
function frame21(){
alpha = 0.6;
}
function frame20(){
alpha = 0.8;
}
function frame2(){
alpha = 0.33;
}
function frame24(){
alpha = 0;
}
}
}//package
Section 25
//animateXP (animateXP)
package {
import flash.display.*;
public dynamic class animateXP extends MovieClip {
public var xpIcon:MovieClip;
public function animateXP(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25);
}
function frame3(){
alpha = 0.66;
}
function frame1(){
alpha = 0;
}
function frame22(){
alpha = 0.4;
}
function frame25(){
stop();
parent.removeChild(this);
}
function frame23(){
alpha = 0.2;
}
function frame4(){
alpha = 1;
}
function frame21(){
alpha = 0.6;
}
function frame20(){
alpha = 0.8;
}
function frame2(){
alpha = 0.33;
}
function frame24(){
alpha = 0;
}
}
}//package
Section 26
//Award (Award)
package {
import flash.display.*;
import flash.text.*;
public class Award extends MovieClip {
var awardInput:String;// = ""
public var awardName:TextField;
public function Award(_arg1:String):void{
awardInput = "";
super();
addFrameScript(9, frame10, 59, frame60);
awardInput = _arg1;
}
public function setAward():void{
awardName.text = awardInput;
}
function frame10(){
setAward();
}
function frame60(){
stop();
parent.removeChild(this);
}
}
}//package
Section 27
//AwardSound (AwardSound)
package {
import flash.media.*;
public dynamic class AwardSound extends Sound {
}
}//package
Section 28
//bottomBar (bottomBar)
package {
import flash.display.*;
public dynamic class bottomBar extends MovieClip {
}
}//package
Section 29
//buildIcon (buildIcon)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class buildIcon extends MovieClip {
var baseRange:int;// = 10
var towerID:int;// = 0
var is_item:Boolean;// = false
var price:int;// = 200
var baseRate:int;// = 1000
var baseAttack:int;// = 0
var textCost:TextField;
public function buildIcon():void{
price = 200;
baseAttack = 0;
baseRate = 1000;
baseRange = 10;
towerID = 0;
is_item = false;
super();
mouseChildren = false;
}
public function destroy():void{
this.removeEventListener(MouseEvent.MOUSE_OVER, buildIconMouseOver);
this.removeEventListener(MouseEvent.MOUSE_OUT, buildIconMouseOut);
this.removeEventListener(MouseEvent.MOUSE_UP, buildIconMouseUp);
}
function hideBuildDescription():void{
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
MovieClip(parent).infoBox1.text = "";
MovieClip(parent).infoBox2.text = "";
}
function buildIconMouseUp(_arg1:MouseEvent):void{
MovieClip(parent).buildNewTower(this);
}
public function updateStats():void{
baseRate = (baseRate * MovieClip(parent).RB[(towerID - 1)]);
baseAttack = (baseAttack * MovieClip(parent).ABPL[(towerID - 1)]);
baseRange = (baseRange * MovieClip(parent).RanB[(towerID - 1)]);
}
public function initialize():void{
this.addEventListener(MouseEvent.MOUSE_OVER, buildIconMouseOver, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OUT, buildIconMouseOut, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, buildIconMouseUp, false, 0, true);
updateStats();
}
function buildIconMouseOut(_arg1:MouseEvent):void{
scaleX = 1;
scaleY = 1;
gotoAndStop(1);
hideBuildDescription();
}
function showStats():void{
MovieClip(parent).infoBox1.text = (("Price: " + (price - MovieClip(parent).towerPriceReduction)) + " Au");
MovieClip(parent).infoBox2.text = (((((("Base attack: " + baseAttack) + "\nBase range: ") + baseRange) + "\nBase rate: ") + baseRate) + "ms");
}
function buildIconMouseOver(_arg1:MouseEvent):void{
scaleX = 1.1;
scaleY = 1.1;
gotoAndStop(2);
showBuildDescription();
}
function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "this needs to be fixed";
MovieClip(parent).infoBox1.text = "this needs to be fixed";
MovieClip(parent).infoBox2.text = "this needs to be fixed";
}
}
}//package
Section 30
//buildItemIcon (buildItemIcon)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class buildItemIcon extends MovieClip {
var is_item:Boolean;// = true
var price:int;// = 200
var itemID:int;// = 0
var textCost:TextField;
public function buildItemIcon():void{
price = 200;
itemID = 0;
is_item = true;
super();
mouseChildren = false;
}
public function destroy():void{
this.removeEventListener(MouseEvent.MOUSE_OVER, buildIconMouseOver);
this.removeEventListener(MouseEvent.MOUSE_OUT, buildIconMouseOut);
this.removeEventListener(MouseEvent.MOUSE_UP, buildIconMouseUp);
}
function hideBuildDescription():void{
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
MovieClip(parent).infoBox1.text = "";
MovieClip(parent).infoBox2.text = "";
}
function buildIconMouseUp(_arg1:MouseEvent):void{
MovieClip(parent).buildNewItem(this);
}
public function initialize():void{
this.addEventListener(MouseEvent.MOUSE_OVER, buildIconMouseOver, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OUT, buildIconMouseOut, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, buildIconMouseUp, false, 0, true);
}
function buildIconMouseOut(_arg1:MouseEvent):void{
scaleX = 1;
scaleY = 1;
gotoAndStop(1);
hideBuildDescription();
}
function showStats():void{
MovieClip(parent).infoBox1.text = "fix";
MovieClip(parent).infoBox2.text = "fix";
}
function buildIconMouseOver(_arg1:MouseEvent):void{
scaleX = 1.1;
scaleY = 1.1;
gotoAndStop(2);
showBuildDescription();
}
function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "this needs to be fixed";
MovieClip(parent).infoBox1.text = "this needs to be fixed";
MovieClip(parent).infoBox2.text = "this needs to be fixed";
}
}
}//package
Section 31
//Bumper (Bumper)
package {
import flash.display.*;
public dynamic class Bumper extends MovieClip {
}
}//package
Section 32
//cancelIcon (cancelIcon)
package {
import flash.display.*;
public dynamic class cancelIcon extends MovieClip {
}
}//package
Section 33
//CannonFire (CannonFire)
package {
import flash.media.*;
public dynamic class CannonFire extends Sound {
}
}//package
Section 34
//CannonTop (CannonTop)
package {
import flash.display.*;
public dynamic class CannonTop extends MovieClip {
public function CannonTop(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 35
//cannonTower (cannonTower)
package {
public class cannonTower extends Tower {
public function cannonTower(_arg1:int):void{
super(_arg1);
baseAttack = 250;
attack = baseAttack;
attackIncrease = 50;
attackSound = new CannonFire();
towerName = "Cannon Tower";
baseRate = 6000;
rate = baseRate;
rateDecrease = 100;
baseRange = 120;
range = baseRange;
rangeIncrease = 5;
price = 400;
towerID = 4;
}
}
}//package
Section 36
//cannonTowerBuild (cannonTowerBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class cannonTowerBuild extends buildIcon {
public var cost:TextField;
public function cannonTowerBuild():void{
addFrameScript(0, frame1, 1, frame2);
towerID = 4;
price = 400;
baseAttack = 200;
baseRate = 6000;
baseRange = 120;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).towerPriceReduction));
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Cannon towers do a great amount of damage and have long range, but fire slowly.";
showStats();
}
}
}//package
Section 37
//Castle (Castle)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
public class Castle extends MovieClip {
var unroundedxp:Number;// = 0
var hp:int;// = 100
var hpBar:MovieClip;
var ticker:Boolean;// = false
var levelUpSound:Sound;
var repair_showed:Boolean;// = false
var baseHeight:int;// = 0
var barBaseDimensions:int;// = 0
var baseWidth:int;// = 0
public var flag:MovieClip;
var maxhp:int;// = 100
var infoBox2:TextField;
var level:int;// = 1
var infoBox1:TextField;
var repairIcon:MovieClip;
var xpGainClock:Timer;
var is_hovered:Boolean;// = false
var gainPerTick:Number;// = 0
var moneyGainClock:Timer;
var xp:int;// = 0
public function Castle():void{
hp = 100;
maxhp = 100;
xp = 0;
unroundedxp = 0;
gainPerTick = 0;
level = 1;
infoBox1 = new TextField();
infoBox2 = new TextField();
baseWidth = 0;
baseHeight = 0;
levelUpSound = new CastleLevelUp();
hpBar = new CastleHealthBar();
barBaseDimensions = 0;
ticker = false;
xpGainClock = new Timer(1000);
moneyGainClock = new Timer(1000);
repair_showed = false;
repairIcon = new RepairIcon();
is_hovered = false;
super();
addFrameScript(0, frame1);
flag.stop();
flag.mouseEnabled = false;
hpBar.x = 0;
hpBar.y = 46;
barBaseDimensions = hpBar.bar.width;
baseWidth = width;
baseHeight = height;
xpGainClock.addEventListener(TimerEvent.TIMER, xpIncrease, false, 0, true);
xpGainClock.start();
moneyGainClock.addEventListener(TimerEvent.TIMER, moneyIncrease, false, 0, true);
moneyGainClock.start();
cacheAsBitmap = true;
addEventListener(MouseEvent.MOUSE_OVER, displayInfo, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, cancelInfo, false, 0, true);
addEventListener(Event.ADDED_TO_STAGE, checkForAward);
}
public function cancelInfoNoEvent():void{
if (hpBar.parent == this){
removeChild(hpBar);
};
MovieClip(parent).clearCastleInfo();
}
function moneyIncrease(_arg1:TimerEvent):void{
if (MovieClip(parent).hasStarted){
MovieClip(parent).increaseMoneyBy(moneyPerSecond());
};
}
public function setGraphic():void{
if (hp < (maxhp * 0.3)){
gotoAndStop("damage3");
} else {
if (hp < (maxhp * 0.6)){
gotoAndStop("damage2");
} else {
if (hp < maxhp){
gotoAndStop("damage1");
} else {
if (hp == maxhp){
gotoAndStop("default");
};
};
};
};
}
function checkForAward(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, checkForAward);
if (MovieClip(parent).castleAward()){
xpGainClock.delay = 1000;
xpGainClock.delay = (xpGainClock.delay * 0.9);
};
}
public function moneyPerSecond():int{
if (level > 9){
if ((10 * (hp / maxhp)) > 0){
return ((10 * (hp / maxhp)));
};
return (1);
//unresolved jump
};
if (level > 7){
if ((8 * (hp / maxhp)) > 0){
return ((9 * (hp / maxhp)));
};
return (1);
//unresolved jump
};
if (level > 4){
if ((7 * (hp / maxhp)) > 0){
return ((8 * (hp / maxhp)));
};
return (1);
//unresolved jump
};
if ((((hp / maxhp) * level) * 2) > 0){
return ((((hp / maxhp) * level) * 2));
};
return (1);
}
public function levelUp():void{
if (level < 10){
flag.gotoAndStop((flag.currentFrame + 1));
level++;
maxhp = (maxhp + 25);
hp = (hp + 25);
MovieClip(parent).displayLevelUpText1(x, y, true);
if (level == 5){
xpGainClock.delay = (xpGainClock.delay / 2);
} else {
if (level == 7){
xpGainClock.delay = (xpGainClock.delay / 2);
};
};
if (MovieClip(parent).getEffectsStatus()){
levelUpSound.play();
};
if (level == 10){
MovieClip(parent).castleLevelTen();
};
};
}
public function cancelInfo(_arg1:MouseEvent):void{
if (hpBar.parent == this){
removeChild(hpBar);
};
is_hovered = false;
MovieClip(parent).clearCastleInfo();
}
public function xpIncrease(_arg1:TimerEvent):void{
if (level < 10){
if (MovieClip(parent).hasStarted){
parent.addChild(this);
gainPerTick = ((hp / maxhp) * 2);
unroundedxp = (unroundedxp + gainPerTick);
xp = unroundedxp;
gainPerTick = 0;
if (xp > ((level * 100) * (0.5 * level))){
levelUp();
};
if (is_hovered){
displayInfo2();
};
};
};
}
function frame1(){
stop();
}
public function showRepairIcon(_arg1:Event):void{
if (is_hovered){
if ((((((((mouseX < (-(baseWidth) / 2))) || ((mouseX > (baseWidth / 2))))) || ((mouseY > (baseHeight / 2))))) || ((mouseY < ((-(baseHeight) / 2) - 30))))){
is_hovered = false;
cancelInfoNoEvent();
};
if ((((MovieClip(parent).getResources() > getPriceToRepair())) && ((MovieClip(parent).getMoney() > getPriceToRepair())))){
repairIcon.gotoAndStop(1);
} else {
if ((((MovieClip(parent).getResources() < getPriceToRepair())) || ((MovieClip(parent).getMoney() < getPriceToRepair())))){
repairIcon.gotoAndStop(2);
};
};
repairIcon.x = mouseX;
repairIcon.y = mouseY;
repairIcon.amount.text = ("-" + getPriceToRepair());
} else {
removeEventListener(Event.ENTER_FRAME, showRepairIcon);
removeEventListener(MouseEvent.MOUSE_DOWN, repairCastle);
repair_showed = false;
Mouse.show();
removeChild(repairIcon);
};
}
public function displayInfo(_arg1:MouseEvent):void{
is_hovered = true;
MovieClip(parent).printCastleInfo(level, xp, hp, maxhp);
addChild(hpBar);
hpBar.bar.width = ((hp / maxhp) * barBaseDimensions);
if (hp < maxhp){
Mouse.hide();
addEventListener(Event.ENTER_FRAME, showRepairIcon, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, repairCastle, false, 0, true);
repair_showed = true;
repairIcon.x = mouseX;
repairIcon.y = mouseY;
addChild(repairIcon);
if ((((repairIcon.currentFrame == 2)) && ((((MovieClip(parent).getResources() > getPriceToRepair())) && ((MovieClip(parent).getMoney() > getPriceToRepair())))))){
repairIcon.gotoAndStop(1);
} else {
if ((((repairIcon.currentFrame == 1)) && ((((MovieClip(parent).getResources() < getPriceToRepair())) || ((MovieClip(parent).getMoney() < getPriceToRepair())))))){
repairIcon.gotoAndStop(2);
};
};
};
}
public function displayInfo2():void{
addChild(hpBar);
hpBar.bar.width = ((hp / maxhp) * barBaseDimensions);
MovieClip(parent).printCastleInfo(level, xp, hp, maxhp);
}
public function deleteSelf():void{
if (hpBar.parent == this){
removeChild(hpBar);
};
xpGainClock.removeEventListener(TimerEvent.TIMER, xpIncrease);
moneyGainClock.removeEventListener(TimerEvent.TIMER, moneyIncrease);
xpGainClock.reset();
moneyGainClock.reset();
}
public function getPriceToRepair():int{
return ((((maxhp - hp) * level) * 2));
}
public function decrementHpBy(_arg1:int):void{
hp = (hp - _arg1);
if (hp <= 0){
hp = 0;
MovieClip(parent).loseLevel();
};
if (hpBar.parent == this){
hpBar.bar.width = ((hp / maxhp) * barBaseDimensions);
};
setGraphic();
}
public function repairCastle(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = MovieClip(parent).getResources();
_local3 = getPriceToRepair();
_local4 = MovieClip(parent).getMoney();
if ((((_local2 >= _local3)) && ((_local4 >= _local3)))){
MovieClip(parent).decrementResources(_local3);
MovieClip(parent).decrementMoney(_local3);
hp = maxhp;
setGraphic();
displayInfo2();
MovieClip(parent).updateAmounts();
removeEventListener(Event.ENTER_FRAME, showRepairIcon);
removeEventListener(MouseEvent.MOUSE_DOWN, repairCastle);
repair_showed = false;
Mouse.show();
removeChild(repairIcon);
} else {
MovieClip(parent).playBloop();
};
}
}
}//package
Section 38
//CastleHealthBar (CastleHealthBar)
package {
import flash.display.*;
public dynamic class CastleHealthBar extends MovieClip {
public var bar:MovieClip;
}
}//package
Section 39
//CastleLevelUp (CastleLevelUp)
package {
import flash.media.*;
public dynamic class CastleLevelUp extends Sound {
}
}//package
Section 40
//castleSelect (castleSelect)
package {
import flash.display.*;
public dynamic class castleSelect extends MovieClip {
}
}//package
Section 41
//CircleFire (CircleFire)
package {
import flash.media.*;
public dynamic class CircleFire extends Sound {
}
}//package
Section 42
//CircleTop (CircleTop)
package {
import flash.display.*;
public dynamic class CircleTop extends MovieClip {
public function CircleTop(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 43
//circleTower (circleTower)
package {
public class circleTower extends Tower {
public function circleTower(_arg1:int):void{
super(_arg1);
towerID = 1;
baseAttack = 5;
attack = baseAttack;
attackIncrease = 5;
attackSound = new CircleFire();
towerName = "Arrow Tower";
baseRate = 2000;
rate = baseRate;
rateDecrease = 50;
baseRange = 70;
range = baseRange;
rangeIncrease = 5;
price = 150;
}
}
}//package
Section 44
//circleTowerBuild (circleTowerBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class circleTowerBuild extends buildIcon {
public var cost:TextField;
public function circleTowerBuild():void{
addFrameScript(0, frame1, 1, frame2);
towerID = 1;
price = 150;
baseAttack = 5;
baseRate = 2000;
baseRange = 70;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).towerPriceReduction));
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Arrow towers are standard towers - they shoot at enemies when they come in range and have average stats and growth rates.";
showStats();
}
}
}//package
Section 45
//Clouds (Clouds)
package {
import flash.display.*;
public dynamic class Clouds extends MovieClip {
}
}//package
Section 46
//Coins (Coins)
package {
import flash.display.*;
public dynamic class Coins extends MovieClip {
}
}//package
Section 47
//confirmClear (confirmClear)
package {
import flash.events.*;
import flash.display.*;
public dynamic class confirmClear extends MovieClip {
public var no:SimpleButton;
public var yes:SimpleButton;
public function confirmClear(){
addFrameScript(3, frame4);
}
function frame4(){
stop();
yes.addEventListener(MouseEvent.MOUSE_UP, yesSelected, false, 0, true);
no.addEventListener(MouseEvent.MOUSE_UP, noSelected, false, 0, true);
}
public function noSelected(_arg1:MouseEvent):void{
parent.removeChild(this);
}
public function yesSelected(_arg1:MouseEvent):void{
parent.removeChild(this);
}
}
}//package
Section 48
//Empty (Empty)
package {
import flash.display.*;
public dynamic class Empty extends MovieClip {
}
}//package
Section 49
//Enemy (Enemy)
package {
import flash.events.*;
import flash.display.*;
public class Enemy extends MovieClip {
var hp:int;// = 10
var bumpersChecked:Array;
var resourceModifier:Number;// = 0
var hp_modifier:Number;// = 1
var rotate:int;// = 0
var speed:Number;// = 1.5
var tempdy:int;// = 0
var damage:int;// = 10
var tempdx:int;// = 0
var maxhp:int;// = 10
var is_alive:Boolean;// = true
var done:Boolean;// = false
var damage_modifier:Number;// = 1.5
var dx:int;// = 1
var dy:int;// = 0
var num_bumpers:int;// = 0
var is_set:Boolean;// = false
var enemyNum:int;// = 0
var targetableBySquare;// = true
public function Enemy():void{
speed = 1.5;
dx = 1;
dy = 0;
rotate = 0;
bumpersChecked = new Array();
maxhp = 10;
hp = 10;
done = false;
targetableBySquare = true;
damage = 10;
num_bumpers = 0;
is_set = false;
is_alive = true;
hp_modifier = 1;
damage_modifier = 1.5;
tempdx = 0;
tempdy = 0;
enemyNum = 0;
resourceModifier = 0;
super();
x = -15;
y = -15;
rotate = 25;
scaleX = 0.8;
scaleY = 0.8;
addEventListener(Event.ENTER_FRAME, updatePhase, false, 0, true);
addEventListener(Event.ENTER_FRAME, checkRange, false, 0, true);
}
function checkRange(_arg1:Event):void{
var _local2:int;
var _local3:int;
if (parent != null){
if (!MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].isFinished){
_local2 = 0;
_local3 = MovieClip(parent).ranges.length;
_local2 = 0;
while (_local2 < _local3) {
if (((((MovieClip(parent).ranges[_local2].hitTestPoint(x, y, true)) && (!(MovieClip(parent).ranges[_local2].occupied)))) && ((hp > 0)))){
if (MovieClip(parent).ranges[_local2].isSquareTower){
if (targetableBySquare){
MovieClip(parent).ranges[_local2].recieveEnemy(this);
};
};
MovieClip(parent).ranges[_local2].recieveEnemy(this);
};
_local2++;
};
} else {
deleteSelf();
};
};
}
function has_been_checked(_arg1:int):Boolean{
var _local2:int;
_local2 = 0;
_local2 = 0;
while (_local2 < bumpersChecked.length) {
if (bumpersChecked[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
function dieOnCastle():void{
is_alive = false;
x = -1222;
y = -1222;
dx = 0;
dy = 0;
MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.decrementHpBy((damage * alpha));
MovieClip(parent).enemies.splice(MovieClip(parent).enemies.indexOf(this, 0), 1);
deleteSelf();
}
function updatePhase(_arg1:Event):void{
var _local2:int;
if (parent != null){
if (((!(MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].isFinished)) && (!((parent == null))))){
if (hp >= 0){
alpha = (hp / maxhp);
} else {
die();
};
if ((((((((((alpha <= 0)) || ((x > 820)))) || ((x < -100)))) || ((y > 450)))) || ((y < -100)))){
die();
} else {
if (!is_set){
stop();
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].hasBumpers){
num_bumpers = (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers.length - 1);
};
is_set = true;
} else {
if (!MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.hitTestPoint(x, y, true)){
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].hasBumpers){
_local2 = 0;
while (_local2 <= num_bumpers) {
if (!has_been_checked(_local2)){
if (hitTestObject(MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers[_local2])){
bumpersChecked.push(_local2);
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers[_local2].is_vertical){
dx = 0;
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers[_local2].two_paths){
if (Math.random() > 0.5){
dy = -1;
} else {
dy = 1;
};
} else {
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers[_local2].go_up){
dy = -1;
} else {
dy = 1;
};
};
} else {
dy = 0;
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers[_local2].two_paths){
if (Math.random() > 0.5){
dx = -1;
} else {
dx = 1;
};
} else {
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].bumpers[_local2].go_right){
dx = 1;
} else {
dx = -1;
};
};
};
};
};
_local2++;
};
};
} else {
dieOnCastle();
};
};
};
x = (x + (dx * speed));
y = (y + (dy * speed));
} else {
deleteSelf();
};
} else {
deleteSelf();
};
}
public function pauseSelf():void{
tempdx = dx;
tempdy = dy;
dx = 0;
dy = 0;
removeEventListener(Event.ENTER_FRAME, updatePhase);
removeEventListener(Event.ENTER_FRAME, checkRange);
}
function deleteSelf():void{
is_alive = false;
removeEventListener(Event.ENTER_FRAME, updatePhase);
removeEventListener(Event.ENTER_FRAME, checkRange);
done = true;
gotoAndPlay("die");
}
function die():void{
is_alive = false;
dx = 0;
dy = 0;
x = -1222;
y = -1222;
if (MovieClip(parent) != null){
MovieClip(parent).enemies.splice(MovieClip(parent).enemies.indexOf(this, 0), 1);
MovieClip(parent).resourcesGained(this);
deleteSelf();
};
}
public function decrementHP(_arg1:int):Boolean{
hp = (hp - _arg1);
if (hp <= 0){
die();
return (true);
};
return (false);
}
public function unpauseSelf():void{
dx = tempdx;
dy = tempdy;
addEventListener(Event.ENTER_FRAME, updatePhase, false, 0, true);
addEventListener(Event.ENTER_FRAME, checkRange, false, 0, true);
}
}
}//package
Section 50
//Enemy1 (Enemy1)
package {
public class Enemy1 extends Enemy {
public function Enemy1():void{
addFrameScript(0, frame1, 1, frame2);
resourceModifier = 1;
}
function frame1(){
stop();
}
function frame2(){
alpha = 0;
parent.removeChild(this);
}
}
}//package
Section 51
//Enemy2 (Enemy2)
package {
public class Enemy2 extends Enemy {
public function Enemy2():void{
addFrameScript(0, frame1, 1, frame2);
speed = 4;
damage = 5;
hp_modifier = 0.4;
resourceModifier = 0.3;
}
function frame1(){
stop();
}
function frame2(){
alpha = 0;
parent.removeChild(this);
}
}
}//package
Section 52
//Enemy3 (Enemy3)
package {
public class Enemy3 extends Enemy {
public function Enemy3():void{
addFrameScript(0, frame1, 1, frame2);
speed = 0.7;
damage = 40;
hp_modifier = 6;
enemyNum = 3;
resourceModifier = 3;
}
function frame1(){
stop();
}
function frame2(){
alpha = 0;
parent.removeChild(this);
}
}
}//package
Section 53
//ErrorSound (ErrorSound)
package {
import flash.media.*;
public dynamic class ErrorSound extends Sound {
}
}//package
Section 54
//Farm (Farm)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Farm extends ResourceBuilding {
var timerDelay:int;// = 15000
var amount:int;// = 10
var genericTimer:Timer;
public function Farm(_arg1:int):void{
amount = 10;
timerDelay = 15000;
genericTimer = new Timer(timerDelay);
addFrameScript(0, frame1);
scaleX = 0.8;
super(_arg1);
price = 200;
itemID = 1;
sounds.push(new FarmSound(), new FarmSound(), new FarmSound(), new FarmSound());
itemName = "Farm";
}
public function healCastle(_arg1:TimerEvent):void{
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.hp < MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.maxhp){
MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.hp++;
MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.setGraphic();
};
}
override public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
if (((((is_placed) && (!(MovieClip(parent).currently_placing_tower)))) && (!(MovieClip(parent).currently_placing_item)))){
MovieClip(parent).buildInfo.text = itemName;
MovieClip(parent).infoBox1.text = (("Increasing castle XP \ngeneration and repairing \nevery " + (genericTimer.delay / 1000)) + " seconds.");
MovieClip(parent).infoBox2.text = MovieClip(parent).defaultStatsString;
handleSell();
};
}
override public function customRemove():void{
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.xpGainClock.delay <= 1000){
MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.xpGainClock.delay = (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.xpGainClock.delay + 50);
};
genericTimer.stop();
genericTimer.removeEventListener(TimerEvent.TIMER, healCastle);
}
override public function pauseSelf():void{
genericTimer.stop();
}
function frame1(){
stop();
}
override public function unpauseSelf():void{
genericTimer.start();
}
override public function activate():void{
if (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.xpGainClock.delay >= 500){
MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.xpGainClock.delay = (MovieClip(parent).levels[(MovieClip(parent).currentLevel - 1)].castle.xpGainClock.delay - 50);
};
genericTimer.start();
genericTimer.addEventListener(TimerEvent.TIMER, healCastle, false, 0, true);
}
}
}//package
Section 55
//FarmBuild (FarmBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class FarmBuild extends buildItemIcon {
public var cost:TextField;
public function FarmBuild():void{
addFrameScript(0, frame1, 1, frame2);
itemID = 1;
price = 200;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).structurePriceReduction));
}
override function showStats():void{
var _local1:int;
_local1 = (price - MovieClip(parent).structurePriceReduction);
MovieClip(parent).infoBox1.text = (("Price: " + _local1) + " resources");
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Farms increase the XP generation of your castle and slowly heal your castle is if it damaged.";
showStats();
}
}
}//package
Section 56
//FarmSound (FarmSound)
package {
import flash.media.*;
public dynamic class FarmSound extends Sound {
}
}//package
Section 57
//ForegroundTest (ForegroundTest)
package {
import flash.display.*;
public dynamic class ForegroundTest extends MovieClip {
}
}//package
Section 58
//InsNext (InsNext)
package {
import flash.events.*;
import flash.display.*;
public class InsNext extends SimpleButton {
public function InsNext():void{
this.addEventListener(MouseEvent.MOUSE_UP, gotoNextPage, false, 0, true);
}
public function gotoNextPage(_arg1:MouseEvent):void{
MovieClip(parent).gotoAndStop((MovieClip(parent).currentFrame + 1));
}
}
}//package
Section 59
//InstructionsBack (InstructionsBack)
package {
import flash.events.*;
import flash.display.*;
public class InstructionsBack extends SimpleButton {
var awardInput:String;// = ""
public function InstructionsBack():void{
awardInput = "";
super();
addEventListener(MouseEvent.MOUSE_UP, gotoPageOne, false, 0, true);
}
private function gotoPageOne(_arg1:MouseEvent):void{
MovieClip(parent).gotoAndStop(1);
}
}
}//package
Section 60
//Landmark1 (Landmark1)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Landmark1 extends ResourceBuilding {
var timerDelay:int;// = 20000
var amount:int;// = 10
var genericTimer:Timer;
public function Landmark1(_arg1:int):void{
amount = 10;
timerDelay = 20000;
genericTimer = new Timer(timerDelay);
addFrameScript(0, frame1, 479, frame480);
super(_arg1);
price = 2000;
itemID = 4;
}
override public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
}
override public function customRemove():void{
}
function frame1(){
stop();
if (is_placed){
gotoAndPlay(2);
};
}
function frame480(){
stop();
MovieClip(parent).startWin();
}
override public function unpauseSelf():void{
}
override public function activate():void{
}
}
}//package
Section 61
//Landmark1Build (Landmark1Build)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Landmark1Build extends buildItemIcon {
public var cost:TextField;
public function Landmark1Build():void{
addFrameScript(0, frame1, 1, frame2);
itemID = 4;
price = 2000;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).structurePriceReduction));
}
override function showStats():void{
var _local1:int;
_local1 = (price - MovieClip(parent).structurePriceReduction);
MovieClip(parent).infoBox1.text = (("Price: " + _local1) + " resources");
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Landmarks display the greatness of your nation.";
}
}
}//package
Section 62
//Landmark2 (Landmark2)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Landmark2 extends ResourceBuilding {
var timerDelay:int;// = 20000
var amount:int;// = 10
var genericTimer:Timer;
public function Landmark2(_arg1:int):void{
amount = 10;
timerDelay = 20000;
genericTimer = new Timer(timerDelay);
addFrameScript(0, frame1, 600, frame601);
super(_arg1);
price = 1750;
itemID = 5;
}
function frame601(){
stop();
MovieClip(parent).startWin();
}
override public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
}
override public function customRemove():void{
}
function frame1(){
stop();
if (is_placed){
gotoAndPlay(2);
};
}
override public function unpauseSelf():void{
}
override public function activate():void{
}
}
}//package
Section 63
//Landmark2Build (Landmark2Build)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Landmark2Build extends buildItemIcon {
public var cost:TextField;
public function Landmark2Build():void{
addFrameScript(0, frame1, 1, frame2);
itemID = 5;
price = 1750;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).structurePriceReduction));
}
override function showStats():void{
var _local1:int;
_local1 = (price - MovieClip(parent).structurePriceReduction);
MovieClip(parent).infoBox1.text = (("Price: " + _local1) + " resources");
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Landmarks display the greatness of your nation.";
}
}
}//package
Section 64
//Level (Level)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level extends MovieClip {
var castle:MovieClip;
var delayTime:int;// = 3000
var timerWon:Boolean;// = false
var castleLocationX:int;// = 0
var castleLocationY:int;// = 0
var preGameStart:int;// = 10000
var timerStart:int;// = 0
var numBumpers:int;// = 0
var objective:String;// = "survive"
var bumpers:Array;
var enemyhpMultiplier:Number;// = 1
var hasBumpers:Boolean;// = true
var boundingBoxLocationX:int;// = 0
var boundingBoxLocationY:int;// = 0
var hasStarted:Boolean;// = false
var startingMoney:int;// = 400
var waves:Array;
var wavesSpawned:int;// = 0
var environmentalEffect:MovieClip;
var isFinished:Boolean;// = false
var startingResources:int;// = 100
var timerDecrement:int;// = 0
var enemyEntrancePoints:Array;
var numEnemies:int;// = 1
public function Level():void{
castleLocationX = 0;
castleLocationY = 0;
boundingBoxLocationX = 0;
boundingBoxLocationY = 0;
castle = new MovieClip();
enemyEntrancePoints = new Array();
hasBumpers = true;
isFinished = false;
hasStarted = false;
objective = "survive";
delayTime = 3000;
timerDecrement = 0;
enemyhpMultiplier = 1;
startingMoney = 400;
startingResources = 100;
environmentalEffect = new Empty();
wavesSpawned = 0;
timerStart = 0;
preGameStart = 10000;
timerWon = false;
numEnemies = 1;
bumpers = new Array();
numBumpers = 0;
waves = new Array();
super();
}
public function placeBoundingBox():void{
}
public function decrementMoney(_arg1:int):void{
MovieClip(parent).money = (MovieClip(parent).money - _arg1);
}
public function clearCastleInfo():void{
MovieClip(parent).infoBox1.text = "";
MovieClip(parent).infoBox2.text = "";
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
}
public function startWin():void{
MovieClip(parent).win();
castle.xpGainClock.stop();
castle.moneyGainClock.stop();
}
public function fix():void{
isFinished = true;
castle.deleteSelf();
wavesSpawned = 0;
waves = new Array();
}
public function initialize_stats():void{
MovieClip(parent).money = (startingMoney + MovieClip(parent).moneyBonus);
MovieClip(parent).resources = (startingResources + MovieClip(parent).resourceBonus);
MovieClip(parent).currentObjective = objective;
}
public function checkForVictory():void{
if ((((((objective == "DEFEAT ALL ENEMIES")) && ((((MovieClip(parent).enemies.length == 0)) && ((wavesSpawned >= waves.length)))))) && (waves[(waves.length - 1)].spawned))){
if (!MovieClip(parent).anyEnemiesAlive()){
startWin();
};
} else {
if (objective == "BUILD A LANDMARK"){
} else {
if (objective == "SURVIVE AS LONG AS POSSIBLE"){
} else {
if (objective == "SURVIVE 5 MINUTES"){
if ((((((MovieClip(parent).clockValue <= 0)) && ((wavesSpawned > 3)))) && (!(timerWon)))){
timerWon = true;
startWin();
};
};
};
};
};
}
public function playBloop():void{
if (MovieClip(parent).soundEffectsEnabled){
MovieClip(parent).errorSound.play();
};
}
public function setEntrancePoint(_arg1:MovieClip):void{
var _local2:int;
if (enemyEntrancePoints.length == 1){
_arg1.y = enemyEntrancePoints[0];
} else {
_local2 = ((Math.random() * 10000) % enemyEntrancePoints.length);
if ((((enemyEntrancePoints[_local2] > 0)) && ((enemyEntrancePoints[_local2] < 1000)))){
_arg1.y = enemyEntrancePoints[_local2];
} else {
if (enemyEntrancePoints[_local2] > 2000){
_arg1.x = (enemyEntrancePoints[_local2] - 2000);
_arg1.y = 0;
_arg1.dx = 0;
_arg1.dy = 1;
} else {
if (enemyEntrancePoints[_local2] > 1000){
_arg1.x = (enemyEntrancePoints[_local2] - 1000);
_arg1.y = 394;
_arg1.dx = 0;
_arg1.dy = -1;
} else {
_arg1.y = Math.abs(enemyEntrancePoints[_local2]);
_arg1.x = 810;
_arg1.dx = -1;
};
};
};
};
}
public function levelStart():void{
timerWon = false;
castle = new Castle();
castle.x = castleLocationX;
castle.y = castleLocationY;
placeBoundingBox();
timerDecrement = 200;
addChildCastle();
setSpawn();
if (MovieClip(parent).award.levelTenCastle){
castle.xpGainClock.delay = (castle.xpGainClock.delay * 0.9);
};
MovieClip(parent).clockValue = timerStart;
}
public function updateAmounts():void{
MovieClip(parent).updateAmounts();
}
public function castleAward():Boolean{
if (MovieClip(parent).award.levelTenCastle){
return (true);
};
return (false);
}
public function traceIt():void{
}
public function castleLevelTen():void{
MovieClip(parent).castleAward();
}
public function setSpawn():void{
MovieClip(parent).enemyhpMultiplier = enemyhpMultiplier;
}
public function printCastleInfo(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
if (castle.level < 10){
MovieClip(parent).infoBox1.text = (((((((("Current level: " + _arg1) + "\n") + "Current XP: ") + _arg2) + "\n") + "XP to level: ") + (((_arg1 * 100) * (0.5 * _arg1)) - _arg2)) + "\n");
MovieClip(parent).infoBox2.text = ((((("HP remaining: " + _arg3) + "\n") + "Max HP: ") + _arg4) + "\n");
} else {
MovieClip(parent).infoBox1.text = (((((("Current level: " + _arg1) + "\n") + "Current XP: 4000") + "\n") + "XP to level: -") + "\n");
MovieClip(parent).infoBox2.text = ((((("HP remaining: " + _arg3) + "\n") + "Max HP: ") + _arg4) + "\n");
};
MovieClip(parent).buildInfo.text = (("Your castle, based on level and current conditions, is generating " + castle.moneyPerSecond()) + " Au per second.");
}
public function increaseMoneyBy(_arg1:int):void{
MovieClip(parent).moneyEarned(_arg1);
}
public function displayLevelUpText1(_arg1:int, _arg2:int, _arg3:Boolean):void{
MovieClip(parent).displayLevelUpText(_arg1, _arg2, _arg3);
}
public function loseLevel():void{
MovieClip(parent).lose();
}
public function getMoney():int{
return (MovieClip(parent).money);
}
public function getResources():int{
return (MovieClip(parent).resources);
}
public function decrementResources(_arg1:int):void{
MovieClip(parent).resources = (MovieClip(parent).resources - _arg1);
}
public function addChildCastle():void{
addChild(castle);
}
public function getEffectsStatus():Boolean{
return (MovieClip(parent).soundEffectsEnabled);
}
}
}//package
Section 65
//Level1 (Level1)
package {
import flash.events.*;
import flash.text.*;
public class Level1 extends Level {
var boundingBox;
public function Level1():void{
boundingBox = new level1BoundingBox();
super();
hasBumpers = false;
castleLocationX = 705;
castleLocationY = 191;
boundingBoxLocationX = 0;
boundingBoxLocationY = 191.3;
objective = "DEFEAT ALL ENEMIES";
startingMoney = 500;
startingResources = 200;
timerDecrement = 50;
numEnemies = 500;
delayTime = 2000;
enemyhpMultiplier = 0.7;
enemyEntrancePoints.push(191.3);
waves.push(new Wave(3, 1000, 1, 20000));
waves.push(new Wave(5, 1000, 1, 20000));
waves.push(new Wave(7, 1000, 1, 20000));
waves.push(new Wave(5, 400, 2, 20000));
waves.push(new Wave(9, 1000, 1, 20000));
waves.push(new Wave(10, 500, 2, 20000));
waves.push(new Wave(9, 1000, 1, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(15, 400, 2, 30000));
waves.push(new Wave(3, 600, 1, 4000));
waves.push(new Wave(3, 600, 1, 4000));
waves.push(new Wave(3, 600, 1, 4000));
waves.push(new Wave(10, 1000, 1, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(15, 600, 2, 20000));
waves.push(new Wave(5, 1000, 1, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 6000));
waves.push(new Wave(1, 4000, 3, 241));
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
}
}//package
Section 66
//level1BoundingBox (level1BoundingBox)
package {
import flash.display.*;
public dynamic class level1BoundingBox extends MovieClip {
}
}//package
Section 67
//Level2 (Level2)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level2 extends Level {
var boundingBox;
public function Level2():void{
var _local1:int;
var _local2:MovieClip;
boundingBox = new level2BoundingBox();
super();
castleLocationX = 700;
castleLocationY = 220;
boundingBoxLocationX = -2;
boundingBoxLocationY = 82;
numBumpers = 2;
objective = "SURVIVE 5 MINUTES";
timerStart = 300;
environmentalEffect = new Rain();
startingMoney = 3000;
startingResources = 1500;
timerDecrement = 50;
numEnemies = 800;
delayTime = 2000;
enemyhpMultiplier = 1.7;
_local1 = 0;
while (_local1 < numBumpers) {
_local2 = new Bumper();
bumpers.push(_local2);
addChild(bumpers[_local1]);
bumpers[_local1].is_horizontal = false;
bumpers[_local1].is_vertical = false;
bumpers[_local1].go_up = false;
bumpers[_local1].go_right = false;
_local1++;
};
bumpers[0].x = 718;
bumpers[0].y = 95;
bumpers[0].is_vertical = true;
bumpers[0].go_up = false;
bumpers[1].x = 720;
bumpers[1].y = 291;
bumpers[1].is_vertical = true;
bumpers[1].go_up = true;
enemyEntrancePoints.push(93, 291);
waves.push(new Wave(5, 2000, 1, 20000));
waves.push(new Wave(7, 2000, 1, 25000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(20, 400, 2, 10000));
waves.push(new Wave(8, 2000, 1, 28000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(3, 400, 2, 4000));
waves.push(new Wave(2, 3000, 3, 25000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(20, 600, 2, 35000));
waves.push(new Wave(10, 3000, 3, 75000));
waves.push(new Wave(30, 300, 2, 241));
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
}
}//package
Section 68
//level2BoundingBox (level2BoundingBox)
package {
import flash.display.*;
public dynamic class level2BoundingBox extends MovieClip {
}
}//package
Section 69
//Level3 (Level3)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level3 extends Level {
var boundingBox;
public function Level3():void{
var _local1:int;
var _local2:MovieClip;
boundingBox = new level3BoundingBox();
super();
castleLocationX = 478;
castleLocationY = 217;
boundingBoxLocationX = 0;
boundingBoxLocationY = 78;
numBumpers = 2;
objective = "BUILD A LANDMARK";
environmentalEffect = new Snow();
startingMoney = 650;
startingResources = 0;
timerDecrement = 50;
numEnemies = 800;
delayTime = 2000;
enemyhpMultiplier = 1;
_local1 = 0;
while (_local1 < numBumpers) {
_local2 = new Bumper();
bumpers.push(_local2);
addChild(bumpers[_local1]);
bumpers[_local1].is_horizontal = false;
bumpers[_local1].is_vertical = false;
bumpers[_local1].go_up = false;
bumpers[_local1].go_right = false;
_local1++;
};
bumpers[0].x = 489;
bumpers[0].y = 85;
bumpers[0].is_vertical = true;
bumpers[0].go_up = false;
bumpers[1].x = 489;
bumpers[1].y = 290;
bumpers[1].is_vertical = true;
bumpers[1].go_up = true;
enemyEntrancePoints.push(87, 290, 188, -188);
waves = new Array();
waves.push(new Wave(60, 2000, 1, 135000));
waves.push(new Wave(5, 500, 2, 20000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(7, 500, 2, 15000));
waves.push(new Wave(20, 2000, 1, 50000));
waves.push(new Wave(10, 500, 2, 20000));
waves.push(new Wave(20, 2000, 1, 50000));
waves.push(new Wave(1, 1000, 3, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(30, 600, 2, 26000));
waves.push(new Wave(3, 5000, 3, 40000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(25, 2000, 1, 60000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 500, 2, 20000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(7, 500, 2, 15000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(10, 500, 2, 10000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(10, 500, 2, 20000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(30, 500, 3, 241));
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
}
}//package
Section 70
//level3BoundingBox (level3BoundingBox)
package {
import flash.display.*;
public dynamic class level3BoundingBox extends MovieClip {
}
}//package
Section 71
//Level4 (Level4)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level4 extends Level {
var boundingBox;
public function Level4():void{
var _local1:int;
var _local2:MovieClip;
boundingBox = new level4BoundingBox();
super();
castleLocationX = 400;
castleLocationY = 140;
boundingBoxLocationX = 0;
boundingBoxLocationY = 115;
numBumpers = 2;
objective = "DEFEAT ALL ENEMIES";
startingMoney = 1000;
startingResources = 200;
timerDecrement = 50;
numEnemies = 800;
delayTime = 2000;
enemyhpMultiplier = 0.9;
_local1 = 0;
while (_local1 < numBumpers) {
_local2 = new Bumper();
bumpers.push(_local2);
addChild(bumpers[_local1]);
bumpers[_local1].is_horizontal = false;
bumpers[_local1].is_vertical = false;
bumpers[_local1].go_up = false;
bumpers[_local1].go_right = false;
_local1++;
};
bumpers[0].x = 204;
bumpers[0].y = 117;
bumpers[0].is_vertical = false;
bumpers[0].go_right = true;
bumpers[1].x = 585;
bumpers[1].y = 117;
bumpers[0].is_vertical = false;
bumpers[0].go_right = true;
enemyEntrancePoints.push(124, -124, 1209, 1400, 1591);
waves.push(new Wave(30, 1000, 1, 35000));
waves.push(new Wave(40, 1000, 1, 45000));
waves.push(new Wave(30, 1000, 1, 40000));
waves.push(new Wave(5, 600, 2, 7000));
waves.push(new Wave(15, 1000, 1, 20000));
waves.push(new Wave(7, 600, 2, 10000));
waves.push(new Wave(20, 1000, 1, 30000));
waves.push(new Wave(15, 400, 2, 30000));
waves.push(new Wave(9, 600, 1, 9000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(1, 8000, 3, 16000));
waves.push(new Wave(25, 1000, 1, 40000));
waves.push(new Wave(3, 8000, 3, 55000));
waves.push(new Wave(15, 400, 2, 25000));
waves.push(new Wave(5, 1000, 1, 20000));
waves.push(new Wave(3, 8000, 3, 35000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(3, 300, 2, 3000));
waves.push(new Wave(10, 600, 2, 14000));
waves.push(new Wave(1, 4000, 3, 241));
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
}
}//package
Section 72
//level4BoundingBox (level4BoundingBox)
package {
import flash.display.*;
public dynamic class level4BoundingBox extends MovieClip {
}
}//package
Section 73
//Level5 (Level5)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level5 extends Level {
var boundingBox;
public function Level5():void{
var _local1:int;
var _local2:MovieClip;
boundingBox = new level5BoundingBox();
super();
castleLocationX = 400;
castleLocationY = 210;
boundingBoxLocationX = 0;
boundingBoxLocationY = 78;
numBumpers = 6;
objective = "BUILD A LANDMARK";
environmentalEffect = new Clouds();
startingMoney = 400;
startingResources = 0;
timerDecrement = 50;
numEnemies = 800;
delayTime = 2000;
enemyhpMultiplier = 1;
_local1 = 0;
while (_local1 < numBumpers) {
_local2 = new Bumper();
bumpers.push(_local2);
addChild(bumpers[_local1]);
bumpers[_local1].is_horizontal = false;
bumpers[_local1].is_vertical = false;
bumpers[_local1].go_up = false;
bumpers[_local1].go_right = false;
_local1++;
};
bumpers[0].x = 211;
bumpers[0].y = 88;
bumpers[0].is_vertical = true;
bumpers[0].go_up = false;
bumpers[1].x = 193;
bumpers[1].y = 198;
bumpers[1].is_vertical = false;
bumpers[1].go_right = true;
bumpers[2].x = 412;
bumpers[2].y = 293;
bumpers[2].is_vertical = true;
bumpers[2].go_up = true;
bumpers[3].x = 588;
bumpers[3].y = 293;
bumpers[3].is_vertical = true;
bumpers[3].go_up = true;
bumpers[4].x = 594;
bumpers[4].y = 182;
bumpers[4].is_vertical = false;
bumpers[4].go_right = false;
bumpers[5].x = 387;
bumpers[5].y = 90;
bumpers[5].is_vertical = true;
bumpers[5].go_up = false;
enemyEntrancePoints.push(87, 189, 291, -87, -189, -291);
waves.push(new Wave(30, 2000, 1, 75000));
waves.push(new Wave(3, 700, 2, 10000));
waves.push(new Wave(20, 2000, 1, 50000));
waves.push(new Wave(5, 500, 2, 15000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(7, 500, 2, 20000));
waves.push(new Wave(20, 2000, 1, 50000));
waves.push(new Wave(1, 1000, 3, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(30, 800, 2, 35000));
waves.push(new Wave(3, 5000, 3, 40000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(25, 2000, 1, 60000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 500, 2, 20000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(7, 500, 2, 15000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(10, 500, 2, 10000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(10, 2000, 1, 30000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(10, 500, 2, 20000));
waves.push(new Wave(15, 2000, 1, 40000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(5, 400, 2, 9000));
waves.push(new Wave(20, 600, 2, 20000));
waves.push(new Wave(3, 10000, 3, 60000));
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
}
}//package
Section 74
//level5BoundingBox (level5BoundingBox)
package {
import flash.display.*;
public dynamic class level5BoundingBox extends MovieClip {
}
}//package
Section 75
//Level6 (Level6)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level6 extends Level {
var boundingBox;
public function Level6():void{
var _local1:int;
var _local2:MovieClip;
boundingBox = new level6BoundingBox();
super();
addFrameScript(0, frame1, 1, frame2);
preGameStart = 20000;
castleLocationX = 399;
castleLocationY = 304;
boundingBoxLocationX = 45;
boundingBoxLocationY = 0;
numBumpers = 18;
timerStart = 300;
objective = "SURVIVE 5 MINUTES";
startingMoney = 2000;
startingResources = 800;
timerDecrement = 50;
numEnemies = 800;
delayTime = 2000;
enemyhpMultiplier = 0.8;
_local1 = 0;
while (_local1 < numBumpers) {
_local2 = new Bumper();
bumpers.push(_local2);
addChild(bumpers[_local1]);
bumpers[_local1].is_horizontal = false;
bumpers[_local1].is_vertical = false;
bumpers[_local1].go_up = false;
bumpers[_local1].go_right = false;
_local1++;
};
bumpers[0].x = 53;
bumpers[0].y = 236;
bumpers[0].is_horizontal = true;
bumpers[0].go_right = true;
bumpers[1].x = 118;
bumpers[1].y = 148;
bumpers[1].is_horizontal = true;
bumpers[1].go_right = true;
bumpers[2].x = 187;
bumpers[2].y = 301;
bumpers[2].is_horizontal = true;
bumpers[2].go_right = true;
bumpers[3].x = 200;
bumpers[3].y = 139;
bumpers[3].is_vertical = true;
bumpers[3].go_up = false;
bumpers[4].x = 200;
bumpers[4].y = 227;
bumpers[4].is_vertical = true;
bumpers[4].go_up = false;
bumpers[5].x = 259;
bumpers[5].y = 128;
bumpers[5].is_horizontal = true;
bumpers[5].go_right = true;
bumpers[6].x = 333;
bumpers[6].y = 159;
bumpers[6].is_vertical = true;
bumpers[6].go_up = false;
bumpers[7].x = 360;
bumpers[7].y = 120;
bumpers[7].is_vertical = true;
bumpers[7].go_up = false;
bumpers[8].x = 400;
bumpers[8].y = 168;
bumpers[8].is_horizontal = true;
bumpers[8].two_paths = true;
bumpers[9].x = 440;
bumpers[9].y = 119;
bumpers[9].is_vertical = true;
bumpers[9].go_up = false;
bumpers[10].x = 467;
bumpers[10].y = 159;
bumpers[10].is_vertical = true;
bumpers[10].go_up = false;
bumpers[11].x = 540;
bumpers[11].y = 128;
bumpers[11].is_horizontal = true;
bumpers[11].go_right = false;
bumpers[13].x = 599;
bumpers[13].y = 139;
bumpers[13].is_vertical = true;
bumpers[13].go_up = false;
bumpers[14].x = 599;
bumpers[14].y = 226;
bumpers[14].is_vertical = true;
bumpers[14].go_up = false;
bumpers[15].x = 612;
bumpers[15].y = 300;
bumpers[15].is_horizontal = true;
bumpers[15].go_right = false;
bumpers[16].x = 680;
bumpers[16].y = 148;
bumpers[16].is_horizontal = true;
bumpers[16].go_right = false;
bumpers[17].x = 746;
bumpers[17].y = 235;
bumpers[17].is_horizontal = true;
bumpers[17].go_right = false;
enemyEntrancePoints.push(2054, 2120, 2259, 2400, 2540, 2680);
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(30, 400, 2, 13200));
waves.push(new Wave(10, 400, 2, 241));
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
function frame2(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 76
//level6BoundingBox (level6BoundingBox)
package {
import flash.display.*;
public dynamic class level6BoundingBox extends MovieClip {
}
}//package
Section 77
//Level7 (Level7)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Level7 extends Level {
var boundingBox;
public function Level7():void{
var _local1:int;
var _local2:MovieClip;
boundingBox = new level7BoundingBox();
super();
castleLocationX = 704;
castleLocationY = 215;
boundingBoxLocationX = 0;
boundingBoxLocationY = 58;
numBumpers = 10;
objective = "SURVIVE AS LONG AS POSSIBLE";
enemyhpMultiplier = 1;
startingMoney = 500;
startingResources = 200;
_local1 = 0;
while (_local1 < numBumpers) {
_local2 = new Bumper();
bumpers.push(_local2);
addChild(bumpers[_local1]);
bumpers[_local1].is_horizontal = false;
bumpers[_local1].is_vertical = false;
bumpers[_local1].go_up = false;
bumpers[_local1].go_right = false;
_local1++;
};
bumpers[0].x = 120;
bumpers[0].y = 190;
bumpers[0].is_vertical = true;
bumpers[0].go_down = false;
bumpers[1].x = 109;
bumpers[1].y = 0x0101;
bumpers[1].is_horizontal = true;
bumpers[1].go_right = true;
bumpers[2].x = 227;
bumpers[2].y = 125;
bumpers[2].is_horizontal = true;
bumpers[2].go_right = true;
bumpers[3].x = 240;
bumpers[3].y = 249;
bumpers[3].is_vertical = true;
bumpers[3].go_up = true;
bumpers[4].x = 359;
bumpers[4].y = 132;
bumpers[4].is_vertical = true;
bumpers[4].go_up = false;
bumpers[5].x = 347;
bumpers[5].y = 0x0101;
bumpers[5].is_horizontal = true;
bumpers[5].go_right = true;
bumpers[6].x = 466;
bumpers[6].y = 125;
bumpers[6].is_vertical = false;
bumpers[6].go_right = true;
bumpers[7].x = 476;
bumpers[7].y = 249;
bumpers[7].is_vertical = true;
bumpers[7].go_up = true;
bumpers[8].x = 597;
bumpers[8].y = 134;
bumpers[8].is_vertical = true;
bumpers[8].go_up = false;
bumpers[9].x = 585;
bumpers[9].y = 196;
bumpers[9].is_vertical = false;
bumpers[9].go_right = true;
enemyEntrancePoints.push(188);
waves = new Array();
randomWaves();
}
override public function placeBoundingBox():void{
initialize_stats();
boundingBox.x = boundingBoxLocationX;
boundingBox.y = boundingBoxLocationY;
addChild(boundingBox);
setSpawn();
}
function generateIntFrom(_arg1:int, _arg2:int):int{
return (((Math.random() * (_arg2 - (_arg1 - 1))) + _arg1));
}
public function randomWaves():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:int;
_local1 = 0;
_local2 = generateIntFrom(20, 50);
_local4 = 0;
_local5 = 0;
_local6 = Math.random();
_local7 = 0;
while (_local7 < 200) {
_local6 = Math.random();
_local1 = 1;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
if (_local7 > 20){
_local1 = 4;
} else {
if (_local7 > 10){
_local1 = 3;
} else {
if (_local7 > 5){
_local1 = 2;
};
};
};
if (_local1 == 1){
_local2 = generateIntFrom(5, 10);
if (Math.random() > 0.5){
_local3 = 1;
_local4 = 1000;
_local5 = ((_local2 * 1000) + 20000);
} else {
_local3 = 2;
_local4 = 400;
_local5 = ((_local2 * 400) + 7000);
};
waves.push(new Wave(_local2, _local4, _local3, _local5));
} else {
if (_local1 == 2){
_local2 = generateIntFrom(5, 10);
if (_local6 > 0.6666){
_local3 = 1;
_local4 = 1000;
_local5 = ((_local2 * 1000) + 20000);
} else {
if (_local6 > 0.3333){
_local2 = generateIntFrom(10, 20);
_local3 = 2;
_local4 = 600;
_local5 = ((_local2 * 600) + 8000);
} else {
_local3 = 3;
_local4 = 5000;
_local5 = ((_local2 * 5000) + 30000);
};
};
waves.push(new Wave(_local2, _local4, _local3, _local5));
} else {
if (_local1 == 3){
_local2 = generateIntFrom(5, 10);
if (_local6 > 0.6666){
_local3 = 1;
_local4 = 1000;
_local5 = ((_local2 * 1000) + 20000);
} else {
if (_local6 > 0.3333){
_local2 = generateIntFrom(30, 40);
_local3 = 2;
_local4 = 600;
_local5 = ((_local2 * 600) + 8000);
} else {
_local3 = 3;
_local4 = 5000;
_local5 = ((_local2 * 5000) + 20000);
};
};
waves.push(new Wave(_local2, _local4, _local3, _local5));
} else {
if (_local1 == 4){
if (_local6 > 0.6666){
_local2 = generateIntFrom(10, 20);
_local3 = 1;
_local4 = 800;
_local5 = ((_local2 * 800) + 20000);
} else {
if (_local6 > 0.3333){
_local2 = generateIntFrom(20, 40);
_local3 = 2;
_local4 = 400;
_local5 = ((_local2 * 400) + 8000);
} else {
_local2 = generateIntFrom(5, 10);
_local3 = 3;
_local4 = 4000;
_local5 = ((_local2 * 4000) + 15000);
};
};
waves.push(new Wave(_local2, _local4, _local3, _local5));
};
};
};
};
_local7++;
};
}
}
}//package
Section 78
//level7BoundingBox (level7BoundingBox)
package {
import flash.display.*;
public dynamic class level7BoundingBox extends MovieClip {
}
}//package
Section 79
//LevelComplete (LevelComplete)
package {
import flash.display.*;
public dynamic class LevelComplete extends MovieClip {
public var nextLevel2:SimpleButton;
public var levelSelect2:SimpleButton;
public var levelSelectTemp:SimpleButton;
public var nextLevelTemp:SimpleButton;
public function LevelComplete(){
addFrameScript(46, frame47);
}
function frame47(){
stop();
}
}
}//package
Section 80
//LevelSelect (LevelSelect)
package {
import flash.display.*;
public dynamic class LevelSelect extends MovieClip {
public function LevelSelect(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 81
//LevelUp (LevelUp)
package {
import flash.display.*;
public dynamic class LevelUp extends MovieClip {
public function LevelUp(){
addFrameScript(0, frame1, 25, frame26);
}
function frame1(){
mouseEnabled = false;
}
function frame26(){
stop();
MovieClip(parent).removeChild(this);
}
}
}//package
Section 82
//LevelUpSound (LevelUpSound)
package {
import flash.media.*;
public dynamic class LevelUpSound extends Sound {
}
}//package
Section 83
//LoseScreen (LoseScreen)
package {
import flash.display.*;
public dynamic class LoseScreen extends MovieClip {
public var retryLevel3:SimpleButton;
public var levelSelect3:SimpleButton;
public var levelSelectTemp:SimpleButton;
public var retryLevelTemp:SimpleButton;
public function LoseScreen(){
addFrameScript(46, frame47);
}
function frame47(){
stop();
}
}
}//package
Section 84
//main (main)
package {
import flash.events.*;
import flash.display.*;
import flash.ui.*;
import flash.net.*;
public class main extends MovieClip {
var myMenu:ContextMenu;
var kbTotal:int;// = 0
var kbLoaded:int;// = 0
var loadBarWidth:int;// = 0
public var game:mainGame;
public function main():void{
var _local1:ContextMenuItem;
loadBarWidth = 0;
kbLoaded = 0;
kbTotal = 0;
myMenu = new ContextMenu();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
myMenu.hideBuiltInItems();
_local1 = new ContextMenuItem("Play More Games");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, gotoNG);
myMenu.customItems.push(_local1);
this.contextMenu = myMenu;
}
public function gotoNG(_arg1:ContextMenuEvent):void{
var _local2:String;
var _local3:URLRequest;
_local2 = "http://www.newgrounds.com";
_local3 = new URLRequest(_local2);
navigateToURL(_local3, "_blank");
}
function frame3(){
stage.frameRate = 24;
}
function frame1(){
stop();
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(1235);
}
function frame4(){
stop();
}
public function loadProgress(_arg1:Event):void{
}
function frame2(){
stop();
}
}
}//package
Section 85
//mainGame (mainGame)
package {
import flash.events.*;
import flash.display.*;
import fl.transitions.easing.*;
import fl.transitions.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.filters.*;
public class mainGame extends MovieClip {
public var hiddenAwards:Array;
var TimerBonus:Array;
var clockTime:Timer;
var currentWave:Wave;
var RanB:Array;
public var toLevelSelect:SimpleButton;
var kbTotal:int;// = 0
public var buildInfo:TextField;
public var musicIcon:MusicIcon;
var kbLoaded:int;// = 0
public var qualityBox:MovieClip;
public var nextLevel:SimpleButton;
var resourceItems:Array;
var enemiesSpawned:int;// = 0
var enemyDispatchTimer:Timer;
var towerTops:Array;
public var i:int;
var j:int;// = 0
public var moreGames:SimpleButton;
var baseMoney:int;// = 1000
var enemyhpMultiplier:Number;// = 1
var music_is_playing:Boolean;// = false
public var mainMenu3:SimpleButton;
public var mainMenu4:SimpleButton;
public var mainMenu5:SimpleButton;
var loadBarWidth:int;
public var mainMenu2:SimpleButton;
var defaultStatsString:String;// = ""
var levelTime:int;// = 0
public var credits:SimpleButton;
public var enemyTimer:MovieClip;
var r:int;// = 0
public var structuresRight:SimpleButton;
var stats:Object;
var resourceBonus:int;// = 0
var awardSound:Sound;
public var stuff2:TextField;
public var stuff3:TextField;
var money:int;
var is_hovered:Boolean;// = false
var index:int;// = 0
var sellSound:Sound;
public var moneyBox:TextField;
var levelComplete:MovieClip;
var envEffect:MovieClip;
public var qualityButton:MovieClip;
var gameIsPaused:Boolean;// = false
public var statistics:SimpleButton;
public var timeDisplay:MovieClip;
public var weatherBox:MovieClip;
var towerBuildIcons:Array;
var tweensStopped:Boolean;// = false
var durationTween:Tween;
var currently_placing_item:Boolean;// = false
var releaseCount:int;// = 0
public var soundToggle:sfxIcon;
var survivalScreen;
var soundChannel:SoundChannel;
var resourceIndex:int;// = 0
public var musicBox:MovieClip;
public var moneyIcon:Coins;
public var introLoad:SimpleButton;
var levels:Array;
var lastBuild:MovieClip;
var levelsUnlocked:int;// = 1
var defaultDataString:String;// = ""
public var structuresLeft:SimpleButton;
var currentLevel:int;// = 0
public var infoBox2:TextField;
public var infoBox1:TextField;
public var levelSelect:LevelSelect;
public var instructions:SimpleButton;
public var resourceIcon:MovieClip;
var autosave_enabled:Boolean;// = true
public var towersLeft:SimpleButton;
public var towersRight:SimpleButton;
public var trainingBuild:MovieClip;
public var awards:SimpleButton;
var theme:Sound;
public var instructionsPage:MovieClip;
var durationTween2:Tween;
var gameTime:Timer;
public var mineBuild:MovieClip;
var sell_shown:Boolean;// = false
var t1s:Boolean;// = false
var cancelicon:MovieClip;
public var stuff:TextField;
var t2s:Boolean;// = false
var ABPL:Array;
var clockValue:int;// = 0
public var bottombar:bottomBar;
var t3s:Boolean;// = false
var resources:int;
var envEffectsEnabled:Boolean;// = true
var RB:Array;
var t4s:Boolean;// = false
var enemies:Array;
public var soundBox:MovieClip;
public var nextAchievement:SimpleButton;
public var tower1:MovieClip;
public var tower2:MovieClip;
public var tower3:MovieClip;
public var tower4:MovieClip;
public var specialBox:MovieClip;
var t5s:Boolean;// = false
var award:Object;
var baseResources:int;// = 10000
var enemiesKilled:int;// = 0
var overlapping:Boolean;// = false
var shift_is_held:Boolean;// = false
var towers:Array;
var glow_enabled:Boolean;// = true
public var levelSelect2:SimpleButton;
var winSound;
public var topbar:topBar;
public var options:SimpleButton;
var towerPriceReduction:int;// = 0
public var mainMenu:SimpleButton;
public var previousLevel:SimpleButton;
var timerDecrement:int;// = 0
var ranges:Array;
var towersCheated:int;// = 0
public var resourceBox:TextField;
var soundEffectsEnabled:Boolean;// = true
var baseTimer:int;// = 1000
var defaultBuildInfoString:String;// = ""
public var mainMenu22:SimpleButton;
var sellIcon:MovieClip;
public var goal:MovieClip;
var savedGame:SharedObject;
var awardSplash:MovieClip;
var bestScore:int;// = 0
var modCount:int;// = 1
var currentlyHovered:MovieClip;// = null
var moneyBonus:int;// = 0
var timer:Timer;
var confirmScreen;
var glowIndex:Array;
var currently_placing_tower:Boolean;// = false
var structurePriceReduction:int;// = 0
var delayTimer:Timer;
public var awardsUnlockedText:TextField;
var enemiesStarted:Boolean;// = false
var tweensStopped2:Boolean;// = true
var frameCount:int;// = 0
public var selcuck:SimpleButton;
public var achievementsMC:Achievements;
public var previousAchievement:SimpleButton;
public var introPlay:SimpleButton;
var musicDisabled:Boolean;// = false
var enemiesStartedSrsly:Boolean;// = false
var currentObjective:String;// = "Default Objective"
public var clearButton:SimpleButton;
var loseScreen:MovieClip;
public var farmBuild:MovieClip;
var errorSound;
var resourceBuildIcons:Array;
public function mainGame():void{
baseMoney = 1000;
money = baseMoney;
baseResources = 10000;
resources = baseResources;
baseTimer = 1000;
gameTime = new Timer(baseTimer);
towers = new Array();
ranges = new Array();
index = 0;
enemiesKilled = 0;
overlapping = false;
currentLevel = 0;
enemiesStarted = false;
enemiesSpawned = 0;
releaseCount = 0;
modCount = 1;
defaultBuildInfoString = "";
cancelicon = new cancelIcon();
timerDecrement = 0;
enemyhpMultiplier = 1;
levels = new Array();
towerTops = new Array();
resourceItems = new Array();
resourceIndex = 0;
defaultDataString = "";
defaultStatsString = "";
sellIcon = new SellAU();
is_hovered = false;
currentlyHovered = null;
sell_shown = false;
timer = new Timer(baseTimer, 10);
enemies = new Array();
levelComplete = new MovieClip();
currently_placing_tower = false;
currently_placing_item = false;
currentObjective = "Default Objective";
gameIsPaused = false;
tweensStopped = false;
tweensStopped2 = true;
delayTimer = new Timer(baseTimer, 10);
t1s = false;
t2s = false;
t3s = false;
t4s = false;
t5s = false;
loseScreen = new LoseScreen();
music_is_playing = false;
enemiesStartedSrsly = false;
envEffect = new Empty();
envEffectsEnabled = true;
soundEffectsEnabled = true;
savedGame = SharedObject.getLocal("playerdata");
autosave_enabled = true;
awardSplash = new Award("test");
kbLoaded = 0;
kbTotal = 0;
towerBuildIcons = new Array();
resourceBuildIcons = new Array();
r = 0;
j = 0;
glow_enabled = true;
enemyDispatchTimer = new Timer(1000, 2);
clockTime = new Timer(1000);
clockValue = 0;
musicDisabled = false;
confirmScreen = new confirmClear();
towersCheated = 0;
shift_is_held = false;
frameCount = 0;
levelTime = 0;
bestScore = 0;
survivalScreen = new SurvivalComplete();
errorSound = new ErrorSound();
winSound = new WinSound();
stats = new Object();
award = new Object();
ABPL = new Array(1, 1, 1, 1);
RB = new Array(1, 1, 1, 1);
RanB = new Array(1, 1, 1, 1);
TimerBonus = new Array(1, 1, 1, 1, 1);
towerPriceReduction = 0;
structurePriceReduction = 0;
moneyBonus = 0;
resourceBonus = 0;
levelsUnlocked = 1;
glowIndex = new Array();
super();
addFrameScript(0, frame1, 10, frame11, 20, frame21, 30, frame31, 40, frame41, 50, frame51, 60, frame61, 70, frame71, 80, frame81);
awardSplash.stop();
levels.push(new Level1(), new Level2(), new Level3(), new Level4(), new Level5(), new Level6(), new Level7());
stage.addEventListener(KeyboardEvent.KEY_DOWN, debugTrace, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, unDebugTrace, false, 0, true);
theme = new Theme();
sellSound = new SellSound();
awardSound = new AwardSound();
initializeStats();
initializeAwardData();
survivalScreen.stop();
stop();
}
public function updateQuality():void{
if (stage.quality == "LOW"){
qualityBox.gotoAndStop(3);
} else {
if (stage.quality == "MEDIUM"){
qualityBox.gotoAndStop(2);
} else {
qualityBox.gotoAndStop(1);
};
};
}
public function fixButtons2():void{
if (achievementsMC.currentFrame == 1){
previousAchievement.alpha = 0;
previousAchievement.mouseEnabled = false;
} else {
previousAchievement.alpha = 1;
previousAchievement.mouseEnabled = true;
};
if (achievementsMC.currentFrame == achievementsMC.totalFrames){
nextAchievement.alpha = 0;
nextAchievement.mouseEnabled = false;
} else {
nextAchievement.alpha = 1;
nextAchievement.mouseEnabled = true;
};
if (achievementsMC.currentFrame == 39){
if (((hiddenAwards[41]) && (hiddenAwards[42]))){
nextAchievement.alpha = 0;
nextAchievement.mouseEnabled = false;
};
};
if (achievementsMC.currentFrame == 40){
if (hiddenAwards[42]){
nextAchievement.alpha = 0;
nextAchievement.mouseEnabled = false;
};
};
}
public function fixCancelIcon():void{
cancelicon.alpha = 0.2;
removeEventListener(Event.ENTER_FRAME, checkOverlap);
defaultBuildInfoString = "";
updateBuildInfo();
}
public function unpauseTowers():void{
var _local1:int;
if (ranges.length > 0){
_local1 = 0;
while (_local1 < ranges.length) {
if (!ranges[_local1].deleted){
ranges[_local1].unpauseSelf();
};
_local1++;
};
};
}
public function cancelBuild(_arg1:Event):void{
if (cancelicon.hitTestObject(towers[(towers.length - 1)])){
cancelicon.removeEventListener(Event.ENTER_FRAME, cancelBuild);
removeEventListener(Event.ENTER_FRAME, checkOverlap);
towers[(towers.length - 1)].deleteSelf();
ranges[(ranges.length - 1)].deleteSelf();
towers.splice((towers.length - 1), 1);
ranges.splice((ranges.length - 1), 1);
currentlyHovered = null;
currently_placing_tower = false;
Mouse.show();
fixCancelIcon();
index--;
};
}
public function previousIcon(_arg1:MouseEvent):void{
if (levelSelect.currentFrame != 1){
levelSelect.gotoAndStop((levelSelect.currentFrame - 1));
};
fixButtons();
}
public function startWin():void{
if (!levels[(currentLevel - 1)].timerWon){
levels[(currentLevel - 1)].timerWon = true;
levels[(currentLevel - 1)].startWin();
};
}
public function pauseTowers():void{
var _local1:int;
if (ranges.length > 0){
_local1 = 0;
while (_local1 < ranges.length) {
if (!ranges[_local1].deleted){
ranges[_local1].pauseSelf();
};
_local1++;
};
};
}
public function gotoAchievements(_arg1:MouseEvent):void{
awards.removeEventListener(MouseEvent.MOUSE_UP, gotoAchievements);
gotoAndStop("achievements");
}
public function pauseResource():void{
var _local1:int;
if (resourceItems.length > 0){
_local1 = 0;
while (_local1 < resourceItems.length) {
if (!resourceItems[_local1].deleted){
resourceItems[_local1].pauseSelf();
};
_local1++;
};
};
}
public function previousA(_arg1:MouseEvent):void{
if (achievementsMC.currentFrame != 1){
if (hiddenAwards[achievementsMC.currentFrame]){
achievementsMC.gotoAndStop((achievementsMC.currentFrame - 2));
} else {
achievementsMC.gotoAndStop((achievementsMC.currentFrame - 1));
};
};
fixButtons2();
}
public function removeGlow():void{
var _local1:int;
if (glow_enabled){
_local1 = 0;
while (_local1 < towers.length) {
handleRemove(_local1);
_local1++;
};
};
}
public function hideResourceInfo(_arg1:MouseEvent):void{
buildInfo.text = defaultBuildInfoString;
}
function frame11(){
mainMenu5.addEventListener(MouseEvent.MOUSE_UP, gotoIntro);
}
public function castleAward():void{
if (!award.levelTenCastle){
award.levelTenCastle = true;
awardUnlocked("DECAMACDUFF");
};
}
public function timeToString():String{
var _local1:String;
var _local2:String;
if (clockValue >= 3600){
return (((((int((clockValue / 3600)) + ":") + int((clockValue / (clockValue % 3600)))) + ":") + (int((clockValue / (clockValue % 3600))) % 60)));
};
if (clockValue >= 60){
if (int((clockValue / 60)) < 10){
_local1 = ("0" + int((clockValue / 60)));
} else {
_local1 = ("" + int((clockValue / 60)));
};
if ((clockValue % 60) < 10){
_local2 = ("0" + (clockValue % 60));
} else {
_local2 = ("" + int((clockValue % 60)));
};
return (((("00:" + _local1) + ":") + _local2));
//unresolved jump
};
if (clockValue > 0){
if (clockValue < 10){
return (("00:00:0" + clockValue));
};
return (("00:00:" + clockValue));
//unresolved jump
};
return ("00:00:00");
}
function frame1(){
introPlay.addEventListener(MouseEvent.MOUSE_UP, gotoGame7);
introLoad.addEventListener(MouseEvent.MOUSE_UP, loadAndGotoGame);
if (!!((savedGame.data.stats == undefined))){
introLoad.mouseEnabled = false;
introLoad.alpha = 0.2;
introLoad.removeEventListener(MouseEvent.MOUSE_UP, loadAndGotoGame);
};
}
public function stopEnemyScan():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((((((_local2 is Enemy1)) || ((_local2 is Enemy2)))) || ((_local2 is Enemy3)))){
if (((!((_local2.dx == 0))) || (!((_local2.dy == 0))))){
_local2.pauseSelf();
_local2.dx = 0;
_local2.dy = 0;
};
};
_local1++;
};
}
public function fixLevel():void{
if (envEffect.parent != null){
removeChild(envEffect);
};
enemyDispatchTimer.removeEventListener(TimerEvent.TIMER, dispatchEnemy);
removeChild(levels[(currentLevel - 1)]);
}
public function awardUnlocked(_arg1:String):void{
if (soundEffectsEnabled){
awardSound.play();
};
awardSplash = new Award(_arg1);
awardSplash.x = 400;
awardSplash.y = 300;
addChild(awardSplash);
stats.awardsUnlocked++;
}
function frame21(){
nextLevel.addEventListener(MouseEvent.MOUSE_UP, nextIcon, false, 0, true);
previousLevel.addEventListener(MouseEvent.MOUSE_UP, previousIcon, false, 0, true);
levelSelect.addEventListener(MouseEvent.MOUSE_UP, selectLevel, false, 0, true);
mainMenu.addEventListener(MouseEvent.MOUSE_UP, gotoMainMenu, false, 0, true);
levelSelect.addEventListener(MouseEvent.MOUSE_OVER, enlargeSelect, false, 0, true);
levelSelect.addEventListener(MouseEvent.MOUSE_OUT, delargeSelect, false, 0, true);
if (cancelicon.parent == this){
removeChild(cancelicon);
};
setLevelSelect();
fixButtons();
}
public function levelSelectFromGame(_arg1:MouseEvent):void{
toLevelSelect.removeEventListener(MouseEvent.MOUSE_OUT, levelSelectFromGame);
loseToMenu();
}
public function manageGlow():void{
placeGlow();
removeGlow();
}
function determineHP(_arg1:MovieClip):int{
return ((((((levels[(currentLevel - 1)].wavesSpawned + 1) * (levels[(currentLevel - 1)].wavesSpawned + 1)) * _arg1.hp_modifier) + 1) * levels[(currentLevel - 1)].enemyhpMultiplier));
}
public function unpauseGame():void{
unpauseTimers();
unpauseEnemies();
unpauseTowers();
unpauseResource();
}
public function towerPlaced(_arg1:MovieClip):void{
stats.totalTowersPlaced++;
addEventListener(Event.ENTER_FRAME, duplicateTower, false, 0, true);
if (_arg1.towerID == 1){
stats.circleTowersPlaced++;
lastBuild = new circleTowerBuild();
} else {
if (_arg1.towerID == 2){
stats.squareTowersPlaced++;
lastBuild = new squareTowerBuild();
} else {
if (_arg1.towerID == 3){
stats.pentagonTowersPlaced++;
lastBuild = new pentagonTowerBuild();
} else {
if (_arg1.towerID == 4){
stats.cannonTowersPlaced++;
lastBuild = new cannonTowerBuild();
};
};
};
};
checkForAwards();
}
function checkForAugment():void{
var _local1:int;
_local1 = 0;
while (_local1 < (ranges.length - 1)) {
if (((ranges[_local1].isPentagonTower) && (!(ranges[_local1].deleted)))){
ranges[_local1].updateAugment();
};
_local1++;
};
}
public function decrementClockTime(_arg1:TimerEvent):void{
clockValue--;
if (clockValue == 0){
survivalComplete();
};
setClockTime();
if (currentFrame == 31){
levels[(currentLevel - 1)].checkForVictory();
};
}
function frame31(){
buildInfo.text = defaultBuildInfoString;
infoBox1.text = "";
infoBox2.text = "";
moneyBox.text = ("" + money);
resourceBox.text = ("" + resources);
enemyTimer.timeBar.width = 180;
enemyTimer.maskBar.width = 180;
cancelicon.x = 750;
cancelicon.scaleX = 0.75;
cancelicon.scaleY = 0.75;
cancelicon.y = 436;
cancelicon.alpha = 0.2;
addChild(cancelicon);
moneyIcon.addEventListener(MouseEvent.MOUSE_OVER, displayMoneyInfo, false, 0, true);
moneyIcon.addEventListener(MouseEvent.MOUSE_OUT, hideMoneyInfo, false, 0, true);
resourceIcon.addEventListener(MouseEvent.MOUSE_OVER, displayResourceInfo, false, 0, true);
resourceIcon.addEventListener(MouseEvent.MOUSE_OUT, hideResourceInfo, false, 0, true);
toLevelSelect.addEventListener(MouseEvent.MOUSE_UP, levelSelectFromGame, false, 0, true);
addEventListener(Event.ENTER_FRAME, updateStats, false, 0, true);
tower1 = new circleTowerBuild();
tower2 = new squareTowerBuild();
tower3 = new pentagonTowerBuild();
tower4 = new cannonTowerBuild();
towerBuildIcons.push(tower1, tower2, tower3, tower4);
mineBuild = new MineBuild();
trainingBuild = new TrainingBuild();
farmBuild = new FarmBuild();
resourceBuildIcons.push(farmBuild, mineBuild, trainingBuild);
if (currentLevel == 3){
resourceBuildIcons.push(new Landmark1Build());
} else {
if (currentLevel == 5){
resourceBuildIcons.push(new Landmark2Build());
};
};
j = 0;
while (j <= (towerBuildIcons.length - 1)) {
towerBuildIcons[j].stop();
towerBuildIcons[j].x = 60;
towerBuildIcons[j].y = 422;
j++;
};
j = 0;
addChild(towerBuildIcons[j]);
towerBuildIcons[j].initialize();
towersRight.addEventListener(MouseEvent.MOUSE_UP, nextTowerIcon, false, 0, true);
towersLeft.addEventListener(MouseEvent.MOUSE_UP, previousTowerIcon, false, 0, true);
r = 0;
while (r <= (resourceBuildIcons.length - 1)) {
resourceBuildIcons[r].stop();
resourceBuildIcons[r].x = 180;
resourceBuildIcons[r].y = 422;
r++;
};
r = 0;
addChild(resourceBuildIcons[r]);
resourceBuildIcons[r].initialize();
structuresRight.addEventListener(MouseEvent.MOUSE_UP, nextItemIcon, false, 0, true);
structuresLeft.addEventListener(MouseEvent.MOUSE_UP, previousItemIcon, false, 0, true);
goal = new Objective();
goal.x = 400;
goal.y = 225;
addChild(goal);
}
public function showCastleInfo(_arg1:MouseEvent):void{
levels[(currentLevel - 1)].castle.displayInfo2();
}
public function levelTenTower(_arg1:MovieClip):void{
stats.levelTenTowers++;
if (_arg1.towerID == 1){
stats.circleTowerTens++;
} else {
if (_arg1.towerID == 2){
stats.squareTowerTens++;
} else {
if (_arg1.towerID == 3){
stats.pentagonTowerTens++;
} else {
if (_arg1.towerID == 4){
stats.cannonTowerTens++;
};
};
};
};
}
function determineAttack(_arg1:MovieClip):int{
return ((((levels[(currentLevel - 1)].wavesSpawned + 1) * _arg1.damage_modifier) + 3));
}
public function sellResourceItem(_arg1:int):void{
resources = (resources + resourceItems[_arg1].getPriceToSell());
updateAmounts();
if (soundEffectsEnabled){
sellSound.play();
};
resourceItems[_arg1].deleteSelf();
}
public function duplicateTower(_arg1:Event):void{
frameCount++;
if (frameCount >= 3){
removeEventListener(Event.ENTER_FRAME, duplicateTower);
frameCount = 0;
if (shift_is_held){
if (lastBuild.is_item){
buildNewItem(lastBuild);
} else {
buildNewTower(lastBuild);
};
};
};
}
function frame51(){
levelSelect2.addEventListener(MouseEvent.MOUSE_UP, gotoLevelSelect2, false, 0, true);
awards.addEventListener(MouseEvent.MOUSE_UP, gotoAchievements, false, 0, true);
statistics.addEventListener(MouseEvent.MOUSE_UP, gotoStatistics, false, 0, true);
instructions.addEventListener(MouseEvent.MOUSE_UP, gotoInstructions, false, 0, true);
options.addEventListener(MouseEvent.MOUSE_UP, gotoOptions, false, 0, true);
credits.addEventListener(MouseEvent.MOUSE_UP, gotoCredits, false, 0, true);
moreGames.addEventListener(MouseEvent.MOUSE_UP, gotoNG, false, 0, true);
saveGame();
if (!musicDisabled){
playMusic();
};
}
public function handleRemove(_arg1:int):void{
if (glow_enabled){
if (((((!(towers[_arg1].deleted)) && (!(towers[_arg1].augmentedRate)))) && (towers[_arg1].has_glow))){
if (glowIndex[_arg1] != null){
removeChild(glowIndex[_arg1]);
glowIndex[_arg1] = null;
};
towers[_arg1].has_glow = false;
};
};
}
function frame41(){
mainMenu2.addEventListener(MouseEvent.MOUSE_UP, gotoMainMenu2, false, 0, true);
nextAchievement.addEventListener(MouseEvent.MOUSE_UP, nextA, false, 0, true);
previousAchievement.addEventListener(MouseEvent.MOUSE_UP, previousA, false, 0, true);
initializeAwardsUnlocked();
hiddenAwards = new Array();
i = 0;
while (i < 44) {
hiddenAwards.push(false);
i++;
};
if (!award.ultimateFail){
hiddenAwards[41] = true;
} else {
hiddenAwards[41] = false;
};
if (!award.pumpkinEater){
hiddenAwards[42] = true;
} else {
hiddenAwards[42] = false;
};
hiddenAwards[43] = true;
fixButtons2();
}
public function unpauseEnemies():void{
var _local1:int;
if (enemies.length > 0){
_local1 = 0;
while (_local1 < enemies.length) {
if (enemies[_local1].is_alive){
enemies[_local1].unpauseSelf();
};
_local1++;
};
};
}
public function changeQualityFromOptions(_arg1:MouseEvent):void{
changeQuality();
updateQuality();
}
function frame61(){
mainMenu3.addEventListener(MouseEvent.MOUSE_UP, gotoMainMenu3, false, 0, true);
setStatistics();
}
public function displayLevelUpText(_arg1:int, _arg2:int, _arg3:Boolean):void{
var _local4:MovieClip;
var _local5:MovieClip;
if (_arg3){
_local4 = new LevelUp();
_local4.x = _arg1;
_local4.y = _arg2;
_local4.scaleX = 0.7;
_local4.scaleY = 0.7;
addChild(_local4);
} else {
_local5 = new TurretLevel();
_local5.x = _arg1;
_local5.y = _arg2;
_local5.scaleX = 1;
_local5.scaleY = 1;
addChild(_local5);
};
}
public function destroyBuildIcons():void{
towerBuildIcons[j].destroy();
removeChild(towerBuildIcons[j]);
resourceBuildIcons[r].destroy();
removeChild(resourceBuildIcons[r]);
}
public function delargeSelect(_arg1:MouseEvent):void{
if (levelSelect != null){
levelSelect.scaleX = 1;
levelSelect.scaleY = 1;
};
}
public function fixVariables():void{
money = baseMoney;
currentlyHovered = null;
resources = baseResources;
index = 0;
enemiesKilled = 0;
overlapping = false;
enemiesStarted = false;
enemiesSpawned = 0;
releaseCount = 0;
modCount = 1;
gameTime = new Timer(baseTimer);
gameTime.reset();
timer = new Timer(baseTimer, 10);
timer = new Timer(baseTimer, 10);
timer.reset();
enemiesStartedSrsly = false;
enemiesKilled = 0;
timerDecrement = 0;
resourceIndex = 0;
}
function frame71(){
mainMenu4.addEventListener(MouseEvent.MOUSE_UP, gotoMenu, false, 0, true);
clearButton.addEventListener(MouseEvent.MOUSE_UP, clearData, false, 0, true);
updateQuality();
updateSound();
updateMusic();
updateWeather();
updateSpecial();
qualityBox.addEventListener(MouseEvent.MOUSE_UP, changeQualityFromOptions);
soundBox.addEventListener(MouseEvent.MOUSE_UP, changeSoundFromOptions);
musicBox.addEventListener(MouseEvent.MOUSE_UP, changeMusicFromOptions);
weatherBox.addEventListener(MouseEvent.MOUSE_UP, changeWeatherFromOptions);
specialBox.addEventListener(MouseEvent.MOUSE_UP, changeSpecialFromOptions);
}
public function showSellIcon(_arg1:Event):void{
if (is_hovered){
if ((((((((mouseX < (currentlyHovered.x - (currentlyHovered.width / 2)))) || ((mouseX > (currentlyHovered.x + (currentlyHovered.width / 2)))))) || ((mouseY > (currentlyHovered.y + (currentlyHovered.height / 2)))))) || ((mouseY < (currentlyHovered.y - (currentlyHovered.height / 2)))))){
if (sellIcon.parent == this){
removeChild(sellIcon);
};
is_hovered = false;
if (currentlyHovered != null){
currentlyHovered.stopInfoNoEvent();
};
currentlyHovered = null;
Mouse.show();
} else {
sellIcon.x = mouseX;
sellIcon.y = mouseY;
sellIcon.amount.text = ("+" + getPriceToSell());
};
} else {
removeEventListener(Event.ENTER_FRAME, showSellIcon);
removeEventListener(MouseEvent.MOUSE_DOWN, sellTower);
sell_shown = false;
if (currentlyHovered != null){
currentlyHovered.stopInfoNoEvent();
};
};
}
public function levelGained(_arg1:MovieClip):void{
stats.levelsGained++;
if (_arg1.towerID == 1){
stats.circleTowerLevels++;
} else {
if (_arg1.towerID == 2){
stats.squareTowerLevels++;
} else {
if (_arg1.towerID == 3){
stats.pentagonTowerLevels++;
} else {
if (_arg1.towerID == 4){
stats.cannonTowerLevels++;
};
};
};
};
checkForAwards();
}
public function changeSpecialFromOptions(_arg1:MouseEvent):void{
if (glow_enabled){
glow_enabled = false;
} else {
glow_enabled = true;
};
updateSpecial();
}
public function deleteAllTowerTops():void{
var _local1:int;
if (towerTops.length > 0){
_local1 = 0;
while (_local1 < towerTops.length) {
if (!towerTops[_local1].deleted){
towerTops[_local1].deleteSelf();
};
towerTops[_local1] = null;
_local1++;
};
towerTops = new Array();
};
}
public function resumeEnemies(_arg1:TimerEvent):void{
delayTimer.reset();
delayTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, resumeEnemies);
defaultBuildInfoString = "";
updateBuildInfo();
timer.start();
}
public function gotoMainMenu(_arg1:MouseEvent):void{
mainMenu.removeEventListener(MouseEvent.MOUSE_UP, gotoMainMenu);
gotoAndStop("mainMenu");
}
public function beginEnemies():void{
levels[(currentLevel - 1)].hasStarted = true;
if (((towers[0].is_placed) && (!(enemiesStarted)))){
if (!clockTime.running){
clockTime.removeEventListener(TimerEvent.TIMER, incrementClockTime);
clockTime.removeEventListener(TimerEvent.TIMER, decrementClockTime);
startClockTime();
};
enemiesStarted = true;
towersCheated++;
initializeTimers();
};
}
public function resetMaskBar(_arg1:Event):void{
durationTween2.removeEventListener("motionFinish", resetMaskBar);
enemyTimer.maskBar.width = 180;
}
public function showIncrementMoneyText(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:MovieClip;
_local4 = new animateAU();
_local4.x = _arg1;
_local4.scaleX = 0.2;
_local4.scaleY = 0.2;
_local4.y = _arg2;
_local4.auIcon.auIconText.text = ("+" + _arg3);
addChild(_local4);
}
public function incrementClockTime(_arg1:TimerEvent):void{
var _local2:int;
var _local3:int;
clockValue++;
setClockTime();
if (currentFrame == 31){
levels[(currentLevel - 1)].checkForVictory();
};
if (((((!(award.survival1)) && ((currentLevel == 7)))) && ((clockValue >= 600)))){
award.survival1 = true;
awardUnlocked("PERCY THE PERSISTENT");
_local2 = 0;
while (_local2 < 4) {
ABPL[_local2] = (ABPL[_local2] + 0.05);
RB[_local2] = (RB[_local2] - 0.05);
RanB[_local2] = (RanB[_local2] + 0.05);
_local2++;
};
} else {
if (((((!(award.survival2)) && ((currentLevel == 7)))) && ((clockValue >= 1200)))){
award.survival2 = true;
awardUnlocked("GRIGORI RASPUTIN");
_local3 = 0;
while (_local3 < 4) {
ABPL[_local3] = (ABPL[_local3] + 0.05);
RB[_local3] = (RB[_local3] - 0.05);
RanB[_local3] = (RanB[_local3] + 0.05);
_local3++;
};
};
};
}
public function cancelBuildItem(_arg1:Event):void{
if (cancelicon.hitTestObject(resourceItems[(resourceItems.length - 1)])){
cancelicon.removeEventListener(Event.ENTER_FRAME, cancelBuildItem);
removeEventListener(Event.ENTER_FRAME, checkItemOverlap);
resourceItems[(resourceItems.length - 1)].deleteSelf();
resourceItems.splice((resourceItems.length - 1), 1);
currentlyHovered = null;
currently_placing_item = false;
Mouse.show();
fixCancelIcon();
resourceIndex--;
};
}
public function deleteAllEnemies():void{
var _local1:int;
if (enemies.length > 0){
_local1 = 0;
while (_local1 < enemies.length) {
if (enemies[_local1].is_alive){
enemies[_local1].deleteSelf();
};
enemies[_local1] = null;
_local1++;
};
};
enemies = new Array();
}
public function updateStats(_arg1:Event):void{
}
public function calculateResources(_arg1:MovieClip):int{
if ((_arg1.maxhp / 2) > 10){
return (((10 + (Math.random() * 10)) * _arg1.resourceModifier));
};
return (((4 + (_arg1.maxhp / 2)) * _arg1.resourceModifier));
}
public function gotoMenu(_arg1:MouseEvent):void{
mainMenu4.removeEventListener(MouseEvent.MOUSE_DOWN, gotoMenu);
gotoAndStop("mainMenu");
}
public function optionSelectedLose(_arg1:MouseEvent):void{
if (_arg1.target == loseScreen.retryLevel3){
unpauseGame();
loseScreen.removeEventListener(MouseEvent.MOUSE_UP, optionSelectedLose);
removeChild(loseScreen);
levels[(currentLevel - 1)].fix();
cleanUp();
levelStart(currentLevel);
gotoAndStop("levelselect");
gotoAndStop("game");
} else {
if (_arg1.target == loseScreen.levelSelect3){
unpauseGame();
loseScreen.removeEventListener(MouseEvent.MOUSE_UP, optionSelectedLose);
removeChild(loseScreen);
levels[(currentLevel - 1)].fix();
backToMenu();
};
};
}
function frame81(){
mainMenu5.addEventListener(MouseEvent.MOUSE_UP, gotoMenu7, false, 0, true);
selcuck.addEventListener(MouseEvent.MOUSE_UP, gotoLink, false, 0, true);
}
public function nextTowerIcon(_arg1:MouseEvent):void{
if (j < (towerBuildIcons.length - 1)){
towerBuildIcons[j].destroy();
removeChild(towerBuildIcons[j]);
j++;
addChild(towerBuildIcons[j]);
towerBuildIcons[j].initialize();
};
}
public function updateBuildInfo():void{
buildInfo.text = defaultBuildInfoString;
}
public function confirmSelected(_arg1:MouseEvent):void{
if (_arg1.target == confirmScreen.yes){
initializeStats();
initializeAwardData();
gotoAndStop("mainMenu");
};
}
public function clearLevelData():void{
stopEnemySpawn();
deleteEventListeners();
deleteAllTowers();
deleteAllTowerTops();
deleteAllResourceItems();
fixLevel();
fixVariables();
destroyBuildIcons();
deleteAllEnemies();
clearGlows();
}
public function showSellIconFromTower(_arg1:MovieClip):void{
if (((!(currently_placing_tower)) && (!(currently_placing_item)))){
is_hovered = true;
if (((!((currentlyHovered == null))) && (!((currentlyHovered == _arg1))))){
currentlyHovered.stopInfoNoEvent();
};
currentlyHovered = _arg1;
sellIcon.x = mouseX;
sellIcon.y = mouseY;
sellIcon.scaleX = 1;
sellIcon.scaleY = 1;
addChild(sellIcon);
handleSell();
};
}
public function initializeTimers():void{
timer.reset();
timer.delay = levels[(currentLevel - 1)].preGameStart;
timer.repeatCount = levels[(currentLevel - 1)].waves.length;
timer.addEventListener(TimerEvent.TIMER, dispatchWave, false, 0, true);
timer.start();
pauseEnemiesFor(timer.delay);
}
public function optionSelectedSurvival(_arg1:MouseEvent):void{
if (_arg1.target == survivalScreen.retry){
unpauseGame();
survivalScreen.removeEventListener(MouseEvent.MOUSE_UP, optionSelectedSurvival);
removeChild(survivalScreen);
levels[(currentLevel - 1)].fix();
cleanUp();
levelStart(currentLevel);
gotoAndStop("levelselect");
gotoAndStop("game");
} else {
if (_arg1.target == survivalScreen.levelSelect2){
unpauseGame();
survivalScreen.removeEventListener(MouseEvent.MOUSE_UP, optionSelectedSurvival);
removeChild(survivalScreen);
levels[(currentLevel - 1)].fix();
backToMenu();
};
};
}
function checkForTowerHit(_arg1:MovieClip):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < towers.length) {
if (((((_arg1.hitTestObject(towers[_local2])) && (!((_arg1 == towers[_local2]))))) && (!(towers[_local2].deleted)))){
return (true);
};
_local2++;
};
return (false);
}
public function forceRemoveGlow(_arg1:int):void{
if (glow_enabled){
if (towers[_arg1].has_glow){
if (glowIndex[_arg1] != null){
removeChild(glowIndex[_arg1]);
glowIndex[_arg1] = null;
};
towers[_arg1].has_glow = false;
};
};
}
public function handleSell():void{
Mouse.hide();
addEventListener(Event.ENTER_FRAME, showSellIcon, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, sellTower, false, 0, true);
sell_shown = true;
currentlyHovered.showInfoNoEvent();
}
public function fixButtons():void{
if (levelSelect.currentFrame == 1){
previousLevel.alpha = 0;
previousLevel.mouseEnabled = false;
} else {
previousLevel.alpha = 1;
previousLevel.mouseEnabled = true;
};
if (levelSelect.currentFrame == 7){
nextLevel.alpha = 0;
nextLevel.mouseEnabled = false;
} else {
if (levelSelect.currentFrame == levelsUnlocked){
nextLevel.alpha = 0.2;
nextLevel.mouseEnabled = false;
} else {
nextLevel.alpha = 1;
nextLevel.mouseEnabled = true;
};
};
}
public function gotoCredits(_arg1:MouseEvent):void{
credits.removeEventListener(MouseEvent.MOUSE_UP, gotoCredits);
gotoAndStop("credits");
}
public function startClockTime():void{
if (clockValue == 0){
clockTime.addEventListener(TimerEvent.TIMER, incrementClockTime, false, 0, true);
} else {
clockTime.addEventListener(TimerEvent.TIMER, decrementClockTime, false, 0, true);
};
clockTime.start();
}
public function setClockTime():void{
timeDisplay.time.text = timeToString();
}
public function updateSound():void{
if (soundEffectsEnabled){
soundBox.gotoAndStop(1);
} else {
soundBox.gotoAndStop(2);
};
}
public function resetTimeBar(_arg1:Event):void{
durationTween.removeEventListener("motionFinish", resetTimeBar);
enemyTimer.timeBar.width = 180;
}
public function buildNewTower(_arg1:MovieClip):void{
var _local2:MovieClip;
var _local3:MovieClip;
if (money >= (_arg1.price - towerPriceReduction)){
currently_placing_tower = true;
cancelicon.x = 750;
cancelicon.scaleX = 0.75;
cancelicon.scaleY = 0.75;
cancelicon.y = 436;
cancelicon.alpha = 1;
addChild(cancelicon);
cancelicon.addEventListener(Event.ENTER_FRAME, cancelBuild, false, 0, true);
defaultBuildInfoString = "Hold shift while placing to build multiple towers. Hover over the 'X' to cancel building.";
updateBuildInfo();
addEventListener(Event.ENTER_FRAME, checkOverlap, false, 0, true);
_local2 = new Range(index);
_local3 = new MovieClip();
if (_arg1.towerID == 1){
_local3 = new circleTower(index);
} else {
if (_arg1.towerID == 2){
_local3 = new squareTower(index);
_local2.isSquareTower = true;
} else {
if (_arg1.towerID == 3){
_local3 = new pentagonTower(index);
_local2.isPentagonTower = true;
} else {
if (_arg1.towerID == 4){
_local3 = new cannonTower(index);
};
};
};
};
index++;
addChildAt(_local2, 1);
addChild(_local3);
towers.push(_local3);
ranges.push(_local2);
_local3.stop();
_local3.x = mouseX;
_local3.y = mouseY;
_local2.stop();
_local2.x = mouseX;
_local2.y = mouseY;
_local3.rate = (_local3.rate * RB[(_local3.towerID - 1)]);
_local3.attack = (_local3.attack * ABPL[(_local3.towerID - 1)]);
_local3.range = (_local3.range * RanB[(_local3.towerID - 1)]);
_local3.setRangeTo(_local3.range);
} else {
if (soundEffectsEnabled){
errorSound.play();
};
};
}
public function loopSong(_arg1:Event):void{
if (soundChannel != null){
soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopSong);
music_is_playing = true;
soundChannel = theme.play();
soundChannel.addEventListener(Event.SOUND_COMPLETE, loopSong, false, 0, true);
};
}
public function getPriceToSell():int{
if (currentlyHovered != null){
return (((currentlyHovered.price * 0.6) + (((currentlyHovered.level * currentlyHovered.level) * 10) / 2)));
};
return (-20000);
}
public function previousTowerIcon(_arg1:MouseEvent):void{
if (j > 0){
towerBuildIcons[j].destroy();
removeChild(towerBuildIcons[j]);
j--;
addChild(towerBuildIcons[j]);
towerBuildIcons[j].initialize();
};
}
public function loseToMenu():void{
levelCleanUp();
levels[(currentLevel - 1)].fix();
backToMenu();
saveGame();
}
public function initializeAwardData():void{
award.circleTowers1 = false;
award.circleTowers2 = false;
award.circleTowers3 = false;
award.squareTowers1 = false;
award.squareTowers2 = false;
award.squareTowers3 = false;
award.pentagonTowers1 = false;
award.pentagonTowers2 = false;
award.pentagonTowers3 = false;
award.cannonTowers1 = false;
award.cannonTowers2 = false;
award.cannonTowers3 = false;
award.farmsPlaced1 = false;
award.farmsPlaced2 = false;
award.farmsPlaced3 = false;
award.minesPlaced1 = false;
award.minesPlaced2 = false;
award.minesPlaced3 = false;
award.trainingCentersPlaced1 = false;
award.trainingCentersPlaced2 = false;
award.trainingCentersPlaced3 = false;
award.allTowersPlaced = false;
award.allResourceItemsPlaced = false;
award.levelTenTowerAward = false;
award.allLevelTenTowers = false;
award.enemiesKilledTier1 = false;
award.enemiesKilledTier2 = false;
award.enemiesKilledTier3 = false;
award.moneyEarned1 = false;
award.moneyEarned2 = false;
award.moneyEarned3 = false;
award.resourcesEarned1 = false;
award.resourcesEarned2 = false;
award.resourcesEarned3 = false;
award.levelTenCastle = false;
award.completedCampaign = false;
award.survival1 = false;
award.survival2 = false;
award.gotAllAwards = false;
award.ultimateFail = false;
award.pumpkinEater = false;
}
public function loadGame():void{
stats = savedGame.data.stats;
award = savedGame.data.award;
ABPL = savedGame.data.ABPL;
RB = savedGame.data.RB;
RanB = savedGame.data.RanB;
TimerBonus = savedGame.data.TimerBonus;
towerPriceReduction = savedGame.data.towerPriceReduction;
structurePriceReduction = savedGame.data.structurePriceReduction;
moneyBonus = savedGame.data.moneyBonus;
resourceBonus = savedGame.data.resourceBonus;
levelsUnlocked = savedGame.data.levelsUnlocked;
}
public function nextIcon(_arg1:MouseEvent):void{
if (levelsUnlocked > levelSelect.currentFrame){
levelSelect.gotoAndStop((levelSelect.currentFrame + 1));
};
fixButtons();
}
function updateAmounts():void{
moneyBox.text = ("" + money);
resourceBox.text = ("" + resources);
}
public function confirmSelected2(_arg1:MouseEvent):void{
if (_arg1.target == confirmScreen.yes){
stats = new Object();
award = new Object();
ABPL = new Array(1, 1, 1, 1);
RB = new Array(1, 1, 1, 1);
RanB = new Array(1, 1, 1, 1);
TimerBonus = new Array(1, 1, 1, 1, 1);
towerPriceReduction = 0;
structurePriceReduction = 0;
moneyBonus = 0;
resourceBonus = 0;
levelsUnlocked = 1;
glowIndex = new Array();
initializeStats();
initializeAwardData();
saveGame();
loadGame();
};
}
public function deleteAllTowers():void{
var _local1:int;
if (towers.length > 0){
_local1 = 0;
while (_local1 < towers.length) {
if (!towers[_local1].deleted){
towers[_local1].deleteSelf();
};
towers[_local1] = null;
_local1++;
};
towers = new Array();
_local1 = 0;
while (_local1 < ranges.length) {
if (!ranges[_local1].deleted){
ranges[_local1].shouldBeStopped = true;
ranges[_local1].deleteSelf();
};
ranges[_local1] = null;
_local1++;
};
};
ranges = new Array();
}
public function cancelBuildItemNoEvent():void{
cancelicon.removeEventListener(Event.ENTER_FRAME, cancelBuildItem);
removeEventListener(Event.ENTER_FRAME, checkItemOverlap);
resourceItems[(resourceItems.length - 1)].deleteSelf();
resourceItems.splice((resourceItems.length - 1), 1);
currentlyHovered = null;
currently_placing_item = false;
Mouse.show();
fixCancelIcon();
resourceIndex--;
}
public function loadAndGotoGame(_arg1:MouseEvent):void{
loadGame();
gotoAndStop("mainMenu");
}
public function unDebugTrace(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 16){
shift_is_held = false;
};
}
function checkOverlap(_arg1:Event):void{
var _local2:Boolean;
var _local3:MovieClip;
_local2 = false;
_local3 = towers[(towers.length - 1)];
if (towers[(towers.length - 1)].is_placed){
removeEventListener(Event.ENTER_FRAME, checkOverlap);
} else {
if (checkForTowerHit(_local3)){
_local2 = true;
} else {
if (checkForResourceItemHit(_local3)){
_local2 = true;
} else {
if (_local3.hitTestObject(topbar)){
_local2 = true;
} else {
if (_local3.hitTestObject(bottombar)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY - (_local3.height / 2)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY + (_local3.height / 2)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX - (_local3.width / 2)), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX + (_local3.width / 2)), mouseY, true)){
_local2 = true;
} else {
if (_local3.hitTestObject(levels[(currentLevel - 1)].castle)){
_local2 = true;
} else {
if ((((mouseX < (_local3.width / 2))) || ((mouseX > (800 - (_local3.width / 2)))))){
_local2 = true;
};
};
};
};
};
};
};
};
};
};
};
overlapping = _local2;
};
}
public function enemyKilled(_arg1:MovieClip):void{
stats.totalEnemiesKilled++;
if (towersCheated > 0){
towersCheated = 0;
};
if (towers[_arg1.index].towerID == 1){
stats.killedByCircle++;
} else {
if (towers[_arg1.index].towerID == 3){
stats.killedByPentagon++;
} else {
if (towers[_arg1.index].towerID == 4){
stats.killedByCannon++;
};
};
};
checkForAwards();
}
public function shotFired(_arg1:MovieClip):void{
stats.totalShotsFired++;
if (towers[_arg1.index].towerID == 1){
stats.shotsFiredByCircle++;
} else {
if (towers[_arg1.index].towerID == 2){
stats.shotsFiredBySquare++;
} else {
if (towers[_arg1.index].towerID == 3){
stats.shotsFiredByPentagon++;
} else {
if (towers[_arg1.index].towerID == 4){
stats.shotsFiredByCannon++;
};
};
};
};
}
public function optionSelected(_arg1:MouseEvent):void{
if (_arg1.target == levelComplete.nextLevel2){
levelComplete.removeEventListener(MouseEvent.MOUSE_UP, optionSelected);
removeChild(levelComplete);
levels[(currentLevel - 1)].fix();
cleanUp();
levelStart((currentLevel + 1));
gotoAndStop("levelselect");
gotoAndStop("game");
} else {
if (_arg1.target == levelComplete.levelSelect2){
levelComplete.removeEventListener(MouseEvent.MOUSE_UP, optionSelected);
removeChild(levelComplete);
levels[(currentLevel - 1)].fix();
backToMenu();
};
};
}
public function nextItemIcon(_arg1:MouseEvent):void{
if (r < (resourceBuildIcons.length - 1)){
resourceBuildIcons[r].destroy();
removeChild(resourceBuildIcons[r]);
r++;
addChild(resourceBuildIcons[r]);
resourceBuildIcons[r].initialize();
};
}
public function backToMenu():void{
cleanUp();
gotoAndStop("levelselect");
}
public function anyEnemiesAlive():Boolean{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((((((_local2 is Enemy1)) || ((_local2 is Enemy2)))) || ((_local2 is Enemy3)))){
if ((((((_local2.x > 0)) && ((_local2.y > 0)))) && ((_local2.hp > 0)))){
return (true);
};
};
_local1++;
};
return (false);
}
public function gotoMainMenu2(_arg1:MouseEvent):void{
mainMenu2.removeEventListener(MouseEvent.MOUSE_UP, gotoMainMenu);
gotoAndStop("mainMenu");
}
public function gotoMainMenu3(_arg1:MouseEvent):void{
mainMenu3.removeEventListener(MouseEvent.MOUSE_UP, gotoMainMenu3);
gotoAndStop("mainMenu");
}
public function previousItemIcon(_arg1:MouseEvent):void{
if (r > 0){
resourceBuildIcons[r].destroy();
removeChild(resourceBuildIcons[r]);
r--;
addChild(resourceBuildIcons[r]);
resourceBuildIcons[r].initialize();
};
}
public function gotoNG(_arg1:MouseEvent):void{
var _local2:String;
var _local3:URLRequest;
_local2 = "http://www.newgrounds.com";
_local3 = new URLRequest(_local2);
navigateToURL(_local3, "_blank");
}
public function initializeAwardsUnlocked():void{
awardsUnlockedText.text = (("" + stats.awardsUnlocked) + "/39 AWARDS UNLOCKED");
}
public function levelWon():void{
stats.successiveLosses = 0;
}
public function hideMoneyInfo(_arg1:MouseEvent):void{
buildInfo.text = defaultBuildInfoString;
}
public function stopEnemySpawn():void{
timer.reset();
}
public function clearGlows():void{
var _local1:int;
_local1 = 0;
while (_local1 < glowIndex.length) {
if (glowIndex[_local1] != null){
removeChild(glowIndex[_local1]);
glowIndex[_local1] = null;
};
_local1++;
};
}
public function pauseNoEvent():void{
}
public function buildNewItem(_arg1:MovieClip):void{
var _local2:MovieClip;
if (resources >= (_arg1.price - structurePriceReduction)){
currently_placing_item = true;
cancelicon.x = 750;
cancelicon.scaleX = 0.75;
cancelicon.scaleY = 0.75;
cancelicon.y = 436;
cancelicon.alpha = 1;
addChild(cancelicon);
cancelicon.addEventListener(Event.ENTER_FRAME, cancelBuildItem, false, 0, true);
defaultBuildInfoString = "Hold shift while placing to build multiple towers. Hover over the 'X' to cancel building.";
updateBuildInfo();
addEventListener(Event.ENTER_FRAME, checkItemOverlap, false, 0, true);
_local2 = new MovieClip();
if (_arg1.itemID == 2){
_local2 = new Mine(resourceIndex);
} else {
if (_arg1.itemID == 3){
_local2 = new TrainingCenter(resourceIndex);
} else {
if (_arg1.itemID == 1){
_local2 = new Farm(resourceIndex);
} else {
if (_arg1.itemID == 4){
_local2 = new Landmark1(resourceIndex);
} else {
if (_arg1.itemID == 5){
_local2 = new Landmark2(resourceIndex);
};
};
};
};
};
resourceIndex++;
addChild(_local2);
resourceItems.push(_local2);
_local2.x = mouseX;
_local2.y = mouseY;
_local2.genericTimer.delay = (_local2.genericTimer.delay * (1 + (1 - TimerBonus[(_local2.itemID - 1)])));
} else {
if (soundEffectsEnabled){
errorSound.play();
};
};
}
function removeHangingSell():void{
if (((((is_hovered) && (!((currentLevel == 2))))) && (!((currentLevel == 6))))){
if (sellIcon.parent == this){
};
removeChild(sellIcon);
if (currentlyHovered != null){
currentlyHovered.stopInfoNoEvent();
};
is_hovered = false;
currentlyHovered = null;
Mouse.show();
};
}
function checkOverlapFinal(_arg1:MovieClip):Boolean{
var _local2:Boolean;
_local2 = false;
if (checkForTowerHit(_arg1)){
_local2 = true;
} else {
if (checkForResourceItemHit(_arg1)){
_local2 = true;
} else {
if (_arg1.hitTestObject(topbar)){
_local2 = true;
} else {
if (_arg1.hitTestObject(bottombar)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, ((mouseY - (_arg1.height / 2)) + 12), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, ((mouseY + (_arg1.height / 2)) - 12), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(((mouseX - (_arg1.width / 2)) + 6), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(((mouseX + (_arg1.width / 2)) - 6), mouseY, true)){
_local2 = true;
} else {
if (_arg1.hitTestObject(levels[(currentLevel - 1)].castle)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY + (_arg1.height / 4)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY - (_arg1.height / 4)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX + (_arg1.width / 4)), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX - (_arg1.width / 4)), mouseY, true)){
_local2 = true;
};
};
};
};
};
};
};
};
};
};
};
};
};
return (_local2);
}
public function levelCleanUp():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < this.numChildren) {
_local2 = this.getChildAt(_local1);
if ((((((_local2 is Enemy1)) || ((_local2 is Enemy2)))) || ((_local2 is Enemy3)))){
_local2.deleteSelf();
_local2 = null;
};
_local1++;
};
}
public function survivalComplete():void{
clockTime.removeEventListener(TimerEvent.TIMER, decrementClockTime);
clockTime.removeEventListener(TimerEvent.TIMER, incrementClockTime);
pauseGame();
startWin();
}
public function gotoInstructions(_arg1:MouseEvent):void{
instructions.removeEventListener(MouseEvent.MOUSE_UP, gotoInstructions);
gotoAndStop("instructions");
}
public function displayXpUpAt(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:MovieClip;
_local4 = new animateXP();
_local4.x = (_arg1 + 30);
_local4.scaleX = 0.2;
_local4.scaleY = 0.2;
_local4.y = (_arg2 - 10);
_local4.xpIcon.xpIconText.text = ("+" + _arg3);
addChild(_local4);
}
function checkForResourceItemHit(_arg1:MovieClip):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < resourceItems.length) {
if (((((_arg1.hitTestObject(resourceItems[_local2])) && (!((_arg1 == resourceItems[_local2]))))) && (!(resourceItems[_local2].deleted)))){
return (true);
};
_local2++;
};
return (false);
}
public function cancelBuildNoEvent():void{
cancelicon.removeEventListener(Event.ENTER_FRAME, cancelBuild);
removeEventListener(Event.ENTER_FRAME, checkOverlap);
towers[(towers.length - 1)].deleteSelf();
ranges[(ranges.length - 1)].deleteSelf();
towers.splice((towers.length - 1), 1);
ranges.splice((ranges.length - 1), 1);
currentlyHovered = null;
currently_placing_tower = false;
Mouse.show();
fixCancelIcon();
index--;
}
public function dispatchWave(_arg1:TimerEvent):void{
if (levels[(currentLevel - 1)].wavesSpawned < levels[(currentLevel - 1)].waves.length){
enemyDispatchTimer.reset();
enemyDispatchTimer.delay = levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].enemyDelay;
enemyDispatchTimer.repeatCount = levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].num_enemies;
enemyDispatchTimer.addEventListener(TimerEvent.TIMER, dispatchEnemy, false, 0, true);
enemyDispatchTimer.addEventListener(TimerEvent.TIMER_COMPLETE, waveComplete, false, 0, true);
enemyDispatchTimer.start();
timer.reset();
if (levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].waveDelay != 241){
timer.delay = levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].waveDelay;
timer.start();
pauseEnemiesFor(timer.delay);
};
};
if (levels[(currentLevel - 1)].wavesSpawned == (levels[(currentLevel - 1)].waves.length - 1)){
timer.removeEventListener(TimerEvent.TIMER, dispatchWave);
timer.stop();
};
}
public function debugTrace(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 16){
shift_is_held = true;
};
if (_arg1.keyCode == Keyboard.SPACE){
};
}
public function unpauseResource():void{
var _local1:int;
if (resourceItems.length > 0){
_local1 = 0;
while (_local1 < resourceItems.length) {
if (!resourceItems[_local1].deleted){
resourceItems[_local1].unpauseSelf();
};
_local1++;
};
};
}
public function cleanUp():void{
Mouse.show();
clockTime.removeEventListener(TimerEvent.TIMER, incrementClockTime);
clockTime.addEventListener(TimerEvent.TIMER, decrementClockTime);
if (((enemiesStarted) && ((towers[(towers.length - 1)].is_placed == false)))){
addChildAt(cancelicon, 0);
towers[(towers.length - 1)].deleteSelf();
ranges[(ranges.length - 1)].deleteSelf();
towers.splice((towers.length - 1), 1);
ranges.splice((ranges.length - 1), 1);
Mouse.show();
fixCancelIcon();
index--;
};
if (awardSplash.parent != null){
awardSplash.stop();
removeChild(awardSplash);
};
clockTime.stop();
clearLevelData();
fixVariables();
}
public function lostLevel():void{
stats.successiveLosses++;
}
public function gotoIntro(_arg1:MouseEvent):void{
gotoAndStop("mainMenu");
removeEventListener(MouseEvent.MOUSE_UP, gotoIntro);
}
public function changeWeatherFromOptions(_arg1:MouseEvent):void{
if (envEffectsEnabled){
envEffectsEnabled = false;
} else {
envEffectsEnabled = true;
};
updateWeather();
}
public function changeSoundFromOptions(_arg1:MouseEvent):void{
if (soundEffectsEnabled){
soundEffectsEnabled = false;
} else {
soundEffectsEnabled = true;
};
updateSound();
}
public function incrementMoneyBy(_arg1:int, _arg2:Boolean, _arg3:MovieClip):void{
var _local4:int;
var _local5:int;
moneyEarned(_arg1);
if (_arg2){
_local4 = 0;
_local5 = 0;
_local4 = ((_arg3.x + (_arg3.width / 2)) + 10);
_local5 = (_arg3.y - (_arg3.height / 2));
showIncrementMoneyText(_local4, _local5, _arg1);
};
}
public function gotoGame7(_arg1:MouseEvent):void{
if (savedGame.data.stats != undefined){
addChild(confirmScreen);
confirmScreen.addEventListener(MouseEvent.MOUSE_UP, confirmSelected, false, 0, true);
} else {
gotoAndStop("mainMenu");
};
}
public function gotoStatistics(_arg1:MouseEvent):void{
statistics.removeEventListener(MouseEvent.MOUSE_UP, gotoStatistics);
gotoAndStop("statistics");
}
public function resourcesGained(_arg1:MovieClip):void{
var _local2:int;
_local2 = calculateResources(_arg1);
resources = (resources + _local2);
stats.totalResourcesEarned = (stats.totalResourcesEarned + _local2);
updateAmounts();
}
public function updateMusic():void{
if (music_is_playing){
musicBox.gotoAndStop(1);
} else {
musicBox.gotoAndStop(2);
};
}
public function initializeStats():void{
stats.totalResourcesEarned = 0;
stats.totalMoneyEarned = 0;
stats.totalShotsFired = 0;
stats.shotsFiredByCircle = 0;
stats.shotsFiredBySquare = 0;
stats.shotsFiredByPentagon = 0;
stats.shotsFiredByCannon = 0;
stats.totalEnemiesKilled = 0;
stats.killedByCircle = 0;
stats.killedByPentagon = 0;
stats.killedByCannon = 0;
stats.totalTowersPlaced = 0;
stats.circleTowersPlaced = 0;
stats.squareTowersPlaced = 0;
stats.pentagonTowersPlaced = 0;
stats.cannonTowersPlaced = 0;
stats.totalResourceItemsPlaced = 0;
stats.farmsPlaced = 0;
stats.minesPlaced = 0;
stats.trainingCentersPlaced = 0;
stats.levelsGained = 0;
stats.circleTowerLevels = 0;
stats.squareTowerLevels = 0;
stats.pentagonTowerLevels = 0;
stats.cannonTowerLevels = 0;
stats.levelTenTowers = 0;
stats.circleTowerTens = 0;
stats.squareTowerTens = 0;
stats.pentagonTowerTens = 0;
stats.cannonTowerTens = 0;
stats.successiveLosses = 0;
stats.timesPlayed = 0;
stats.awardsUnlocked = 0;
stats.bestTime = 0;
}
public function updateWeather():void{
if (envEffectsEnabled){
weatherBox.gotoAndStop(1);
} else {
weatherBox.gotoAndStop(2);
};
}
public function displayMoneyInfo(_arg1:MouseEvent):void{
buildInfo.text = "Money allows you to buy new towers.";
}
public function timeToString2(_arg1:int):String{
var _local2:String;
var _local3:String;
if (_arg1 >= 3600){
return (((((int((_arg1 / 3600)) + ":") + int((_arg1 / (_arg1 % 3600)))) + ":") + (int((_arg1 / (_arg1 % 3600))) % 60)));
};
if (_arg1 >= 60){
if (int((_arg1 / 60)) < 10){
_local2 = ("0" + int((_arg1 / 60)));
} else {
_local2 = ("" + int((_arg1 / 60)));
};
if ((_arg1 % 60) < 10){
_local3 = ("0" + (_arg1 % 60));
} else {
_local3 = ("" + int((_arg1 % 60)));
};
return (((("00:" + _local2) + ":") + _local3));
//unresolved jump
};
if (_arg1 > 0){
if (_arg1 < 10){
return (("00:00:0" + _arg1));
};
return (("00:00:" + _arg1));
//unresolved jump
};
return ("00:00:00");
}
public function pauseGame():void{
pauseTimers();
pauseEnemies();
pauseTowers();
pauseResource();
stopEnemyScan();
}
public function gotoMenu7(_arg1:MouseEvent):void{
mainMenu5.removeEventListener(MouseEvent.MOUSE_DOWN, gotoMenu7);
gotoAndStop("mainMenu");
}
function lose():void{
if (currentLevel < 7){
pauseGame();
removeStuffBeingPlaced();
loseScreen.x = 400;
loseScreen.y = 225;
addChild(loseScreen);
lostLevel();
loseScreen.gotoAndPlay(1);
checkForAwards();
loseScreen.addEventListener(MouseEvent.MOUSE_UP, optionSelectedLose, false, 0, true);
saveGame();
} else {
pauseGame();
levelTime = clockValue;
if (levelTime > bestScore){
bestScore = levelTime;
stats.bestTime = bestScore;
};
removeStuffBeingPlaced();
survivalScreen.x = 400;
survivalScreen.y = 225;
addChild(survivalScreen);
survivalScreen.gotoAndPlay(1);
checkForAwards();
survivalScreen.addEventListener(MouseEvent.MOUSE_UP, optionSelectedSurvival, false, 0, true);
saveGame();
};
}
public function saveGame():void{
savedGame.data.stats = stats;
savedGame.data.award = award;
savedGame.data.ABPL = ABPL;
savedGame.data.RB = RB;
savedGame.data.RanB = RanB;
savedGame.data.TimerBonus = TimerBonus;
savedGame.data.towerPriceReduction = towerPriceReduction;
savedGame.data.structurePriceReduction = structurePriceReduction;
savedGame.data.moneyBonus = moneyBonus;
savedGame.data.resourceBonus = resourceBonus;
savedGame.data.levelsUnlocked = levelsUnlocked;
}
public function setStatistics():void{
stuff.text = ((((((((((((((((((((((((((((("Money earned: " + stats.totalMoneyEarned) + "\n") + "Resources earned: ") + stats.totalResourcesEarned) + "\n") + "Shots fired: ") + stats.totalShotsFired) + "\n") + "Shots fired by arrow tower: ") + stats.shotsFiredByCircle) + "\n") + "Shots fired by ballista tower: ") + stats.shotsFiredByPentagon) + "\n") + "Shots fired by cannon: ") + stats.shotsFiredByCannon) + "\n") + "Enemies killed: ") + stats.totalEnemiesKilled) + "\n") + "Enemies killed by arrow tower: ") + stats.killedByCircle) + "\n") + "Enemies killed by ballista tower: ") + stats.killedByPentagon) + "\n") + "Enemies killed by cannon tower: ") + stats.killedByCannon) + "\n");
stuff2.text = (((((((((((((((((((((((((((("Towers placed: " + stats.totalTowersPlaced) + "\n") + "Arrow towers placed: ") + stats.circleTowersPlaced) + "\n") + "Sap silos placed: ") + stats.squareTowersPlaced) + "\n") + "Ballista towers placed: ") + stats.pentagonTowersPlaced) + "\n") + "Cannon towers placed: ") + stats.cannonTowersPlaced) + "\n") + "Structures placed: ") + stats.totalResourceItemsPlaced) + "\n") + "Farms placed: ") + stats.farmsPlaced) + "\n") + "Mines placed: ") + stats.minesPlaced) + "\n") + "Training Centers placed: ") + stats.trainingCentersPlaced) + "\n") + "Best survival time: ") + timeToString2(stats.bestTime));
stuff3.text = ((((((((((((((((((((((((((((("Tower levels gained: " + stats.levelsGained) + "\n") + "Arrow tower levels: ") + stats.circleTowerLevels) + "\n") + "Sap silo levels: ") + stats.squareTowerLevels) + "\n") + "Ballista tower levels: ") + stats.pentagonTowerLevels) + "\n") + "Cannon tower levels: ") + stats.cannonTowerLevels) + "\n") + "Level 10 towers: ") + stats.levelTenTowers) + "\n") + "Level 10 Arrow towers: ") + stats.circleTowerTens) + "\n") + "Level 10 Sap silos: ") + stats.squareTowerTens) + "\n") + "Level 10 Ballista towers: ") + stats.pentagonTowerTens) + "\n") + "Level 10 Cannon towers: ") + stats.cannonTowerTens) + "\n");
}
public function sellTower(_arg1:int):void{
var _local2:int;
if (((!((currentlyHovered == null))) && (currentlyHovered.is_placed))){
Mouse.show();
if (soundEffectsEnabled){
sellSound.play();
};
forceRemoveGlow(currentlyHovered.index);
if (ranges[currentlyHovered.index].isPentagonTower){
ranges[currentlyHovered.index].removeAugment();
};
money = (money + getPriceToSell());
updateAmounts();
removeEventListener(Event.ENTER_FRAME, showSellIcon);
removeEventListener(MouseEvent.MOUSE_DOWN, sellTower);
if (sellIcon.parent == this){
removeChild(sellIcon);
};
currentlyHovered.stopInfoNoEvent();
currentlyHovered.deleted = true;
ranges[currentlyHovered.index].deleted = true;
currentlyHovered.deleteSelf();
_local2 = 0;
while (_local2 < ranges.length) {
if (((!(ranges[_local2].deleted)) && (ranges[_local2].isPentagonTower))){
ranges[_local2].updateAugment();
};
_local2++;
};
ranges[currentlyHovered.index].deleteSelf();
towerTops[currentlyHovered.index].deleteSelf();
currentlyHovered = null;
};
}
public function dispatchEnemy(_arg1:TimerEvent):void{
var _local2:MovieClip;
if (levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].enemyID == 1){
_local2 = new Enemy1();
} else {
if (levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].enemyID == 2){
_local2 = new Enemy2();
} else {
if (levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].enemyID == 3){
_local2 = new Enemy3();
};
};
};
_local2.cacheAsBitmap = true;
enemiesStartedSrsly = true;
levels[(currentLevel - 1)].setEntrancePoint(_local2);
_local2.hp = (_local2.maxhp = determineHP(_local2));
_local2.damage = determineAttack(_local2);
enemies.push(_local2);
enemiesSpawned++;
addChildAt(enemies[(enemies.length - 1)], 1);
}
public function unpauseTimers():void{
levels[(currentLevel - 1)].castle.xpGainClock.start();
levels[(currentLevel - 1)].castle.moneyGainClock.start();
if (t1s){
timer.start();
};
if (t2s){
gameTime.start();
};
if (t3s){
delayTimer.start();
};
if (t4s){
enemyDispatchTimer.start();
};
if (t5s){
clockTime.start();
};
if (tweensStopped){
durationTween.resume();
tweensStopped = false;
};
if (tweensStopped2){
durationTween2.resume();
tweensStopped2 = false;
};
}
public function changeQuality():void{
if (stage.quality == "LOW"){
stage.quality = StageQuality.MEDIUM;
} else {
if (stage.quality == "MEDIUM"){
stage.quality = StageQuality.HIGH;
} else {
if (stage.quality == "HIGH"){
stage.quality = StageQuality.LOW;
};
};
};
}
public function placeGlow():void{
var _local1:int;
var _local2:int;
if (glow_enabled){
_local1 = 0;
while (_local1 < towers.length) {
if (((((!(towers[_local1].deleted)) && (towers[_local1].augmentedRate))) && (!(towers[_local1].has_glow)))){
glowIndex[_local1] = new TowerGlow(_local1);
glowIndex[_local1].x = towers[_local1].x;
glowIndex[_local1].y = (towers[_local1].y + 7);
addChildAt(glowIndex[_local1], (getChildIndex(levels[(currentLevel - 1)]) + 1));
addChildAt(towers[_local1], (getChildIndex(glowIndex[_local1]) + 1));
_local2 = 0;
while (_local2 < glowIndex.length) {
if ((glowIndex[_local2] is TowerGlow)){
addChildAt(glowIndex[_local2], (getChildIndex(levels[(currentLevel - 1)]) + 1));
};
_local2++;
};
towers[_local1].has_glow = true;
};
_local1++;
};
};
}
public function levelStart(_arg1:int):void{
levels = new Array();
levels.push(new Level1(), new Level2(), new Level3(), new Level4(), new Level5(), new Level6(), new Level7());
towerBuildIcons = new Array();
resourceBuildIcons = new Array();
gotoAndStop("game");
currentLevel = _arg1;
addChildAt(levels[(_arg1 - 1)], 0);
levels[(_arg1 - 1)].levelStart();
if ((((currentLevel == 6)) && (!(envEffectsEnabled)))){
levels[(_arg1 - 1)].gotoAndStop(2);
} else {
if ((((currentLevel == 6)) && (envEffectsEnabled))){
levels[(_arg1 - 1)].gotoAndStop(1);
};
};
envEffect = levels[(currentLevel - 1)].environmentalEffect;
if (envEffectsEnabled){
if ((envEffect is Snow)){
envEffect.x = 399.2;
envEffect.y = 206.6;
} else {
if ((envEffect is Clouds)){
envEffect.x = 367.8;
envEffect.y = 235.5;
} else {
envEffect.x = 400;
envEffect.y = 225;
};
};
addChildAt(envEffect, 1);
};
levelCleanUp();
}
public function stopMusic():void{
if (soundChannel != null){
musicDisabled = true;
music_is_playing = false;
soundChannel.stop();
soundChannel.removeEventListener(Event.SOUND_COMPLETE, loopSong);
};
}
public function deleteEventListeners():void{
cancelicon.removeEventListener(Event.ENTER_FRAME, cancelBuild);
cancelicon.removeEventListener(Event.ENTER_FRAME, cancelBuildItem);
}
public function waveComplete(_arg1:TimerEvent):void{
enemyDispatchTimer.removeEventListener(TimerEvent.TIMER_COMPLETE, waveComplete);
saveGame();
if (currentFrame == 31){
levels[(currentLevel - 1)].waves[levels[(currentLevel - 1)].wavesSpawned].spawned = true;
};
if (currentFrame == 31){
if ((((towers.length > 0)) && (towers[0].is_placed))){
levels[(currentLevel - 1)].wavesSpawned++;
if (currentLevel == 7){
if (levels[(currentLevel - 1)].wavesSpawned > 80){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 6);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 60){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 5);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 50){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 4);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 40){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 3);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 30){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 2);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 20){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 1);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 15){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 0.6);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 10){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 0.4);
} else {
if (levels[(currentLevel - 1)].wavesSpawned > 1){
levels[(currentLevel - 1)].enemyhpMultiplier = (levels[(currentLevel - 1)].enemyhpMultiplier + 0.1);
} else {
levels[(currentLevel - 1)].enemyhpMultiplier = 1;
};
};
};
};
};
};
};
};
};
};
trace((("wave: " + levels[(currentLevel - 1)].wavesSpawned) + "complete"));
};
};
}
public function moneyEarned(_arg1:int):void{
money = (money + _arg1);
stats.totalMoneyEarned = (stats.totalMoneyEarned + _arg1);
updateAmounts();
}
public function playMusic():void{
musicDisabled = false;
if (((!(musicDisabled)) && (!(music_is_playing)))){
music_is_playing = true;
soundChannel = theme.play();
soundChannel.addEventListener(Event.SOUND_COMPLETE, loopSong, false, 0, true);
};
}
public function pauseEnemies():void{
var _local1:int;
if (enemies.length > 0){
_local1 = 0;
while (_local1 < enemies.length) {
if (enemies[_local1].is_alive){
enemies[_local1].pauseSelf();
};
_local1++;
};
};
}
public function pauseEnemiesFor(_arg1:int):void{
if (levels[(currentLevel - 1)].wavesSpawned < levels[(currentLevel - 1)].waves.length){
durationTween = new Tween(enemyTimer.timeBar, "width", None.easeOut, 180, 0, (_arg1 / 1000), true);
durationTween.addEventListener("motionFinish", resetTimeBar, false, 0, true);
durationTween.start();
durationTween2 = new Tween(enemyTimer.maskBar, "width", None.easeOut, 180, 0, (_arg1 / 1000), true);
durationTween2.addEventListener("motionFinish", resetMaskBar, false, 0, true);
durationTween2.start();
updateBuildInfo();
};
}
public function pauseTimers():void{
levels[(currentLevel - 1)].castle.xpGainClock.stop();
levels[(currentLevel - 1)].castle.moneyGainClock.stop();
if (timer.running){
timer.stop();
t1s = true;
};
if (gameTime.running){
gameTime.stop();
t2s = true;
};
if (delayTimer.running){
delayTimer.stop();
t3s = true;
};
if (enemyDispatchTimer.running){
enemyDispatchTimer.stop();
t4s = true;
};
if (clockTime.running){
clockTime.stop();
t5s = true;
};
if (durationTween.isPlaying){
durationTween.stop();
tweensStopped = true;
};
if (durationTween2.isPlaying){
durationTween2.stop();
tweensStopped2 = true;
};
}
public function gotoLevelSelect2(_arg1:MouseEvent):void{
awards.removeEventListener(MouseEvent.MOUSE_UP, gotoLevelSelect2);
gotoAndStop("levelselect");
}
public function clearData(_arg1:MouseEvent):void{
addChild(confirmScreen);
confirmScreen.addEventListener(MouseEvent.MOUSE_UP, confirmSelected2, false, 0, true);
}
function checkItemOverlap(_arg1:Event):void{
var _local2:Boolean;
var _local3:MovieClip;
if (!levels[(currentLevel - 1)].isFinished){
_local2 = false;
_local3 = resourceItems[(resourceItems.length - 1)];
if (resourceItems[(resourceItems.length - 1)].is_placed){
removeEventListener(Event.ENTER_FRAME, checkItemOverlap);
} else {
if (checkForTowerHit(_local3)){
_local2 = true;
} else {
if (checkForResourceItemHit(_local3)){
_local2 = true;
} else {
if (_local3.hitTestObject(topbar)){
_local2 = true;
} else {
if (_local3.hitTestObject(bottombar)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY - (_local3.height / 2)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY + (_local3.height / 2)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX - (_local3.width / 2)), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX + (_local3.width / 2)), mouseY, true)){
_local2 = true;
} else {
if (_local3.hitTestObject(levels[(currentLevel - 1)].castle)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY + (_local3.height / 3)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY - (_local3.height / 3)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX + (_local3.width / 3)), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX - (_local3.width / 3)), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY + (_local3.height / 5)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint(mouseX, (mouseY - (_local3.height / 5)), true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX + (_local3.width / 5)), mouseY, true)){
_local2 = true;
} else {
if (levels[(currentLevel - 1)].boundingBox.hitTestPoint((mouseX - (_local3.width / 6)), mouseY, true)){
_local2 = true;
} else {
if ((((mouseX < (_local3.width / 2))) || ((mouseX > (800 - (_local3.width / 2)))))){
_local2 = true;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
overlapping = _local2;
};
} else {
removeEventListener(Event.ENTER_FRAME, checkItemOverlap);
if (cancelicon.parent == this){
removeChild(cancelicon);
};
Mouse.show();
};
}
public function placeTowerTop(_arg1:MovieClip):void{
var _local2:TowerTop;
_local2 = new TowerTop(_arg1);
if (envEffect.parent == this){
addChildAt(_local2, (getChildIndex(envEffect) - 1));
} else {
addChild(_local2);
};
towerTops.push(_local2);
}
public function nextA(_arg1:MouseEvent):void{
if (achievementsMC.totalFrames > achievementsMC.currentFrame){
if (hiddenAwards[(achievementsMC.currentFrame + 2)]){
if (hiddenAwards[(achievementsMC.currentFrame + 3)]){
} else {
achievementsMC.gotoAndStop((achievementsMC.currentFrame + 2));
};
} else {
achievementsMC.gotoAndStop((achievementsMC.currentFrame + 1));
};
};
fixButtons2();
}
public function updateSpecial():void{
if (glow_enabled){
specialBox.gotoAndStop(1);
} else {
specialBox.gotoAndStop(2);
};
}
public function gotoOptions(_arg1:MouseEvent):void{
options.removeEventListener(MouseEvent.MOUSE_UP, gotoOptions);
gotoAndStop("options");
}
public function displayResourceInfo(_arg1:MouseEvent):void{
buildInfo.text = "Resources allow you to repair your castle, build structures, and more.";
}
public function enlargeSelect(_arg1:MouseEvent):void{
levelSelect.scaleX = 1.025;
levelSelect.scaleY = 1.025;
}
public function checkForAwards():void{
if (awardSplash.parent == null){
if (((!(award.circleTowers1)) && ((stats.circleTowersPlaced >= 10)))){
award.circleTowers1 = true;
RanB[0] = (RanB[0] + 0.05);
awardUnlocked("NOVICE BOWMAN");
} else {
if (((!(award.circleTowers2)) && ((stats.circleTowersPlaced >= 50)))){
RB[0] = (RB[0] - 0.05);
award.circleTowers2 = true;
awardUnlocked("EXPERT BOWMAN");
} else {
if (((!(award.circleTowers3)) && ((stats.circleTowersPlaced >= 100)))){
ABPL[0] = (ABPL[0] + 0.05);
award.circleTowers3 = true;
awardUnlocked("ELITE BOWMAN");
} else {
if (((!(award.squareTowers1)) && ((stats.squareTowersPlaced >= 10)))){
RanB[1] = (RanB[1] + 0.05);
award.squareTowers1 = true;
awardUnlocked("NOVICE SAPPER");
} else {
if (((!(award.squareTowers2)) && ((stats.squareTowersPlaced >= 50)))){
RB[1] = (RB[1] - 0.05);
award.squareTowers2 = true;
awardUnlocked("EXPERT SAPPER");
} else {
if (((!(award.squareTowers3)) && ((stats.squareTowersPlaced >= 100)))){
RanB[1] = (RanB[1] + 0.05);
award.squareTowers3 = true;
awardUnlocked("ELITE SAPPER");
} else {
if (((!(award.pentagonTowers1)) && ((stats.pentagonTowersPlaced >= 10)))){
RanB[2] = (RanB[2] + 0.05);
award.pentagonTowers1 = true;
awardUnlocked("NOVICE BALLISTEER");
} else {
if (((!(award.pentagonTowers2)) && ((stats.pentagonTowersPlaced >= 50)))){
RB[2] = (RB[2] - 0.05);
award.pentagonTowers2 = true;
awardUnlocked("EXPERT BALLISTEER");
} else {
if (((!(award.pentagonTowers3)) && ((stats.pentagonTowersPlaced >= 100)))){
ABPL[2] = (ABPL[2] + 0.05);
award.pentagonTowers3 = true;
awardUnlocked("ELITE BALLISTEER");
} else {
if (((!(award.cannonTowers1)) && ((stats.cannonTowersPlaced >= 10)))){
RanB[3] = (RanB[3] + 0.05);
award.cannonTowers1 = true;
awardUnlocked("NOVICE ARTILLERY");
} else {
if (((!(award.cannonTowers2)) && ((stats.cannonTowersPlaced >= 50)))){
RB[3] = (RB[3] - 0.05);
award.cannonTowers2 = true;
awardUnlocked("EXPERT ARTILLERY");
} else {
if (((!(award.cannonTowers3)) && ((stats.cannonTowersPlaced >= 100)))){
ABPL[3] = (ABPL[3] + 0.05);
award.cannonTowers3 = true;
awardUnlocked("ELITE ARTILLERY");
} else {
if (((!(award.farmsPlaced1)) && ((stats.farmsPlaced >= 10)))){
TimerBonus[0] = (TimerBonus[0] + 0.05);
award.farmsPlaced1 = true;
awardUnlocked("NOVICE FARMER");
} else {
if (((!(award.farmsPlaced2)) && ((stats.farmsPlaced >= 50)))){
TimerBonus[0] = (TimerBonus[0] + 0.05);
award.farmsPlaced2 = true;
awardUnlocked("EXPERT FARMER");
} else {
if (((!(award.farmsPlaced3)) && ((stats.farmsPlaced >= 100)))){
TimerBonus[0] = (TimerBonus[0] + 0.05);
award.farmsPlaced3 = true;
awardUnlocked("ELITE FARMER");
} else {
if (((!(award.minesPlaced1)) && ((stats.minesPlaced >= 10)))){
TimerBonus[1] = (TimerBonus[1] + 0.05);
award.minesPlaced1 = true;
awardUnlocked("NOVICE MINER");
} else {
if (((!(award.minesPlaced2)) && ((stats.minesPlaced >= 50)))){
TimerBonus[1] = (TimerBonus[1] + 0.05);
award.minesPlaced2 = true;
awardUnlocked("EXPERT MINER");
} else {
if (((!(award.minesPlaced3)) && ((stats.minesPlaced >= 100)))){
TimerBonus[1] = (TimerBonus[1] + 0.05);
award.minesPlaced3 = true;
awardUnlocked("ELITE MINER");
} else {
if (((!(award.trainingCentersPlaced1)) && ((stats.trainingCentersPlaced >= 10)))){
TimerBonus[2] = (TimerBonus[2] + 0.05);
award.trainingCentersPlaced1 = true;
awardUnlocked("NOVICE TRAINER");
} else {
if (((!(award.trainingCentersPlaced2)) && ((stats.trainingCentersPlaced >= 50)))){
TimerBonus[2] = (TimerBonus[2] + 0.05);
award.trainingCentersPlaced2 = true;
awardUnlocked("EXPERT TRAINER");
} else {
if (((!(award.trainingCentersPlaced3)) && ((stats.trainingCentersPlaced >= 100)))){
TimerBonus[2] = (TimerBonus[2] + 0.05);
award.trainingCentersPlaced3 = true;
awardUnlocked("ELITE TRAINER");
} else {
if (((!(award.enemiesKilledTier1)) && ((stats.totalEnemiesKilled >= 50)))){
moneyBonus = (moneyBonus + 50);
award.enemiesKilledTier1 = true;
awardUnlocked("NOVICE DEFENDER");
} else {
if (((!(award.enemiesKilledTier2)) && ((stats.totalEnemiesKilled >= 500)))){
resourceBonus = (resourceBonus + 50);
award.enemiesKilledTier2 = true;
awardUnlocked("EXPERT DEFENDER");
} else {
if (((!(award.enemiesKilledTier3)) && ((stats.totalEnemiesKilled >= 5000)))){
moneyBonus = (moneyBonus + 50);
resourceBonus = (resourceBonus + 50);
award.enemiesKilledTier3 = true;
awardUnlocked("ELITE DEFENDER");
} else {
if (((!(award.allTowersPlaced)) && ((((((((stats.circleTowersPlaced > 0)) && ((stats.squareTowersPlaced > 0)))) && ((stats.pentagonTowersPlaced > 0)))) && ((stats.cannonTowersPlaced > 0)))))){
towerPriceReduction = (towerPriceReduction + 10);
award.allTowersPlaced = true;
awardUnlocked("BLOOD-THIRSTY");
} else {
if (((!(award.levelTenTowerAward)) && ((stats.levelTenTowers > 0)))){
award.levelTenTowerAward = true;
awardUnlocked("DECAMISTER");
} else {
if (((!(award.allLevelTenTowers)) && ((((((((stats.circleTowerTens > 0)) && ((stats.squareTowerTens > 0)))) && ((stats.pentagonTowerTens > 0)))) && ((stats.cannonTowerTens > 0)))))){
award.allLevelTenTowers = true;
awardUnlocked("DECAMASTER");
} else {
if (((!(award.allResourceItemsPlaced)) && ((((((stats.farmsPlaced > 0)) && ((stats.minesPlaced > 0)))) && ((stats.trainingCentersPlaced > 0)))))){
structurePriceReduction = (structurePriceReduction + 10);
award.allResourceItemsPlaced = true;
awardUnlocked("POWER-HUNGRY");
} else {
if (((!(award.moneyEarned1)) && ((stats.totalMoneyEarned >= 1000)))){
moneyBonus = (moneyBonus + 50);
award.moneyEarned1 = true;
awardUnlocked("NOVICE COLLECTOR");
} else {
if (((!(award.moneyEarned2)) && ((stats.totalMoneyEarned >= 10000)))){
moneyBonus = (moneyBonus + 50);
award.moneyEarned2 = true;
awardUnlocked("EXPERT COLLECTOR");
} else {
if (((!(award.moneyEarned3)) && ((stats.totalMoneyEarned >= 100000)))){
moneyBonus = (moneyBonus + 50);
award.moneyEarned3 = true;
awardUnlocked("ELITE COLLECTOR");
} else {
if (((!(award.resourcesEarned1)) && ((stats.totalResourcesEarned >= 1000)))){
resourceBonus = (resourceBonus + 50);
award.resourcesEarned1 = true;
awardUnlocked("NOVICE GATHERER");
} else {
if (((!(award.resourcesEarned2)) && ((stats.totalResourcesEarned >= 10000)))){
resourceBonus = (resourceBonus + 50);
award.resourcesEarned2 = true;
awardUnlocked("EXPERT GATHERER");
} else {
if (((!(award.resourcesEarned3)) && ((stats.totalResourcesEarned >= 100000)))){
resourceBonus = (resourceBonus + 50);
award.resourcesEarned3 = true;
awardUnlocked("ELITE GATHERER");
} else {
if (((!(award.ultimateFail)) && ((stats.successiveLosses >= 3)))){
award.ultimateFail = true;
awardUnlocked("SUCCESSIVE FAILURE");
} else {
if (((!(award.pumpkinEater)) && ((towersCheated >= 5)))){
award.pumpkinEater = true;
awardUnlocked("PUMPKIN EATER");
} else {
if (((!(award.completedCampaign)) && ((levelsUnlocked > 6)))){
award.completedCampaign = true;
awardUnlocked("GUARDIAN");
} else {
if (!award.gotAllAwards){
if (((award.ultimateFail) && (award.pumpkinEater))){
if (stats.awardsUnlocked >= 40){
award.gotAllAwards = true;
awardUnlocked("ADMIRAL TIP-TOP");
};
} else {
if (((award.ultimateFail) || (award.pumpkinEater))){
if (stats.awardsUnlocked >= 39){
award.gotAllAwards = true;
awardUnlocked("ADMIRAL TIP-TOP");
};
} else {
if (stats.awardsUnlocked >= 38){
award.gotAllAwards = true;
awardUnlocked("ADMIRAL TIP-TOP");
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
}
public function win():void{
pauseGame();
gameTime.stop();
timer.stop();
durationTween.stop();
durationTween2.stop();
removeStuffBeingPlaced();
removeHangingSell();
clockTime.stop();
if ((((levelsUnlocked <= currentLevel)) && ((levelsUnlocked < 7)))){
levelsUnlocked++;
checkForAwards();
};
levelComplete = new LevelComplete();
levelComplete.x = 400;
levelComplete.y = 225;
if (soundEffectsEnabled){
winSound.play();
};
addChild(levelComplete);
levelWon();
checkForAwards();
levelComplete.addEventListener(MouseEvent.MOUSE_UP, optionSelected, false, 0, true);
saveGame();
}
public function setLevelSelect():void{
if (currentLevel == 0){
levelSelect.gotoAndStop(levelsUnlocked);
} else {
levelSelect.gotoAndStop(currentLevel);
};
}
public function resourceItemPlaced(_arg1:MovieClip):void{
stats.totalResourceItemsPlaced++;
addEventListener(Event.ENTER_FRAME, duplicateTower, false, 0, true);
if (_arg1.itemID == 1){
stats.farmsPlaced++;
lastBuild = new FarmBuild();
} else {
if (_arg1.itemID == 2){
stats.minesPlaced++;
lastBuild = new MineBuild();
} else {
if (_arg1.itemID == 3){
stats.trainingCentersPlaced++;
lastBuild = new TrainingBuild();
};
};
};
checkForAwards();
}
function removeStuffBeingPlaced():void{
if (currently_placing_tower){
cancelBuildNoEvent();
} else {
if (currently_placing_item){
cancelBuildItemNoEvent();
};
};
}
public function selectLevel(_arg1:MouseEvent):void{
nextLevel.removeEventListener(MouseEvent.MOUSE_UP, nextIcon);
previousLevel.removeEventListener(MouseEvent.MOUSE_UP, previousIcon);
levelSelect.removeEventListener(MouseEvent.MOUSE_UP, selectLevel);
levelStart(levelSelect.currentFrame);
}
public function deleteAllResourceItems():void{
var _local1:int;
if (resourceItems.length > 0){
_local1 = 0;
while (_local1 < resourceItems.length) {
if (!resourceItems[_local1].deleted){
resourceItems[_local1].deleteSelf();
};
resourceItems[_local1] = null;
_local1++;
};
resourceItems = new Array();
};
}
public function gotoLink(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.symphonyofspecters.com/");
navigateToURL(_local2);
}
public function changeMusicFromOptions(_arg1:MouseEvent):void{
if (music_is_playing){
stopMusic();
musicDisabled = true;
} else {
musicDisabled = false;
playMusic();
};
updateMusic();
}
}
}//package
Section 86
//Mine (Mine)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Mine extends ResourceBuilding {
var timerDelay:int;// = 10000
var amount:int;// = 10
var genericTimer:Timer;
public function Mine(_arg1:int):void{
amount = 10;
timerDelay = 10000;
genericTimer = new Timer(timerDelay);
addFrameScript(0, frame1);
super(_arg1);
price = 400;
itemID = 2;
sounds.push(new MineSound(), new MineSound(), new MineSound(), new MineSound());
itemName = "Mine";
}
override public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
if (((((is_placed) && (!(MovieClip(parent).currently_placing_tower)))) && (!(MovieClip(parent).currently_placing_item)))){
MovieClip(parent).buildInfo.text = itemName;
MovieClip(parent).infoBox1.text = (((("Generating " + amount) + " Au \nevery ") + int((genericTimer.delay / 1000))) + " seconds.");
MovieClip(parent).infoBox2.text = MovieClip(parent).defaultStatsString;
handleSell();
};
}
override public function customRemove():void{
genericTimer.stop();
genericTimer.removeEventListener(TimerEvent.TIMER, incrementMoney);
}
override public function pauseSelf():void{
genericTimer.stop();
}
public function incrementMoney(_arg1:TimerEvent):void{
if (MovieClip(parent).enemiesStarted){
MovieClip(parent).incrementMoneyBy(amount, true, this);
};
}
function frame1(){
stop();
}
override public function unpauseSelf():void{
genericTimer.start();
}
override public function activate():void{
genericTimer.start();
genericTimer.addEventListener(TimerEvent.TIMER, incrementMoney, false, 0, true);
}
}
}//package
Section 87
//MineBuild (MineBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class MineBuild extends buildItemIcon {
public var cost:TextField;
public function MineBuild():void{
addFrameScript(0, frame1, 1, frame2);
itemID = 2;
price = 400;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).structurePriceReduction));
}
override function showStats():void{
var _local1:int;
_local1 = (price - MovieClip(parent).structurePriceReduction);
MovieClip(parent).infoBox1.text = (("Price: " + _local1) + " resources");
MovieClip(parent).infoBox2.text = (("Generates " + int((10 * MovieClip(parent).TimerBonus[(itemID - 1)]))) + " Au \nevery ten seconds.");
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Mines generate money over time.";
showStats();
}
}
}//package
Section 88
//MineSound (MineSound)
package {
import flash.media.*;
public dynamic class MineSound extends Sound {
}
}//package
Section 89
//MusicIcon (MusicIcon)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class MusicIcon extends MovieClip {
public function MusicIcon(){
addFrameScript(0, frame1);
}
public function enlarge(_arg1:MouseEvent):void{
scaleX = 1.1;
scaleY = 1.1;
}
public function switchMusic(_arg1:MouseEvent):void{
if (MovieClip(parent).music_is_playing){
gotoAndStop("musicdisabled");
MovieClip(parent).stopMusic();
} else {
gotoAndStop("default");
MovieClip(parent).playMusic();
};
}
function frame1(){
stop();
buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, enlarge, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OUT, unlarge, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, switchMusic, false, 0, true);
if (MovieClip(parent).music_is_playing){
gotoAndStop("default");
} else {
gotoAndStop("musicdisabled");
};
}
public function unlarge(_arg1:MouseEvent):void{
scaleX = 1;
scaleY = 1;
}
}
}//package
Section 90
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.net.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
public static const bridge:Sprite = new Sprite();
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(_arg1:Object){
var _local2:*;
var _local3:String;
var _local4:*;
var _local5:URLLoader;
for (_local2 in _arg1) {
_arg1[_local2] = unescape(_arg1[_local2]);
movie_options[_local2] = _arg1[_local2];
};
if (_arg1["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_local3 = bridge.root.loaderInfo.url;
_local4 = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_local3));
_local5 = new URLLoader(new URLRequest(_local4));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(_arg1){
if (!_arg1){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(_arg1);
};
}
public static function loadCustomLink(_arg1:String){
if (!_arg1){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[_arg1]){
SendError(("Attempted to open undefined custom link: " + _arg1));
} else {
SendLink(custom_links[_arg1]);
};
};
}
public static function addCustomLink(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(((("Created custom link " + _arg1) + ": ") + _arg2));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(_arg1:Number, _arg2:Boolean, _arg3=null){
var target_url:*;
var XML_Loaded:Function;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = _arg1;
var open_in_browser = _arg2;
var extra = _arg3;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
XML_Loaded = function (_arg1:Event){
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:*;
var _local7:*;
XML.ignoreWhitespace = true;
_local2 = XML(_arg1.target.data);
_local3 = new Object();
_local4 = _local2.children();
for each (_local5 in _local4) {
_local6 = _local5.localName();
_local7 = _local5.attribute("value");
if (_local7 == Number(_local7)){
_local7 = Number(_local7);
};
_local3[_local6] = _local7;
};
ReadGatewayData(_local3);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(_arg1:String){
}
public static function loadMySite(_arg1:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendMessage(_arg1:String){
trace(("[NEWGROUNDS API] :: " + _arg1));
}
public static function linkAPI(_arg1){
_arg1.addChild(bridge);
linked = true;
}
public static function loadNewgrounds(_arg1:Event=null, _arg2:String=null){
var _local3:URLRequest;
var _local4:*;
if (!tracker_id){
_local3 = new URLRequest(((NEWGROUNDS_URL + "/") + _arg2));
navigateToURL(_local3, "_blank");
} else {
_local4 = null;
if (_arg2){
_local4 = new Object();
_local4.page = _arg2;
};
SendLink(STAT_NEWGROUNDS, _local4);
};
}
private static function SendLink(_arg1, _arg2=null){
SendStat(_arg1, true, _arg2);
}
public static function logCustomEvent(_arg1:String){
if (!_arg1){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[_arg1]){
SendError(("Attempted to log undefined custom event: " + _arg1));
} else {
SendEvent(custom_events[_arg1]);
};
};
}
private static function SendError(_arg1:String){
trace(("[NEWGROUNDS API ERROR] :: " + _arg1));
}
public static function addCustomEvent(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(("Created custom event: " + _arg2));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(_arg1:Number, _arg2:Function){
events[_arg1] = _arg2;
}
private static function SendEvent(_arg1){
SendStat(_arg1, false);
}
public static function onNewVersionAvailable(_arg1:String, _arg2:String, _arg3:String){
var sw:*;
var sh:*;
var tw:*;
var th:*;
var mg:*;
var _root:*;
var overlay:MovieClip;
var overlay_x:*;
var overlay_y:*;
var close_x:*;
var blankarea:TextField;
var header:TextField;
var header_format:TextFormat;
var msgtext:TextField;
var msgtext_format:TextFormat;
var msgtext_link:TextFormat;
var version = _arg1;
var movie_url = _arg2;
var redirect_url = _arg3;
sw = bridge.stage.stageWidth;
sh = bridge.stage.stageHeight;
tw = 350;
th = 160;
mg = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
overlay_x = Math.round(((sw - tw) / 2));
overlay_y = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (_arg1:Event){
_root.removeChild(overlay);
};
close_x = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
blankarea = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
header = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
msgtext = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
msgtext_format = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
msgtext_link = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(_arg1:String, _arg2:String, _arg3:String){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:MovieClip;
var _local10:TextField;
var _local11:TextField;
var _local12:TextFormat;
var _local13:TextField;
var _local14:TextFormat;
var _local15:TextFormat;
_local4 = bridge.stage.stageWidth;
_local5 = bridge.stage.stageHeight;
_local6 = 350;
_local7 = 160;
_local8 = bridge.root;
_local9 = new MovieClip();
_local9.graphics.beginFill(0x660000);
_local9.graphics.lineStyle(20, 0);
_local9.graphics.drawRect(0, 0, _local4, _local5);
_local9.graphics.endFill();
_local10 = new TextField();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local4;
_local10.height = _local5;
_local10.selectable = false;
_local11 = new TextField();
_local11.x = Math.round(((_local4 - _local6) / 2));
_local11.y = Math.round(((_local5 - _local7) / 2.5));
_local11.width = _local6;
_local11.height = 100;
_local11.selectable = false;
_local12 = new TextFormat();
_local12.font = "Arial Black";
_local12.color = 0xFF0000;
_local12.size = 38;
_local11.defaultTextFormat = _local12;
_local11.text = "ERROR!";
_local13 = new TextField();
_local13.x = Math.round(((_local4 - _local6) / 2));
_local13.y = (Math.round(((_local5 - _local7) / 2.5)) + 80);
_local13.width = _local6;
_local13.height = 80;
_local13.selectable = false;
_local14 = new TextFormat();
_local14.font = "Arial";
_local14.color = 0xFFFFFF;
_local14.size = 12;
_local14.bold = true;
_local15 = new TextFormat();
_local15.font = "Arial";
_local15.color = 0xFFFF00;
_local15.size = 12;
_local15.bold = true;
_local15.url = _arg3;
_local15.target = "_blank";
_local13.defaultTextFormat = _local14;
_local13.appendText((("This movie has not been approved for use on " + _arg1) + "\n"));
_local13.appendText("For an approved copy, please visit:\n");
_local13.defaultTextFormat = _local15;
_local13.appendText(_arg2);
_local8.addChild(_local9);
_local9.addChild(_local10);
_local9.addChild(_local11);
_local9.addChild(_local13);
}
public static function connectMovie(_arg1:Number){
var _local2:String;
var _local3:*;
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = _arg1;
_local2 = bridge.root.loaderInfo.url;
host = _local2.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
_local3 = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package
Section 91
//Objective (Objective)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Objective extends MovieClip {
public var objective:TextField;
public function Objective():void{
addFrameScript(24, frame25, 60, frame61);
}
public function setObjective():void{
objective.text = MovieClip(parent).currentObjective;
}
function frame25(){
setObjective();
}
function frame61(){
stop();
parent.removeChild(this);
}
}
}//package
Section 92
//PentagonFire (PentagonFire)
package {
import flash.media.*;
public dynamic class PentagonFire extends Sound {
}
}//package
Section 93
//PentagonTop (PentagonTop)
package {
import flash.display.*;
public dynamic class PentagonTop extends MovieClip {
public function PentagonTop(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 94
//pentagonTower (pentagonTower)
package {
public class pentagonTower extends Tower {
public function pentagonTower(_arg1:int):void{
super(_arg1);
baseAttack = 20;
attack = baseAttack;
attackIncrease = 10;
attackSound = new PentagonFire();
towerName = "Ballista Tower";
baseRate = 3000;
rate = baseRate;
rateDecrease = 100;
baseRange = 75;
range = baseRange;
rangeIncrease = 0;
augmentAmount = -500;
price = 300;
towerID = 3;
}
}
}//package
Section 95
//pentagonTowerBuild (pentagonTowerBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class pentagonTowerBuild extends buildIcon {
public var cost:TextField;
public function pentagonTowerBuild():void{
addFrameScript(0, frame1, 1, frame2);
towerID = 3;
price = 300;
baseAttack = 20;
baseRate = 3000;
baseRange = 75;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).towerPriceReduction));
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Ballista towers grant a rate of fire bonus to all towers within their range (max one rate of fire upgrade per tower).";
showStats();
}
}
}//package
Section 96
//Rain (Rain)
package {
import flash.display.*;
public dynamic class Rain extends MovieClip {
public function Rain(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
}
}
}//package
Section 97
//Range (Range)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class Range extends MovieClip {
var deleted:Boolean;// = false
var isPentagonTower:Boolean;// = false
var isSquareTower:Boolean;// = false
var shouldBeStopped:Boolean;// = false
var currentEnemy:MovieClip;
var occupied:Boolean;// = false
var index:int;// = 0
var attackTimer:Timer;
public function Range(_arg1:int):void{
index = 0;
occupied = false;
isSquareTower = false;
isPentagonTower = false;
shouldBeStopped = false;
deleted = false;
attackTimer = new Timer(1000);
super();
mouseEnabled = false;
index = _arg1;
addEventListener(Event.ENTER_FRAME, placingTower, false, 0, true);
attackTimer.addEventListener(TimerEvent.TIMER, attackPhase, false, 0, true);
attackTimer.start();
}
public function attackPhase(_arg1:TimerEvent):void{
if (!shouldBeStopped){
if (((!((parent == null))) && (MovieClip(parent).towers[index].is_placed))){
if (((MovieClip(parent).towers[index].is_placed) && (!((attackTimer.delay == MovieClip(parent).towers[index].rate))))){
attackTimer.delay = MovieClip(parent).towers[index].rate;
};
if (occupied){
attackTimer.reset();
attackTimer.start();
if (!isSquareTower){
towerFire();
} else {
squareTowerFire();
};
};
};
} else {
deleteSelf();
};
}
function stillInRange(_arg1:Event):void{
if (MovieClip(parent).towers[index].is_placed){
if (enemyInRange()){
if ((((currentEnemy.hp <= 0)) || (((isSquareTower) && ((currentEnemy.speed < MovieClip(parent).towers[index].minSpeed)))))){
occupied = false;
removeEventListener(Event.ENTER_FRAME, stillInRange);
};
} else {
occupied = false;
removeEventListener(Event.ENTER_FRAME, stillInRange);
};
};
}
public function removeAugment():void{
var _local1:int;
_local1 = 0;
while (_local1 < MovieClip(parent).ranges.length) {
if (((!(MovieClip(parent).ranges[_local1].deleted)) && (!(MovieClip(parent).ranges[_local1].isPentagonTower)))){
if (this.hitTestPoint(MovieClip(parent).towers[_local1].x, MovieClip(parent).towers[_local1].y, true)){
MovieClip(parent).towers[_local1].augmentedRate = 0;
MovieClip(parent).towers[_local1].updateStats();
MovieClip(parent).manageGlow();
};
};
_local1++;
};
}
public function enemyInRange():Boolean{
if (((occupied) && (hitTestPoint(currentEnemy.x, currentEnemy.y, true)))){
return (true);
};
return (false);
}
public function pauseSelf():void{
attackTimer.stop();
}
public function incrementXPBy(_arg1:int):void{
if (((((!(MovieClip(parent).towers[index].deleted)) && (MovieClip(parent).towers[index].is_placed))) && ((MovieClip(parent).towers[index].level < 10)))){
MovieClip(parent).towers[index].xp = (MovieClip(parent).towers[index].xp + _arg1);
MovieClip(parent).displayXpUpAt(x, y, _arg1);
MovieClip(parent).towers[index].updateEvents();
};
}
public function squareTowerFire():void{
MovieClip(parent).towerTops[index].pointTopNoEvent();
if (currentEnemy.speed >= 3){
currentEnemy.speed = (currentEnemy.speed / 2.5);
} else {
currentEnemy.speed = (currentEnemy.speed / 1.4);
};
MovieClip(parent).shotFired(this);
if (MovieClip(parent).towers[index].level < 10){
incrementXP();
} else {
incrementMoney(2);
};
MovieClip(parent).towers[index].shoot();
if (MovieClip(parent).currentlyHovered == MovieClip(parent).towers[index]){
MovieClip(parent).towers[index].showInfoNoEvent();
};
}
function placingTower(_arg1:Event):void{
x = MovieClip(parent).mouseX;
y = MovieClip(parent).mouseY;
if (MovieClip(parent).towers[index].is_placed){
alpha = 0;
removeEventListener(Event.ENTER_FRAME, placingTower);
MovieClip(parent).beginEnemies();
if (isPentagonTower){
updateAugment();
};
};
}
public function incrementMoney(_arg1:int):void{
MovieClip(parent).showIncrementMoneyText((x + 30), (y - 10), _arg1);
MovieClip(parent).money = (MovieClip(parent).money + _arg1);
MovieClip(parent).stats.totalMoneyEarned = (MovieClip(parent).stats.totalMoneyEarned + _arg1);
MovieClip(parent).updateAmounts();
}
public function deleteSelf():void{
deleted = true;
removeEventListener(Event.ENTER_FRAME, stillInRange);
removeEventListener(Event.ENTER_FRAME, placingTower);
attackTimer.stop();
attackTimer.removeEventListener(TimerEvent.TIMER, attackPhase);
parent.removeChild(this);
}
public function updateAugment():void{
var _local1:int;
_local1 = 0;
while (_local1 < MovieClip(parent).towers.length) {
if (((!(MovieClip(parent).ranges[_local1].deleted)) && (!(MovieClip(parent).ranges[_local1].isPentagonTower)))){
if (((this.hitTestPoint(MovieClip(parent).towers[_local1].x, MovieClip(parent).towers[_local1].y, true)) && ((MovieClip(parent).towers[index].augmentAmount < MovieClip(parent).towers[_local1].augmentedRate)))){
MovieClip(parent).towers[_local1].augmentedRate = MovieClip(parent).towers[index].augmentAmount;
MovieClip(parent).towers[_local1].updateStats();
};
};
_local1++;
};
}
public function incrementXP():void{
MovieClip(parent).towers[index].xp = (MovieClip(parent).towers[index].xp + MovieClip(parent).towers[index].xpPerLevel);
MovieClip(parent).towers[index].updateEvents();
}
public function attackPhaseNoEvent():void{
if (!shouldBeStopped){
if (((MovieClip(parent).towers[index].is_placed) && (!((attackTimer.delay == MovieClip(parent).towers[index].rate))))){
attackTimer.delay = MovieClip(parent).towers[index].rate;
};
if (attackTimer.currentCount >= 1){
if (occupied){
attackTimer.reset();
attackTimer.start();
if (!isSquareTower){
towerFire();
} else {
squareTowerFire();
};
};
};
};
}
public function towerFire():void{
MovieClip(parent).towerTops[index].pointTopNoEvent();
MovieClip(parent).shotFired(this);
MovieClip(parent).towerTops[index].fire();
if (MovieClip(parent).towers[index].level < 10){
incrementXP();
} else {
if (MovieClip(parent).towers[index].towerID == 3){
incrementMoney(1);
} else {
if (MovieClip(parent).towers[index].towerID == 4){
incrementMoney(3);
} else {
incrementMoney(1);
};
};
};
if (currentEnemy.decrementHP(MovieClip(parent).towers[index].attack)){
MovieClip(parent).enemyKilled(this);
};
MovieClip(parent).towers[index].shoot();
if (MovieClip(parent).currentlyHovered == MovieClip(parent).towers[index]){
MovieClip(parent).towers[index].showInfoNoEvent();
};
}
public function unpauseSelf():void{
attackTimer.start();
}
function recieveEnemy(_arg1:MovieClip):void{
if (((((!(isSquareTower)) || (((isSquareTower) && ((_arg1.speed >= MovieClip(parent).towers[index].minSpeed)))))) && (MovieClip(parent).towers[index].is_placed))){
occupied = true;
currentEnemy = _arg1;
attackPhaseNoEvent();
if (currentEnemy.hp <= 0){
currentEnemy.x = -600;
currentEnemy.y = -400;
occupied = false;
};
addEventListener(Event.ENTER_FRAME, stillInRange, false, 0, true);
};
}
}
}//package
Section 98
//RepairIcon (RepairIcon)
package {
import flash.display.*;
import flash.text.*;
public dynamic class RepairIcon extends MovieClip {
public var amount:TextField;
public function RepairIcon(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 99
//ResourceBuilding (ResourceBuilding)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
import flash.ui.*;
public class ResourceBuilding extends MovieClip {
var sell_shown:Boolean;// = false
var sellIcon:MovieClip;
var mouse_over:Boolean;// = false
var deleted:Boolean;// = false
var itemName:String;// = "Resource Item"
var sounds:Array;
var price:int;// = 100
var baseHeight:int;// = 0
var itemID:int;// = 0
var baseWidth:int;// = 0
var is_hovered:Boolean;// = false
var index:int;// = 0
var is_placed:Boolean;// = false
public function ResourceBuilding(_arg1:int):void{
price = 100;
index = 0;
itemID = 0;
deleted = false;
sell_shown = false;
is_placed = false;
mouse_over = false;
is_hovered = false;
sellIcon = new SellResource();
baseWidth = 0;
baseHeight = 0;
itemName = "Resource Item";
sounds = new Array();
super();
sellIcon.scaleX = 1.2;
sellIcon.scaleY = 1.2;
scaleX = 0.8;
scaleY = 0.8;
baseWidth = width;
baseHeight = height;
index = _arg1;
addEventListener(Event.ENTER_FRAME, placeItem, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, setPlaced, false, 0, true);
addEventListener(MouseEvent.MOUSE_OVER, showInfo, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, stopInfo, false, 0, true);
}
public function showSellIcon(_arg1:Event):void{
if (is_hovered){
if ((((((((mouseX < -((baseWidth / 2)))) || ((mouseX > (baseWidth / 2))))) || ((mouseY > (baseHeight / 2))))) || ((mouseY < -((baseHeight / 2)))))){
removeChild(sellIcon);
is_hovered = false;
stopInfoNoEvent();
Mouse.show();
};
sellIcon.x = mouseX;
sellIcon.y = mouseY;
sellIcon.amount.text = ("+" + getPriceToSell());
} else {
removeEventListener(Event.ENTER_FRAME, showSellIcon);
removeEventListener(MouseEvent.MOUSE_DOWN, sellResourceItem);
sell_shown = false;
};
}
public function activate():void{
}
public function updateColor(_arg1:Event):void{
if (MovieClip(parent).overlapping){
gotoAndStop("overlapping");
} else {
gotoAndStop(1);
};
}
public function playRandomSound():void{
var _local1:Number;
if (((MovieClip(parent).soundEffectsEnabled) && ((itemID < 4)))){
_local1 = Math.random();
if (_local1 >= 0.75){
sounds[0].play();
} else {
if (_local1 >= 0.5){
sounds[1].play();
} else {
if (_local1 >= 0.25){
sounds[2].play();
} else {
sounds[3].play();
};
};
};
};
}
public function setPlaced(_arg1:MouseEvent):void{
if (((!(MovieClip(parent).overlapping)) && (!(MovieClip(parent).checkOverlapFinal(this))))){
is_placed = true;
MovieClip(parent).currently_placing_item = false;
MovieClip(parent).resources = (MovieClip(parent).resources - (price - MovieClip(parent).structurePriceReduction));
MovieClip(parent).resourceBox.text = MovieClip(parent).resources;
removeEventListener(MouseEvent.MOUSE_DOWN, setPlaced);
activate();
alpha = 1;
};
}
public function stopInfoNoEvent():void{
if (!deleted){
mouse_over = false;
MovieClip(parent).infoBox1.text = MovieClip(parent).defaultDataString;
MovieClip(parent).infoBox2.text = MovieClip(parent).defaultStatsString;
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
};
}
public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
is_hovered = true;
if (is_placed){
MovieClip(parent).infoBox1.text = "Put crap here";
MovieClip(parent).infoBox2.text = "For real";
};
}
public function pauseSelf():void{
stop();
}
public function customRemove():void{
}
public function handleSell():void{
is_hovered = true;
Mouse.hide();
addEventListener(Event.ENTER_FRAME, showSellIcon, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, sellResourceItem, false, 0, true);
sell_shown = true;
sellIcon.x = mouseX;
sellIcon.y = mouseY;
addChild(sellIcon);
}
public function deleteSelf():void{
customRemove();
deleted = true;
removeEventListener(Event.ENTER_FRAME, placeItem);
removeEventListener(MouseEvent.MOUSE_OVER, showInfo);
removeEventListener(MouseEvent.MOUSE_OUT, stopInfo);
removeEventListener(Event.ENTER_FRAME, updateColor);
parent.removeChild(this);
}
public function placeItem(_arg1:Event):void{
Mouse.hide();
alpha = 0.5;
x = stage.mouseX;
y = stage.mouseY;
addEventListener(Event.ENTER_FRAME, updateColor, false, 0, true);
if (is_placed){
Mouse.show();
removeEventListener(Event.ENTER_FRAME, placeItem);
removeEventListener(Event.ENTER_FRAME, updateColor);
MovieClip(parent).fixCancelIcon();
MovieClip(parent).resourceItemPlaced(this);
alpha = 1;
playRandomSound();
MovieClip(parent).addChildAt(this, 1);
cacheAsBitmap = true;
if (itemID > 3){
gotoAndPlay(5);
trace("going to frame 2");
trace(currentFrame);
};
};
}
public function sellResourceItem(_arg1:Event):void{
Mouse.show();
MovieClip(parent).sellResourceItem(index);
}
public function stopInfo(_arg1:MouseEvent):void{
mouse_over = false;
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
MovieClip(parent).infoBox1.text = MovieClip(parent).defaultDataString;
MovieClip(parent).infoBox2.text = MovieClip(parent).defaultStatsString;
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
}
public function getPriceToSell():int{
return ((price * 0.6));
}
public function unpauseSelf():void{
}
}
}//package
Section 100
//SellAU (SellAU)
package {
import flash.display.*;
import flash.text.*;
public dynamic class SellAU extends MovieClip {
public var amount:TextField;
public function SellAU(){
addFrameScript(0, frame1);
}
function frame1(){
mouseEnabled = false;
stop();
}
}
}//package
Section 101
//SellResource (SellResource)
package {
import flash.display.*;
import flash.text.*;
public dynamic class SellResource extends MovieClip {
public var amount:TextField;
public function SellResource(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 102
//SellSound (SellSound)
package {
import flash.media.*;
public dynamic class SellSound extends Sound {
}
}//package
Section 103
//sfxIcon (sfxIcon)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class sfxIcon extends MovieClip {
public function sfxIcon(){
addFrameScript(0, frame1);
}
public function enlarge(_arg1:MouseEvent):void{
scaleX = 1.1;
scaleY = 1.1;
}
function frame1(){
stop();
buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, enlarge, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OUT, unlarge, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_UP, disablesfx, false, 0, true);
if (MovieClip(parent).soundEffectsEnabled){
gotoAndStop("default");
} else {
gotoAndStop("soundeffectsoff");
};
}
public function unlarge(_arg1:MouseEvent):void{
scaleX = 1;
scaleY = 1;
}
public function disablesfx(_arg1:MouseEvent):void{
if (MovieClip(parent).soundEffectsEnabled){
MovieClip(parent).soundEffectsEnabled = false;
gotoAndStop("soundeffectsoff");
} else {
MovieClip(parent).soundEffectsEnabled = true;
gotoAndStop("default");
};
}
}
}//package
Section 104
//Snow (Snow)
package {
import flash.display.*;
public dynamic class Snow extends MovieClip {
}
}//package
Section 105
//SquareTop (SquareTop)
package {
import flash.display.*;
public dynamic class SquareTop extends MovieClip {
}
}//package
Section 106
//squareTower (squareTower)
package {
public class squareTower extends Tower {
public function squareTower(_arg1:int):void{
super(_arg1);
baseAttack = 0;
attack = baseAttack;
attackIncrease = 0;
towerName = "Sap Silo";
baseRate = 1200;
rate = baseRate;
rateDecrease = 0;
baseRange = 50;
range = baseRange;
rangeIncrease = 5;
price = 200;
range = 50;
towerID = 2;
}
}
}//package
Section 107
//squareTowerBuild (squareTowerBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class squareTowerBuild extends buildIcon {
public var cost:TextField;
public function squareTowerBuild():void{
addFrameScript(0, frame1, 1, frame2);
towerID = 2;
price = 200;
baseAttack = 0;
baseRate = 1100;
baseRange = 50;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).towerPriceReduction));
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Sap silos do no damage, but they slow enemies that come within range.";
showStats();
}
}
}//package
Section 108
//SurvivalComplete (SurvivalComplete)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.xml.*;
public dynamic class SurvivalComplete extends MovieClip {
public var highScore:TextField;
public var levelSelect2:SimpleButton;
public var retry:SimpleButton;
public var levelSelectTemp:SimpleButton;
public var retryLevelTemp:SimpleButton;
public var time:TextField;
public function SurvivalComplete(){
addFrameScript(37, frame38, 46, frame47);
}
function frame47(){
stop();
}
function frame38(){
time.text = MovieClip(parent).timeToString();
highScore.text = ("HIGH SCORE: " + MovieClip(parent).timeToString2(MovieClip(parent).bestScore));
}
}
}//package
Section 109
//Theme (Theme)
package {
import flash.media.*;
public dynamic class Theme extends Sound {
}
}//package
Section 110
//topBar (topBar)
package {
import flash.display.*;
public dynamic class topBar extends MovieClip {
}
}//package
Section 111
//Tower (Tower)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.ui.*;
public class Tower extends MovieClip {
var xpBar:MovieClip;
var has_glow:Boolean;// = false
var deleted:Boolean;// = false
var augmentedRange:int;// = 0
var mouse_over:Boolean;// = false
var attack:int;// = 10
var augmentAmount:int;// = 0
var baseAttack:int;// = 10
var rangeIncrease:Number;// = 10
var attackIncrease:int;// = 5
var is_hovered:Boolean;// = false
var index:int;// = 0
var rate:int;// = 2000
var baseRange:int;// = 50
var augmented:Boolean;// = false
var is_placed:Boolean;// = false
var xp:int;// = 0
var levelUpSound:Sound;
var minSpeed:Number;// = 1.2
var towerName:String;// = "Tower"
var range:int;// = 50
var price:int;// = 100
var baseHeight:int;// = 0
var augmentedAttack:int;// = 0
var baseRate:int;// = 2000
var baseWidth:int;// = 0
var xpPerLevel:int;
var level:int;// = 1
var rateDecrease:int;// = 200
var attackSound:Sound;
var txtFld:TextField;
var towerID:int;// = 0
var sell_shown:Boolean;// = false
var augmentedRate:int;// = 0
public function Tower(_arg1:int):void{
level = 1;
has_glow = false;
xp = 0;
xpPerLevel = (10 / level);
baseAttack = 10;
attack = 10;
attackIncrease = 5;
baseRate = 2000;
rate = 2000;
rateDecrease = 200;
baseRange = 50;
range = 50;
rangeIncrease = 10;
augmentAmount = 0;
price = 100;
index = 0;
towerID = 0;
sell_shown = false;
is_hovered = false;
deleted = false;
augmented = false;
levelUpSound = new LevelUpSound();
towerName = "Tower";
baseWidth = 0;
baseHeight = 0;
is_placed = false;
mouse_over = false;
txtFld = new TextField();
augmentedAttack = 0;
augmentedRate = 0;
augmentedRange = 0;
xpBar = new TowerxpBar();
minSpeed = 1.2;
super();
scaleX = 0.7;
scaleY = 0.7;
xpBar.scaleX = 0.5;
xpBar.y = 33;
baseWidth = width;
baseHeight = height;
index = _arg1;
addEventListener(Event.ENTER_FRAME, placeTower, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, setPlaced, false, 0, true);
addEventListener(MouseEvent.MOUSE_OVER, showInfo, false, 0, true);
}
public function updateColor(_arg1:Event):void{
if (MovieClip(parent).overlapping){
gotoAndStop("overlapping");
} else {
if (MovieClip(parent).award.allLevelTenTowers){
gotoAndStop("level2");
} else {
gotoAndStop("level1");
};
};
}
public function shoot():void{
if (((!((towerID == 2))) && (MovieClip(parent).soundEffectsEnabled))){
attackSound.play();
};
updateEvents();
}
public function rangeAt(_arg1:int):Number{
return (((baseRange + ((_arg1 - 1) * rangeIncrease)) * MovieClip(parent).RanB[(towerID - 1)]));
}
public function textUpdate(_arg1:Event):void{
if (mouse_over){
} else {
txtFld.alpha = 0;
removeEventListener(Event.ENTER_FRAME, textUpdate);
};
}
public function placeTower(_arg1:Event):void{
Mouse.hide();
alpha = 0.5;
x = stage.mouseX;
y = stage.mouseY;
MovieClip(parent).ranges[index].alpha = 1;
addEventListener(Event.ENTER_FRAME, updateColor, false, 0, true);
if (is_placed){
alpha = 1;
Mouse.show();
removeEventListener(Event.ENTER_FRAME, placeTower);
removeEventListener(Event.ENTER_FRAME, updateColor);
MovieClip(parent).fixCancelIcon();
MovieClip(parent).showSellIconFromTower(this);
MovieClip(parent).addChildAt(this, 1);
MovieClip(parent).manageGlow();
cacheAsBitmap = true;
};
}
public function attackAt(_arg1:int):int{
return (((baseAttack + ((_arg1 - 1) * attackIncrease)) * MovieClip(parent).ABPL[(towerID - 1)]));
}
public function sellTower(_arg1:Event):void{
}
public function removeBar():void{
if (xpBar.parent == this){
removeChild(xpBar);
};
}
public function rateAt(_arg1:int):int{
return (((baseRate - ((_arg1 - 1) * rateDecrease)) * MovieClip(parent).RB[(towerID - 1)]));
}
public function setPlaced(_arg1:MouseEvent):void{
if (((!(MovieClip(parent).overlapping)) && (!(MovieClip(parent).checkOverlapFinal(this))))){
is_placed = true;
MovieClip(parent).currently_placing_tower = false;
gotoAndStop("level1");
if (MovieClip(parent).award.allLevelTenTowers){
gotoAndStop("level2");
startAtTwo();
} else {
if (MovieClip(parent).award.levelTenTowerAward){
gotoAndStop("level1");
xp = 25;
};
};
MovieClip(parent).money = (MovieClip(parent).money - (price = (price - MovieClip(parent).towerPriceReduction)));
MovieClip(parent).moneyBox.text = MovieClip(parent).money;
removeEventListener(MouseEvent.MOUSE_DOWN, setPlaced);
MovieClip(parent).checkForAugment();
MovieClip(parent).towerPlaced(this);
MovieClip(parent).placeTowerTop(this);
};
}
public function updateEvents():void{
if ((xp / 100) >= level){
levelUp();
};
}
public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
is_hovered = true;
addEventListener(Event.ENTER_FRAME, textUpdate, false, 0, true);
if (((((is_placed) && (!(MovieClip(parent).currently_placing_tower)))) && (!(MovieClip(parent).currently_placing_item)))){
updateEvents();
addBar();
MovieClip(parent).ranges[index].alpha = 1;
MovieClip(parent).showSellIconFromTower(this);
if (((((augmentedAttack) || (augmentedRate))) || (augmentedRange))){
MovieClip(parent).buildInfo.text = (((("This " + towerName) + " is receiving benefits from a nearby tower. Bonus: ") + augmentedRate) + " rate.");
} else {
MovieClip(parent).buildInfo.text = towerName;
};
if (level < 10){
MovieClip(parent).infoBox1.text = ((((((("Current level: " + level) + "\n") + "Current XP: ") + xp) + "\n") + "XP to level: ") + ((100 * level) - xp));
} else {
MovieClip(parent).infoBox1.text = (((((("Current level: " + level) + "\n") + "Current XP: ") + xp) + "\n") + "XP to level: -");
};
MovieClip(parent).infoBox2.text = (((((((("Attack: " + attack) + "\n") + "Range: ") + (MovieClip(parent).ranges[index].width / 2)) + "\n") + "Fires Every: ") + rate) + "ms");
};
}
public function updateStats():void{
if (augmentAmount != 0){
augmentAmount = (augmentAmount - 25);
MovieClip(parent).ranges[index].updateAugment();
};
rate = (rateAt(level) + augmentedRate);
attack = (attackAt(level) + augmentedAttack);
setRangeTo(rangeAt(level));
if (MovieClip(parent).ranges[index].isPentagonTower){
MovieClip(parent).checkForAugment();
};
}
public function levelUp():void{
MovieClip(parent).displayLevelUpText(x, y, false);
level++;
gotoAndStop(level);
xpPerLevel = (10 - level);
updateStats();
if (level == 10){
MovieClip(parent).levelTenTower(this);
};
MovieClip(parent).levelGained(this);
if (MovieClip(parent).soundEffectsEnabled){
levelUpSound.play();
};
}
public function stopInfoNoEvent():void{
if (!deleted){
removeBar();
MovieClip(parent).ranges[index].alpha = 0;
mouse_over = false;
MovieClip(parent).infoBox1.text = "";
MovieClip(parent).infoBox2.text = "";
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
};
}
public function showInfoNoEvent():void{
if (((((mouse_over) && (!(MovieClip(parent).currently_placing_tower)))) && (!(MovieClip(parent).currently_placing_item)))){
updateEvents();
addBar();
if (is_placed){
if (((((augmentedAttack) || (augmentedRate))) || (augmentedRange))){
MovieClip(parent).buildInfo.text = (((("This " + towerName) + " is receiving benefits from a nearby tower. Bonus: ") + augmentedRate) + " rate.");
} else {
MovieClip(parent).buildInfo.text = towerName;
};
if (level < 10){
MovieClip(parent).infoBox1.text = ((((((((((("Current level: " + level) + "\n") + "Current XP: ") + xp) + "\n") + "XP to level: ") + ((100 * level) - xp)) + "\n") + "XP per attack: ") + xpPerLevel) + "\n");
} else {
MovieClip(parent).infoBox1.text = ((((((((("Current level: " + level) + "\n") + "Current XP: ") + xp) + "\n") + "XP to level: -") + "\n") + "XP per attack: -") + "\n");
};
MovieClip(parent).infoBox2.text = (((((((("Attack: " + attack) + "\n") + "Range: ") + (MovieClip(parent).ranges[index].width / 2)) + "\n") + "Fires Every: ") + rate) + "ms");
};
};
}
public function deleteSelf():void{
removeEventListener(Event.ENTER_FRAME, placeTower);
removeEventListener(MouseEvent.MOUSE_OVER, showInfo);
removeEventListener(Event.ENTER_FRAME, updateEvents);
removeEventListener(Event.ENTER_FRAME, updateColor);
parent.removeChild(this);
}
public function handleSell():void{
}
public function addBar():void{
addChild(xpBar);
xpBar.bar.width = (((xp - ((level - 1) * 100)) / 100) * (xpBar.width * 2));
}
public function stopInfo(_arg1:MouseEvent):void{
MovieClip(parent).ranges[index].alpha = 0;
removeBar();
mouse_over = false;
MovieClip(parent).infoBox1.text = "";
MovieClip(parent).infoBox2.text = "";
MovieClip(parent).buildInfo.text = MovieClip(parent).defaultBuildInfoString;
}
public function setRangeTo(_arg1:int):void{
MovieClip(parent).ranges[index].width = (_arg1 * 2);
MovieClip(parent).ranges[index].height = (_arg1 * 2);
MovieClip(parent).ranges[index].x = x;
MovieClip(parent).ranges[index].y = y;
}
public function startAtTwo():void{
xp = 100;
level++;
gotoAndStop(level);
xpPerLevel = (10 - level);
updateStats();
}
}
}//package
Section 112
//TowerGlow (TowerGlow)
package {
import flash.display.*;
public class TowerGlow extends MovieClip {
var index:int;// = 0
public function TowerGlow(_arg1:int):void{
index = 0;
super();
index = _arg1;
mouseEnabled = false;
}
public function removeGlow():void{
parent.removeChild(this);
}
}
}//package
Section 113
//TowerTop (TowerTop)
package {
import flash.events.*;
import flash.display.*;
import fl.transitions.easing.*;
import flash.text.*;
import flash.filters.*;
public class TowerTop extends MovieClip {
var towerID:int;// = 0
var companion:MovieClip;
var deleted:Boolean;// = false
var towerTop:MovieClip;
var index:int;// = 0
var ybuffer:int;// = 10
public function TowerTop(_arg1:MovieClip):void{
index = 0;
towerID = 0;
towerTop = new MovieClip();
companion = new MovieClip();
ybuffer = 10;
deleted = false;
super();
index = _arg1.index;
towerID = _arg1.towerID;
towerTop.x = _arg1.x;
towerTop.scaleX = 0.7;
towerTop.scaleY = 0.7;
towerTop.y = (_arg1.y - ybuffer);
companion = _arg1;
placeTop();
}
private function rad2deg(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
private function getAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number;
_local5 = Math.atan2((_arg2 - _arg4), (_arg1 - _arg3));
return (rad2deg(_local5));
}
public function pointTopNoEvent():void{
if (((MovieClip(parent).ranges[index].enemyInRange()) && (MovieClip(parent).ranges[index].occupied))){
towerTop.rotation = getAngle(MovieClip(parent).ranges[index].currentEnemy.x, MovieClip(parent).ranges[index].currentEnemy.y, towerTop.x, towerTop.y);
};
}
public function fire():void{
towerTop.gotoAndPlay("fire");
}
public function activateTop():void{
addEventListener(Event.ENTER_FRAME, pointTop, false, 0, true);
}
public function deleteSelf():void{
deleted = true;
removeEventListener(Event.ENTER_FRAME, pointTop);
removeChild(towerTop);
parent.removeChild(this);
}
public function pointTop(_arg1:Event):void{
towerTop.x = companion.x;
towerTop.y = (companion.y - ybuffer);
if (((MovieClip(parent).ranges[index].enemyInRange()) && (MovieClip(parent).ranges[index].occupied))){
towerTop.rotation = getAngle(MovieClip(parent).ranges[index].currentEnemy.x, MovieClip(parent).ranges[index].currentEnemy.y, towerTop.x, towerTop.y);
};
}
public function placeTop():void{
if (towerID == 1){
towerTop = new CircleTop();
} else {
if (towerID == 2){
towerTop = new SquareTop();
} else {
if (towerID == 3){
towerTop = new PentagonTop();
} else {
if (towerID == 4){
towerTop = new CannonTop();
};
};
};
};
towerTop.scaleX = 0.8;
towerTop.scaleY = 0.8;
towerTop.rotation = -90;
addChild(towerTop);
mouseEnabled = false;
towerTop.mouseEnabled = false;
activateTop();
}
}
}//package
Section 114
//TowerxpBar (TowerxpBar)
package {
import flash.display.*;
public dynamic class TowerxpBar extends MovieClip {
public var bar:MovieClip;
}
}//package
Section 115
//TrainingBuild (TrainingBuild)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class TrainingBuild extends buildItemIcon {
public var cost:TextField;
public function TrainingBuild():void{
addFrameScript(0, frame1, 1, frame2);
itemID = 3;
price = 800;
buttonMode = true;
}
function frame1(){
stop();
}
function frame2(){
cost.text = ("" + (price - MovieClip(parent).structurePriceReduction));
}
override function showStats():void{
var _local1:int;
_local1 = (price - MovieClip(parent).structurePriceReduction);
MovieClip(parent).infoBox1.text = (("Price: " + int(_local1)) + " resources");
MovieClip(parent).infoBox2.text = ("Gives an XP bonus" + "\nevery 30 seconds");
}
override function showBuildDescription():void{
MovieClip(parent).buildInfo.text = "Training Centers periodically award XP to your towers";
showStats();
}
}
}//package
Section 116
//TrainingCenter (TrainingCenter)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class TrainingCenter extends ResourceBuilding {
var timerDelay:int;// = 30000
var amount:int;// = 10
var genericTimer:Timer;
public function TrainingCenter(_arg1:int):void{
amount = 10;
timerDelay = 30000;
genericTimer = new Timer(timerDelay);
addFrameScript(0, frame1);
super(_arg1);
price = 800;
itemID = 3;
sounds.push(new trainingcenter1(), new trainingcenter1(), new trainingcenter1(), new trainingcenter1());
itemName = "Training Center";
}
override public function showInfo(_arg1:MouseEvent):void{
mouse_over = true;
if (((((is_placed) && (!(MovieClip(parent).currently_placing_tower)))) && (!(MovieClip(parent).currently_placing_item)))){
MovieClip(parent).buildInfo.text = itemName;
MovieClip(parent).infoBox1.text = (("Giving bonus XP \nevery " + int((genericTimer.delay / 1000))) + " seconds.");
MovieClip(parent).infoBox2.text = MovieClip(parent).defaultStatsString;
handleSell();
};
}
override public function customRemove():void{
genericTimer.stop();
genericTimer.removeEventListener(TimerEvent.TIMER, giveXP);
}
override public function pauseSelf():void{
genericTimer.stop();
}
function frame1(){
stop();
}
public function giveXP(_arg1:TimerEvent):void{
var _local2:int;
if (MovieClip(parent).enemiesStarted){
_local2 = 0;
while (_local2 < MovieClip(parent).ranges.length) {
if (!MovieClip(parent).ranges[_local2].deleted){
MovieClip(parent).ranges[_local2].incrementXPBy(amount);
};
_local2++;
};
};
}
override public function unpauseSelf():void{
genericTimer.start();
}
override public function activate():void{
genericTimer.start();
genericTimer.addEventListener(TimerEvent.TIMER, giveXP, false, 0, true);
}
}
}//package
Section 117
//trainingcenter1 (trainingcenter1)
package {
import flash.media.*;
public dynamic class trainingcenter1 extends Sound {
}
}//package
Section 118
//TurretLevel (TurretLevel)
package {
import flash.display.*;
public dynamic class TurretLevel extends MovieClip {
public function TurretLevel(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
MovieClip(parent).removeChild(this);
}
}
}//package
Section 119
//Wave (Wave)
package {
public class Wave extends Enemy {
var waveDelay:int;// = 10000
var num_enemies:int;// = 3
var spawned:Boolean;// = false
var enemyID:int;// = 1
var enemyDelay:int;// = 1
public function Wave(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
num_enemies = 3;
enemyID = 1;
enemyDelay = 1;
waveDelay = 10000;
spawned = false;
super();
num_enemies = _arg1;
enemyID = _arg3;
enemyDelay = _arg2;
waveDelay = _arg4;
}
}
}//package
Section 120
//WinSound (WinSound)
package {
import flash.media.*;
public dynamic class WinSound extends Sound {
}
}//package