Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.events.*;
import com.kongregate.as3.client.services.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//artlogic_logo_103 (number07_fla.artlogic_logo_103)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class artlogic_logo_103 extends MovieClip {
public var btn_sponsor:SimpleButton;
public var thisparent;
public function artlogic_logo_103(){
super();
addFrameScript(0, frame1);
}
function frame1(){
thisparent = parent;
btn_sponsor.addEventListener(MouseEvent.MOUSE_UP, gotoSponsor, false, 0, true);
}
public function gotoSponsor(e){
thisparent.gotoArtlogic();
}
}
}//package number07_fla
Section 14
//bt_createtower1_193 (number07_fla.bt_createtower1_193)
package number07_fla {
import flash.display.*;
public dynamic class bt_createtower1_193 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createtower1_193(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 15
//bt_createtower2_195 (number07_fla.bt_createtower2_195)
package number07_fla {
import flash.display.*;
public dynamic class bt_createtower2_195 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createtower2_195(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 16
//bt_createtower3_197 (number07_fla.bt_createtower3_197)
package number07_fla {
import flash.display.*;
public dynamic class bt_createtower3_197 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createtower3_197(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 17
//bt_createunit1_177 (number07_fla.bt_createunit1_177)
package number07_fla {
import flash.display.*;
public dynamic class bt_createunit1_177 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createunit1_177(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 18
//bt_createunit2_179 (number07_fla.bt_createunit2_179)
package number07_fla {
import flash.display.*;
public dynamic class bt_createunit2_179 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createunit2_179(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 19
//bt_createunit3_181 (number07_fla.bt_createunit3_181)
package number07_fla {
import flash.display.*;
public dynamic class bt_createunit3_181 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createunit3_181(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 20
//bt_createunit4_183 (number07_fla.bt_createunit4_183)
package number07_fla {
import flash.display.*;
public dynamic class bt_createunit4_183 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createunit4_183(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 21
//bt_createunit5_185 (number07_fla.bt_createunit5_185)
package number07_fla {
import flash.display.*;
public dynamic class bt_createunit5_185 extends MovieClip {
public var btactive:SimpleButton;
public function bt_createunit5_185(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 22
//bt_special1_187 (number07_fla.bt_special1_187)
package number07_fla {
import flash.display.*;
public dynamic class bt_special1_187 extends MovieClip {
public var btactive:SimpleButton;
public function bt_special1_187(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 23
//bt_special2_189 (number07_fla.bt_special2_189)
package number07_fla {
import flash.display.*;
public dynamic class bt_special2_189 extends MovieClip {
public var btactive:SimpleButton;
public var blinker:MovieClip;
public function bt_special2_189(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 24
//bt_special3_191 (number07_fla.bt_special3_191)
package number07_fla {
import flash.display.*;
public dynamic class bt_special3_191 extends MovieClip {
public var btactive:SimpleButton;
public var blinker:MovieClip;
public function bt_special3_191(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 25
//bt_special4_175 (number07_fla.bt_special4_175)
package number07_fla {
import flash.display.*;
public dynamic class bt_special4_175 extends MovieClip {
public var btactive:SimpleButton;
public var blinker:MovieClip;
public function bt_special4_175(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
function frame3(){
stop();
btactive.visible = true;
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = false;
}
}
}//package number07_fla
Section 26
//bt_upgrade1_202 (number07_fla.bt_upgrade1_202)
package number07_fla {
import flash.display.*;
public dynamic class bt_upgrade1_202 extends MovieClip {
public var btactive:SimpleButton;
public function bt_upgrade1_202(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = true;
}
}
}//package number07_fla
Section 27
//bt_upgrade2_205 (number07_fla.bt_upgrade2_205)
package number07_fla {
import flash.display.*;
public dynamic class bt_upgrade2_205 extends MovieClip {
public var btactive:SimpleButton;
public function bt_upgrade2_205(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = true;
}
}
}//package number07_fla
Section 28
//bt_upgrade3_207 (number07_fla.bt_upgrade3_207)
package number07_fla {
import flash.display.*;
public dynamic class bt_upgrade3_207 extends MovieClip {
public var btactive:SimpleButton;
public var repairlighter:MovieClip;
public function bt_upgrade3_207(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = true;
}
}
}//package number07_fla
Section 29
//bt_upgrade4_210 (number07_fla.bt_upgrade4_210)
package number07_fla {
import flash.display.*;
public dynamic class bt_upgrade4_210 extends MovieClip {
public var btactive:SimpleButton;
public function bt_upgrade4_210(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = true;
}
}
}//package number07_fla
Section 30
//bt_upgrade5_212 (number07_fla.bt_upgrade5_212)
package number07_fla {
import flash.display.*;
public dynamic class bt_upgrade5_212 extends MovieClip {
public var btactive:SimpleButton;
public function bt_upgrade5_212(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
btactive.visible = false;
}
function frame2(){
stop();
btactive.visible = true;
}
}
}//package number07_fla
Section 31
//btn_lockthiszoom_22 (number07_fla.btn_lockthiszoom_22)
package number07_fla {
import flash.display.*;
public dynamic class btn_lockthiszoom_22 extends MovieClip {
public var on_btn:SimpleButton;
public var off_btn:SimpleButton;
public function btn_lockthiszoom_22(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package number07_fla
Section 32
//healthbar_49 (number07_fla.healthbar_49)
package number07_fla {
import flash.display.*;
public dynamic class healthbar_49 extends MovieClip {
public function healthbar_49(){
super();
addFrameScript(0, frame1);
}
function frame1(){
gotoAndStop(110);
}
}
}//package number07_fla
Section 33
//healthbar_72 (number07_fla.healthbar_72)
package number07_fla {
import flash.display.*;
public dynamic class healthbar_72 extends MovieClip {
public function healthbar_72(){
super();
addFrameScript(0, frame1);
}
function frame1(){
gotoAndStop(110);
}
}
}//package number07_fla
Section 34
//kong_intro_mc_88 (number07_fla.kong_intro_mc_88)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class kong_intro_mc_88 extends MovieClip {
public var btn_sponsor:SimpleButton;
public var thisparent;
public function kong_intro_mc_88(){
super();
addFrameScript(0, frame1);
}
function frame1(){
thisparent = parent;
btn_sponsor.addEventListener(MouseEvent.MOUSE_UP, gotoSponsor, false, 0, true);
}
public function gotoSponsor(e){
thisparent.gotoMoreGame();
}
}
}//package number07_fla
Section 35
//lighter_209 (number07_fla.lighter_209)
package number07_fla {
import flash.display.*;
public dynamic class lighter_209 extends MovieClip {
public function lighter_209(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 36
//MainTimeline (number07_fla.MainTimeline)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var moreGameURL;
public var myMenu;
public var presentsintro:MovieClip;
public var kongaiGameURL;
public var kongintro:MovieClip;
public var adsGameURL;
public var artlogicURL;
public var usemochi;
public var item1:ContextMenuItem;
public var gameData;
public var gameMgr;
public var artintro:MovieClip;
public var sndMgr;
public function MainTimeline(){
super();
addFrameScript(0, frame1, 4, frame5, 5, frame6, 9, frame10, 22, frame23, 28, frame29, 29, frame30, 33, frame34, 34, frame35, 39, frame40, 43, frame44, 44, frame45, 48, frame49, 49, frame50, 53, frame54, 54, frame55, 58, frame59, 59, frame60, 63, frame64, 64, frame65, 68, frame69, 69, frame70, 73, frame74, 74, frame75, 78, frame79, 79, frame80, 83, frame84, 84, frame85, 88, frame89, 89, frame90, 93, frame94);
}
function frame65(){
stop();
sndMgr.playBGM("cover");
}
function frame70(){
stop();
sndMgr.playBGM("ambient");
}
function frame64(){
gotoAndPlay("winpage");
}
function frame75(){
stop();
sndMgr.playBGM("ambient");
}
function frame79(){
gotoAndPlay("abortpage");
}
function frame74(){
gotoAndPlay("lostpage");
}
function frame80(){
stop();
}
function frame84(){
gotoAndPlay("statisticspage");
}
function frame89(){
gotoAndPlay("instructionspage");
}
function frame85(){
stop();
}
function frame90(){
stop();
}
public function waitKongSplash(e){
if (kongintro.currentFrame == kongintro.totalFrames){
removeEventListener(Event.ENTER_FRAME, waitKongSplash);
gotoAndPlay("algsplashpage");
};
}
function frame10(){
gotoAndPlay("lockpage");
}
function frame94(){
gotoAndPlay("creditspage");
}
public function gotoKongaiGame(e=null){
navigateToURL(new URLRequest(kongaiGameURL), "_blank");
}
public function gotoMoreGame(e=null){
navigateToURL(new URLRequest(moreGameURL), "_blank");
}
function frame1(){
MochiBot.track(this, "db92117b");
stage.scaleMode = StageScaleMode.NO_SCALE;
usemochi = false;
artlogicURL = "http://www.artlogicgames.com/";
moreGameURL = "http://www.kongregate.com/?gamereferral=sky-invasion";
adsGameURL = "http://www.kongregate.com/?gamereferral=sky-invasion";
kongaiGameURL = "http://www.kongregate.com/games/Kongregate/kongai/?gamereferral=sky-invasion";
gameMgr = null;
sndMgr = null;
gameData = null;
item1 = new ContextMenuItem("© 2009 Artlogic Games™");
item1.separatorBefore = true;
item1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, gotoArtlogic);
myMenu = new ContextMenu();
myMenu.hideBuiltInItems();
myMenu.customItems.push(item1);
this.contextMenu = myMenu;
stop();
}
public function gotoArtlogic(e=null){
navigateToURL(new URLRequest(artlogicURL), "_blank");
}
function frame6(){
stop();
}
function frame23(){
if (!sndMgr){
sndMgr = new SoundManager();
};
if (!gameData){
gameData = new DataManager(this);
};
stop();
addEventListener(Event.ENTER_FRAME, waitKongSplash, false, 0, true);
}
function frame5(){
stop();
}
public function waitPresentsSplash(e){
if (presentsintro.currentFrame == presentsintro.totalFrames){
removeEventListener(Event.ENTER_FRAME, waitPresentsSplash);
gotoAndPlay("mainmenu");
};
}
function frame29(){
gotoAndPlay("kongsplashpage");
}
function frame30(){
stop();
addEventListener(Event.ENTER_FRAME, waitArtSplash, false, 0, true);
}
function frame34(){
gotoAndPlay("algsplashpage");
}
function frame35(){
stop();
sndMgr.playBGM("cover");
addEventListener(Event.ENTER_FRAME, waitPresentsSplash, false, 0, true);
}
function frame40(){
stop();
sndMgr.playBGM("cover");
}
function frame44(){
gotoAndPlay("mainmenu");
}
public function waitArtSplash(e){
if (artintro.currentFrame == artintro.totalFrames){
removeEventListener(Event.ENTER_FRAME, waitArtSplash);
gotoAndPlay("presentspage");
};
}
function frame45(){
stop();
}
function frame49(){
gotoAndPlay("levelselect");
}
function frame54(){
gotoAndPlay("levelselect");
}
function frame50(){
stop();
}
function frame59(){
gotoAndPlay("gameplay");
}
function frame55(){
stop();
if (gameMgr){
gameMgr.stopGame();
this.removeChild(gameMgr);
};
gameMgr = new GameManager(this);
}
public function gotoAdsGame(e=null){
navigateToURL(new URLRequest(adsGameURL), "_blank");
}
function frame60(){
stop();
sndMgr.playBGM("cover");
}
function frame69(){
gotoAndPlay("ultimatewinpage");
}
}
}//package number07_fla
Section 37
//mc_abortpage_153 (number07_fla.mc_abortpage_153)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_abortpage_153 extends MovieClip {
public var adsbox:MovieClip;
public var ad;
public var losttroopsscore:TextField;
public var createdtroopscount:TextField;
public var experience:TextField;
public var destroyedenemiescount:TextField;
public var kongbox:MovieClip;
public var leveltime:TextField;
public var losttroopscount:TextField;
public var usemochi;
public var gamewin;
public var destroyedenemiesscore:TextField;
public var thisparent;
public var CPMStarContentSpotID:String;
public var createdtroopsscore:TextField;
public var btcontinue:SimpleButton;
public function mc_abortpage_153(){
super();
addFrameScript(0, frame1, 65, frame66);
}
function frame1(){
kongbox.visible = false;
adsbox.visible = false;
}
public function goLevelSelect(e=null){
if (((((((((((((thisparent.gameData.research1Enabled()) || (thisparent.gameData.research2Enabled()))) || (thisparent.gameData.research3Enabled()))) || (thisparent.gameData.research4Enabled()))) || (thisparent.gameData.research5Enabled()))) || (thisparent.gameData.research6Enabled()))) || (thisparent.gameData.research7Enabled()))){
if (adsbox.visible){
if (ad){
adsbox.removeChild(ad);
};
};
thisparent.gotoAndPlay("researchpage");
} else {
thisparent.gotoAndPlay("levelselect");
};
removeChild(adsbox);
}
public function checkSiteLock():Boolean{
var res:*;
res = false;
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("www.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("a.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("chat.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("bin") > -1)));
return (res);
}
public function gotoAds(e){
thisparent.gotoAdsGame();
}
function frame66(){
stop();
thisparent = parent;
ad = null;
usemochi = thisparent.usemochi;
CPMStarContentSpotID = "420Q1058780B";
if ((((Math.random() < 0.5)) || (checkSiteLock()))){
kongbox.visible = true;
kongbox.addEventListener(MouseEvent.MOUSE_UP, gotoAds, false, 0, true);
} else {
adsbox.visible = true;
if (usemochi){
MochiAd.showClickAwayAd({clip:adsbox, id:"48450a715b66ea35"});
} else {
ad = new AdLoader(CPMStarContentSpotID);
adsbox.addChild(ad);
};
};
gamewin = false;
destroyedenemiescount.text = thisparent.gameData.getDestroyedEnemiesCount();
destroyedenemiesscore.text = "0\n0\n0";
createdtroopscount.text = thisparent.gameData.getCreatedTroopsCount();
createdtroopsscore.text = "0\n0\n0";
losttroopscount.text = thisparent.gameData.getLostTroopsCount();
losttroopsscore.text = "0\n0\n0";
leveltime.text = thisparent.gameData.getLevelTime();
experience.text = "0";
thisparent.gameData.setUnfinishedLevel();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
}
}
}//package number07_fla
Section 38
//mc_autosave_150 (number07_fla.mc_autosave_150)
package number07_fla {
import flash.display.*;
public dynamic class mc_autosave_150 extends MovieClip {
public function mc_autosave_150(){
super();
addFrameScript(89, frame90);
}
function frame90(){
stop();
}
}
}//package number07_fla
Section 39
//mc_computerbasehealthbar_171 (number07_fla.mc_computerbasehealthbar_171)
package number07_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mc_computerbasehealthbar_171 extends MovieClip {
public var txt:TextField;
public function mc_computerbasehealthbar_171(){
super();
}
}
}//package number07_fla
Section 40
//mc_covermute_112 (number07_fla.mc_covermute_112)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_covermute_112 extends MovieClip {
public var maintimeline;
public function mc_covermute_112(){
super();
addFrameScript(0, frame1);
}
public function init(){
this.addEventListener(MouseEvent.MOUSE_UP, toggleSound, false, 0, true);
if ((((maintimeline.sndMgr.bgmVolume > 0)) || ((maintimeline.sndMgr.sfxVolume > 0)))){
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
};
}
public function toggleSound(e){
if ((((maintimeline.sndMgr.bgmVolume > 0)) || ((maintimeline.sndMgr.sfxVolume > 0)))){
maintimeline.sndMgr.bgmVolume = 0;
maintimeline.sndMgr.sfxVolume = 0;
maintimeline.sndMgr.refreshVolume();
this.gotoAndStop(2);
} else {
maintimeline.sndMgr.bgmVolume = 1;
maintimeline.sndMgr.sfxVolume = 1;
maintimeline.sndMgr.refreshVolume();
this.gotoAndStop(1);
};
}
function frame1(){
stop();
maintimeline = parent.parent;
init();
}
}
}//package number07_fla
Section 41
//mc_creditspage_161 (number07_fla.mc_creditspage_161)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_creditspage_161 extends MovieClip {
public var thisparent;
public var btcontinue:SimpleButton;
public function mc_creditspage_161(){
super();
addFrameScript(5, frame6, 10, frame11);
}
function frame6(){
stop();
thisparent = parent;
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
}
public function goLevelSelect(e=null){
play();
}
function frame11(){
thisparent.gotoAndPlay("mainmenu");
}
}
}//package number07_fla
Section 42
//mc_goldbar_170 (number07_fla.mc_goldbar_170)
package number07_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mc_goldbar_170 extends MovieClip {
public var txt:TextField;
public function mc_goldbar_170(){
super();
}
}
}//package number07_fla
Section 43
//mc_gun_26 (number07_fla.mc_gun_26)
package number07_fla {
import flash.display.*;
public dynamic class mc_gun_26 extends MovieClip {
public var mcgunfire:MovieClip;
public function mc_gun_26(){
super();
}
}
}//package number07_fla
Section 44
//mc_gunfire_27 (number07_fla.mc_gunfire_27)
package number07_fla {
import flash.display.*;
public dynamic class mc_gunfire_27 extends MovieClip {
public function mc_gunfire_27(){
super();
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
gotoAndStop(2);
}
function frame8(){
gotoAndStop(2);
}
}
}//package number07_fla
Section 45
//mc_gunfire_50 (number07_fla.mc_gunfire_50)
package number07_fla {
import flash.display.*;
public dynamic class mc_gunfire_50 extends MovieClip {
public function mc_gunfire_50(){
super();
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
gotoAndStop(2);
}
function frame8(){
gotoAndStop(2);
}
}
}//package number07_fla
Section 46
//mc_gunfire_69 (number07_fla.mc_gunfire_69)
package number07_fla {
import flash.display.*;
public dynamic class mc_gunfire_69 extends MovieClip {
public function mc_gunfire_69(){
super();
addFrameScript(0, frame1, 7, frame8);
}
function frame1(){
gotoAndStop(2);
}
function frame8(){
gotoAndStop(2);
}
}
}//package number07_fla
Section 47
//mc_guntowergun_52 (number07_fla.mc_guntowergun_52)
package number07_fla {
import flash.display.*;
public dynamic class mc_guntowergun_52 extends MovieClip {
public var mcgunfire:MovieClip;
public function mc_guntowergun_52(){
super();
}
}
}//package number07_fla
Section 48
//mc_guntowergunenemy_54 (number07_fla.mc_guntowergunenemy_54)
package number07_fla {
import flash.display.*;
public dynamic class mc_guntowergunenemy_54 extends MovieClip {
public var mcgunfire:MovieClip;
public function mc_guntowergunenemy_54(){
super();
}
}
}//package number07_fla
Section 49
//mc_info_144 (number07_fla.mc_info_144)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_info_144 extends MovieClip {
public var note1;
public var note2;
public var txt1:TextField;
public var txt2:TextField;
public function mc_info_144(){
super();
addFrameScript(0, frame1, 6, frame7, 13, frame14);
}
function frame14(){
stop();
}
public function hideNote(){
gotoAndPlay("hide");
}
function frame7(){
stop();
txt1.text = note1;
txt2.text = note2;
}
function frame1(){
note1 = "lorem ipsum dolor sit amet";
note2 = "G 9999";
gotoAndStop("hidden");
}
public function showNote(_pt, _note1, _note2){
note1 = _note1;
note2 = _note2;
this.x = _pt.x;
this.y = _pt.y;
gotoAndPlay("show");
}
}
}//package number07_fla
Section 50
//mc_info_227 (number07_fla.mc_info_227)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_info_227 extends MovieClip {
public var note1;
public var note2;
public var txt1:TextField;
public var txt2:TextField;
public function mc_info_227(){
super();
addFrameScript(0, frame1, 6, frame7, 13, frame14);
}
function frame14(){
stop();
}
public function hideNote(){
if (((!((currentLabel == "hide"))) && (!((currentLabel == "hidden"))))){
gotoAndPlay("hide");
};
}
function frame7(){
stop();
txt1.text = note1;
txt2.text = note2;
}
function frame1(){
note1 = "lorem ipsum dolor sit amet";
note2 = "G 9999";
gotoAndStop("hidden");
}
public function showNote(_pt, _note1, _note2){
note1 = _note1;
note2 = _note2;
this.x = _pt.x;
this.y = _pt.y;
if (((!((currentLabel == "show"))) && (!((currentLabel == "shown"))))){
gotoAndPlay("show");
};
}
}
}//package number07_fla
Section 51
//mc_infoleft_128 (number07_fla.mc_infoleft_128)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_infoleft_128 extends MovieClip {
public var note1;
public var note2;
public var txt1:TextField;
public var txt2:TextField;
public function mc_infoleft_128(){
super();
addFrameScript(0, frame1, 6, frame7, 13, frame14);
}
function frame14(){
stop();
}
public function hideNote(){
gotoAndPlay("hide");
}
function frame7(){
stop();
txt1.text = note1;
txt2.text = note2;
}
function frame1(){
note1 = "lorem ipsum dolor sit amet";
note2 = "G 9999";
gotoAndStop("hidden");
}
public function showNote(_pt, _note1, _note2){
note1 = _note1;
note2 = _note2;
this.x = _pt.x;
this.y = _pt.y;
gotoAndPlay("show");
}
}
}//package number07_fla
Section 52
//mc_inforight_130 (number07_fla.mc_inforight_130)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_inforight_130 extends MovieClip {
public var note1;
public var note2;
public var txt1:TextField;
public var txt2:TextField;
public function mc_inforight_130(){
super();
addFrameScript(0, frame1, 6, frame7, 13, frame14);
}
function frame14(){
stop();
}
public function hideNote(){
gotoAndPlay("hide");
}
function frame7(){
stop();
txt1.text = note1;
txt2.text = note2;
}
function frame1(){
note1 = "lorem ipsum dolor sit amet";
note2 = "G 9999";
gotoAndStop("hidden");
}
public function showNote(_pt, _note1, _note2){
note1 = _note1;
note2 = _note2;
this.x = _pt.x;
this.y = _pt.y;
gotoAndPlay("show");
}
}
}//package number07_fla
Section 53
//mc_instructions_contents_156 (number07_fla.mc_instructions_contents_156)
package number07_fla {
import flash.events.*;
import flash.display.*;
public dynamic class mc_instructions_contents_156 extends MovieClip {
public var btinstructions1:SimpleButton;
public var btinstructions2:SimpleButton;
public var btinstructions3:SimpleButton;
public var btinstructions4:SimpleButton;
public function mc_instructions_contents_156(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
btinstructions1.addEventListener(MouseEvent.MOUSE_UP, goPage1, false, 0, true);
btinstructions2.addEventListener(MouseEvent.MOUSE_UP, goPage2, false, 0, true);
btinstructions3.addEventListener(MouseEvent.MOUSE_UP, goPage3, false, 0, true);
btinstructions4.addEventListener(MouseEvent.MOUSE_UP, goPage4, false, 0, true);
}
function frame1(){
stop();
btinstructions1.addEventListener(MouseEvent.MOUSE_UP, goPage1, false, 0, true);
btinstructions2.addEventListener(MouseEvent.MOUSE_UP, goPage2, false, 0, true);
btinstructions3.addEventListener(MouseEvent.MOUSE_UP, goPage3, false, 0, true);
btinstructions4.addEventListener(MouseEvent.MOUSE_UP, goPage4, false, 0, true);
}
function frame4(){
stop();
btinstructions1.addEventListener(MouseEvent.MOUSE_UP, goPage1, false, 0, true);
btinstructions2.addEventListener(MouseEvent.MOUSE_UP, goPage2, false, 0, true);
btinstructions3.addEventListener(MouseEvent.MOUSE_UP, goPage3, false, 0, true);
btinstructions4.addEventListener(MouseEvent.MOUSE_UP, goPage4, false, 0, true);
}
public function goPage2(e=null){
if (currentFrame != 2){
gotoAndPlay(2);
};
}
public function goPage3(e=null){
if (currentFrame != 3){
gotoAndPlay(3);
};
}
public function goPage4(e=null){
if (currentFrame != 4){
gotoAndPlay(4);
};
}
function frame2(){
stop();
btinstructions1.addEventListener(MouseEvent.MOUSE_UP, goPage1, false, 0, true);
btinstructions2.addEventListener(MouseEvent.MOUSE_UP, goPage2, false, 0, true);
btinstructions3.addEventListener(MouseEvent.MOUSE_UP, goPage3, false, 0, true);
btinstructions4.addEventListener(MouseEvent.MOUSE_UP, goPage4, false, 0, true);
}
public function goPage1(e=null){
if (currentFrame != 1){
gotoAndPlay(1);
};
}
}
}//package number07_fla
Section 54
//mc_instructionspage_155 (number07_fla.mc_instructionspage_155)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_instructionspage_155 extends MovieClip {
public var thisparent;
public var btcontinue:SimpleButton;
public function mc_instructionspage_155(){
super();
addFrameScript(0, frame1, 5, frame6, 10, frame11);
}
function frame6(){
stop();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
}
function frame1(){
thisparent = parent;
}
public function goLevelSelect(e=null){
btcontinue.removeEventListener(MouseEvent.MOUSE_UP, goLevelSelect);
play();
}
function frame11(){
thisparent.gotoAndPlay("levelselect");
}
}
}//package number07_fla
Section 55
//mc_levelselect_113 (number07_fla.mc_levelselect_113)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_levelselect_113 extends MovieClip {
public var levelLongNote;
public var leveltxt:TextField;
public var special1:MovieClip;
public var special2:MovieClip;
public var special3:MovieClip;
public var special4:MovieClip;
public var mc_select10:MovieClip;
public var mc_select11:MovieClip;
public var mc_select12:MovieClip;
public var btplaylevel:SimpleButton;
public var thisparent;
public var btplaymore:SimpleButton;
public var btstatistics:SimpleButton;
public var btinstructions:SimpleButton;
public var mc_select2:MovieClip;
public var mc_select3:MovieClip;
public var mc_select5:MovieClip;
public var mc_select7:MovieClip;
public var mc_select8:MovieClip;
public var mc_select9:MovieClip;
public var mc_select1:MovieClip;
public var mc_select4:MovieClip;
public var mc_select6:MovieClip;
public var mcinfoleft:MovieClip;
public var mcinforight:MovieClip;
public var levelShortNote;
public var btbacktomenu:SimpleButton;
public var btresearch:SimpleButton;
public function mc_levelselect_113(){
super();
addFrameScript(0, frame1);
}
public function goStatistics(e=null){
thisparent.gotoAndPlay("statisticspage");
}
public function setLevel2(e=null){
thisparent.gameData.selectedlevel = 2;
refreshPanel();
}
public function setLevel3(e=null){
thisparent.gameData.selectedlevel = 3;
refreshPanel();
}
public function setLevel5(e=null){
thisparent.gameData.selectedlevel = 5;
refreshPanel();
}
public function setLevel6(e=null){
thisparent.gameData.selectedlevel = 6;
refreshPanel();
}
public function setLevel7(e=null){
thisparent.gameData.selectedlevel = 7;
refreshPanel();
}
public function setLevel1(e=null){
thisparent.gameData.selectedlevel = 1;
refreshPanel();
}
public function setLevel9(e=null){
thisparent.gameData.selectedlevel = 9;
refreshPanel();
}
public function setLevel8(e=null){
thisparent.gameData.selectedlevel = 8;
refreshPanel();
}
public function setLevel4(e=null){
thisparent.gameData.selectedlevel = 4;
refreshPanel();
}
public function goPlayGame(e=null){
thisparent.gameData.selectLevel();
thisparent.gotoAndPlay("gameplay");
}
function frame1(){
stop();
thisparent = parent;
levelShortNote = new Array("Ch 1: Operation Invasion", "Ch 2: New Memphis", "Ch 3: Amerigo Vespucci", "Ch 4: New Generation Aircrafts", "Ch 5: Baloon Bomber", "Ch 6: No Nego! No Sireee!", "Ch 7: Tower Destroyer", "Ch 8: Technology Thievery", "Ch 9: One Key", "Ch 10: East Europe Gate", "Ch 11: West Europe Gate", "Ch 12 : Antioch");
levelLongNote = new Array("November AD 2569. Earth Alliance Federation has their colony bases spread all around the continents on Earth. Centuries has passed by since our colonization to Mars, now is time to go home to Earth as Mars is slowly dying. But EAF doesn’t allow us to land our feet. There’s only one answer to get back our right of Earth : INVASION.", "EAF has just strengthened their base near our first base on Earth that will be a big threat for us. We just sent our second base to their lair, but we need a capable commander: YOU. Prepare yourself for the journey to New Memphis.", "Well done Sir, now we have half of Africa on our hand. Our Main Headquarter on Mars has sent the next base to America. They should be on the way by now. We have already arranged a shuttle for you to America. Show them that we are destined to live on Earth.", "We have news from the Headquarter that they are researching a new type of aircrafts which has a better armor, called Battle Cruiser. The trainers have come to our new base in America. Try them, and feel their strength!", "We found an old technology which can still be used as it has a great defense system against enemy invasion. They could also destroy the ground object effectively. Our scientists call it “New Zeppelin”, but we prefer to name it “Valor”, after our God of War.", "An EAF messenger has come to our base to negotiate. We just found a great negotiator: YOU, of course! Negotiate with them by “Ka-Boom”-ing them and their city at once. We have offered peace since the beginning. They should blame themselves retrospectively!", "EAF keeps invading with their better troops. We must stand them. We know such tech spends great amount of gold, they couldn’t create it so often. Our tower still won't stand a chance against their missile system, though. I wish we could have an idea to overcome that.", "EAF has built new undefeatable drones that come with a great airship armory. But fear, not! Our intelligent has found that we can inject this Aircraft Carrier technology to our system. Defeat one of those carrier so we could extract their technology!", "Thanks to your command, our territory is getting wider now. This current continent is their last stand on Asia. This is the last key to our Supreme Rule on Earth. Beware, Europe! As you are next in our list!", "Europe has two great bases that separated one another. Destroy them both, and bring us to our glorious victory!", "This is the last EAF base, but like a parasite, they’re marching to Antioch to build their last stand there. This one should be a piece of cake!", "Antioch: the City of Old Saints, the place they built their greatest colony, their last stand. Our victory at here will be a beautiful end for them. However, we don't have extra resources to cover this operation. And they keep growing as time goes by. Defeat them as fast as you can, or else, in Antioch, they will defeat you!");
refreshPanel();
btinstructions.addEventListener(MouseEvent.MOUSE_UP, goInstructions, false, 0, true);
btresearch.addEventListener(MouseEvent.MOUSE_UP, goResearch, false, 0, true);
btplaylevel.addEventListener(MouseEvent.MOUSE_UP, goPlayGame, false, 0, true);
btbacktomenu.addEventListener(MouseEvent.MOUSE_UP, goMainMenu, false, 0, true);
btstatistics.addEventListener(MouseEvent.MOUSE_UP, goStatistics, false, 0, true);
btplaymore.addEventListener(MouseEvent.MOUSE_UP, goMoreGame, false, 0, true);
mc_select1.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote1, false, 0, true);
mc_select2.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote2, false, 0, true);
mc_select3.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote3, false, 0, true);
mc_select4.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote4, false, 0, true);
mc_select5.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote5, false, 0, true);
mc_select6.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote6, false, 0, true);
mc_select7.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote7, false, 0, true);
mc_select8.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote8, false, 0, true);
mc_select9.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote9, false, 0, true);
mc_select10.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote10, false, 0, true);
mc_select11.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote11, false, 0, true);
mc_select12.selectbtn1.addEventListener(MouseEvent.MOUSE_OVER, setNote12, false, 0, true);
mc_select1.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select2.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select3.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select4.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select5.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select6.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select7.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select8.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select9.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select10.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select11.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select12.selectbtn1.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select1.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel1, false, 0, true);
mc_select2.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel2, false, 0, true);
mc_select3.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel3, false, 0, true);
mc_select4.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel4, false, 0, true);
mc_select5.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel5, false, 0, true);
mc_select6.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel6, false, 0, true);
mc_select7.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel7, false, 0, true);
mc_select8.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel8, false, 0, true);
mc_select9.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel9, false, 0, true);
mc_select10.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel10, false, 0, true);
mc_select11.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel11, false, 0, true);
mc_select12.selectbtn1.addEventListener(MouseEvent.CLICK, setLevel12, false, 0, true);
mc_select1.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote1, false, 0, true);
mc_select2.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote2, false, 0, true);
mc_select3.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote3, false, 0, true);
mc_select4.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote4, false, 0, true);
mc_select5.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote5, false, 0, true);
mc_select6.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote6, false, 0, true);
mc_select7.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote7, false, 0, true);
mc_select8.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote8, false, 0, true);
mc_select9.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote9, false, 0, true);
mc_select10.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote10, false, 0, true);
mc_select11.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote11, false, 0, true);
mc_select12.selectbtn2.addEventListener(MouseEvent.MOUSE_OVER, setNote12, false, 0, true);
mc_select1.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select2.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select3.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select4.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select5.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select6.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select7.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select8.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select9.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select10.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select11.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select12.selectbtn2.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select1.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel1, false, 0, true);
mc_select2.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel2, false, 0, true);
mc_select3.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel3, false, 0, true);
mc_select4.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel4, false, 0, true);
mc_select5.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel5, false, 0, true);
mc_select6.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel6, false, 0, true);
mc_select7.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel7, false, 0, true);
mc_select8.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel8, false, 0, true);
mc_select9.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel9, false, 0, true);
mc_select10.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel10, false, 0, true);
mc_select11.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel11, false, 0, true);
mc_select12.selectbtn2.addEventListener(MouseEvent.CLICK, setLevel12, false, 0, true);
mc_select1.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote1, false, 0, true);
mc_select2.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote2, false, 0, true);
mc_select3.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote3, false, 0, true);
mc_select4.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote4, false, 0, true);
mc_select5.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote5, false, 0, true);
mc_select6.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote6, false, 0, true);
mc_select7.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote7, false, 0, true);
mc_select8.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote8, false, 0, true);
mc_select9.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote9, false, 0, true);
mc_select10.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote10, false, 0, true);
mc_select11.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote11, false, 0, true);
mc_select12.selectbtn3.addEventListener(MouseEvent.MOUSE_OVER, setNote12, false, 0, true);
mc_select1.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select2.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select3.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select4.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select5.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select6.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetRightNote, false, 0, true);
mc_select7.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select8.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select9.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select10.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select11.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select12.selectbtn3.addEventListener(MouseEvent.MOUSE_OUT, resetLeftNote, false, 0, true);
mc_select1.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel1, false, 0, true);
mc_select2.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel2, false, 0, true);
mc_select3.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel3, false, 0, true);
mc_select4.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel4, false, 0, true);
mc_select5.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel5, false, 0, true);
mc_select6.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel6, false, 0, true);
mc_select7.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel7, false, 0, true);
mc_select8.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel8, false, 0, true);
mc_select9.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel9, false, 0, true);
mc_select10.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel10, false, 0, true);
mc_select11.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel11, false, 0, true);
mc_select12.selectbtn3.addEventListener(MouseEvent.CLICK, setLevel12, false, 0, true);
}
public function setNote11(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[10];
s2 = levelLongNote[10];
mcinfoleft.showNote(mc_select11, s1, s2);
}
public function setNote12(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[11];
s2 = levelLongNote[11];
mcinfoleft.showNote(mc_select12, s1, s2);
}
public function goResearch(e=null){
thisparent.gotoAndPlay("researchpage");
}
public function setNote10(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[9];
s2 = levelLongNote[9];
mcinfoleft.showNote(mc_select10, s1, s2);
}
public function goInstructions(e=null){
thisparent.gotoAndPlay("instructionspage");
}
public function resetLeftNote(e=null){
mcinfoleft.hideNote();
}
public function setNote1(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[0];
s2 = levelLongNote[0];
mcinforight.showNote(mc_select1, s1, s2);
}
public function setNote2(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[1];
s2 = levelLongNote[1];
mcinforight.showNote(mc_select2, s1, s2);
}
public function setNote3(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[2];
s2 = levelLongNote[2];
mcinforight.showNote(mc_select3, s1, s2);
}
public function setNote6(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[5];
s2 = levelLongNote[5];
mcinforight.showNote(mc_select6, s1, s2);
}
public function setNote7(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[6];
s2 = levelLongNote[6];
mcinfoleft.showNote(mc_select7, s1, s2);
}
public function setNote8(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[7];
s2 = levelLongNote[7];
mcinfoleft.showNote(mc_select8, s1, s2);
}
public function setNote9(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[8];
s2 = levelLongNote[8];
mcinfoleft.showNote(mc_select9, s1, s2);
}
public function setNote4(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[3];
s2 = levelLongNote[3];
mcinforight.showNote(mc_select4, s1, s2);
}
public function setNote5(e=null){
var s1:*;
var s2:*;
s1 = levelShortNote[4];
s2 = levelLongNote[4];
mcinforight.showNote(mc_select5, s1, s2);
}
public function resetRightNote(e=null){
mcinforight.hideNote();
}
public function goMainMenu(e=null){
thisparent.gotoAndPlay("mainmenu");
}
public function setLevel10(e=null){
thisparent.gameData.selectedlevel = 10;
refreshPanel();
}
public function setLevel11(e=null){
thisparent.gameData.selectedlevel = 11;
refreshPanel();
}
public function setLevel12(e=null){
thisparent.gameData.selectedlevel = 12;
refreshPanel();
}
public function refreshPanel(){
special1.visible = thisparent.gameData.unlockedspecial[0];
special2.visible = thisparent.gameData.unlockedspecial[1];
special3.visible = thisparent.gameData.unlockedspecial[2];
special4.visible = thisparent.gameData.unlockedspecial[3];
if (thisparent.gameData.unlockedlevel[0]){
mc_select1.gotoAndStop(2);
if (thisparent.gameData.playedlevel[0]){
mc_select1.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 1){
mc_select1.gotoAndStop(3);
};
} else {
mc_select1.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[1]){
mc_select2.gotoAndStop(2);
if (thisparent.gameData.playedlevel[1]){
mc_select2.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 2){
mc_select2.gotoAndStop(3);
};
} else {
mc_select2.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[2]){
mc_select3.gotoAndStop(2);
if (thisparent.gameData.playedlevel[2]){
mc_select3.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 3){
mc_select3.gotoAndStop(3);
};
} else {
mc_select3.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[3]){
mc_select4.gotoAndStop(2);
if (thisparent.gameData.playedlevel[3]){
mc_select4.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 4){
mc_select4.gotoAndStop(3);
};
} else {
mc_select4.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[4]){
mc_select5.gotoAndStop(2);
if (thisparent.gameData.playedlevel[4]){
mc_select5.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 5){
mc_select5.gotoAndStop(3);
};
} else {
mc_select5.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[5]){
mc_select6.gotoAndStop(2);
if (thisparent.gameData.playedlevel[5]){
mc_select6.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 6){
mc_select6.gotoAndStop(3);
};
} else {
mc_select6.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[6]){
mc_select7.gotoAndStop(2);
if (thisparent.gameData.playedlevel[6]){
mc_select7.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 7){
mc_select7.gotoAndStop(3);
};
} else {
mc_select7.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[7]){
mc_select8.gotoAndStop(2);
if (thisparent.gameData.playedlevel[7]){
mc_select8.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 8){
mc_select8.gotoAndStop(3);
};
} else {
mc_select8.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[8]){
mc_select9.gotoAndStop(2);
if (thisparent.gameData.playedlevel[8]){
mc_select9.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 9){
mc_select9.gotoAndStop(3);
};
} else {
mc_select9.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[9]){
mc_select10.gotoAndStop(2);
if (thisparent.gameData.playedlevel[9]){
mc_select10.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 10){
mc_select10.gotoAndStop(3);
};
} else {
mc_select10.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[10]){
mc_select11.gotoAndStop(2);
if (thisparent.gameData.playedlevel[10]){
mc_select11.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 11){
mc_select11.gotoAndStop(3);
};
} else {
mc_select11.gotoAndStop(1);
};
if (thisparent.gameData.unlockedlevel[11]){
mc_select12.gotoAndStop(2);
if (thisparent.gameData.playedlevel[11]){
mc_select12.gotoAndStop(4);
};
if (thisparent.gameData.selectedlevel == 12){
mc_select12.gotoAndStop(3);
};
} else {
mc_select12.gotoAndStop(1);
};
leveltxt.text = levelShortNote[(thisparent.gameData.selectedlevel - 1)];
}
public function goMoreGame(e=null){
navigateToURL(new URLRequest(thisparent.moreGameURL), "_blank");
}
}
}//package number07_fla
Section 56
//mc_lostpage_152 (number07_fla.mc_lostpage_152)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_lostpage_152 extends MovieClip {
public var adsbox:MovieClip;
public var ad;
public var losttroopsscore:TextField;
public var createdtroopscount:TextField;
public var experience:TextField;
public var destroyedenemiescount:TextField;
public var kongbox:MovieClip;
public var leveltime:TextField;
public var losttroopscount:TextField;
public var usemochi;
public var gamewin;
public var destroyedenemiesscore:TextField;
public var thisparent;
public var CPMStarContentSpotID:String;
public var createdtroopsscore:TextField;
public var btcontinue:SimpleButton;
public function mc_lostpage_152(){
super();
addFrameScript(0, frame1, 65, frame66);
}
function frame1(){
kongbox.visible = false;
adsbox.visible = false;
}
public function goLevelSelect(e=null){
if (((((((((((((thisparent.gameData.research1Enabled()) || (thisparent.gameData.research2Enabled()))) || (thisparent.gameData.research3Enabled()))) || (thisparent.gameData.research4Enabled()))) || (thisparent.gameData.research5Enabled()))) || (thisparent.gameData.research6Enabled()))) || (thisparent.gameData.research7Enabled()))){
if (adsbox.visible){
if (ad){
adsbox.removeChild(ad);
};
};
thisparent.gotoAndPlay("researchpage");
} else {
thisparent.gotoAndPlay("levelselect");
};
}
public function checkSiteLock():Boolean{
var res:*;
res = false;
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("www.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("a.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("chat.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("bin") > -1)));
return (res);
}
public function gotoAds(e){
thisparent.gotoAdsGame();
}
function frame66(){
stop();
thisparent = parent;
ad = null;
usemochi = thisparent.usemochi;
CPMStarContentSpotID = "420Q1058780B";
if ((((Math.random() < 0.5)) || (checkSiteLock()))){
kongbox.visible = true;
kongbox.addEventListener(MouseEvent.MOUSE_UP, gotoAds, false, 0, true);
} else {
adsbox.visible = true;
if (usemochi){
MochiAd.showClickAwayAd({clip:adsbox, id:"48450a715b66ea35"});
} else {
ad = new AdLoader(CPMStarContentSpotID);
adsbox.addChild(ad);
};
};
gamewin = false;
destroyedenemiescount.text = thisparent.gameData.getDestroyedEnemiesCount();
destroyedenemiesscore.text = thisparent.gameData.getDestroyedEnemiesScore(gamewin);
createdtroopscount.text = thisparent.gameData.getCreatedTroopsCount();
createdtroopsscore.text = thisparent.gameData.getCreatedTroopsScore(gamewin);
losttroopscount.text = thisparent.gameData.getLostTroopsCount();
losttroopsscore.text = thisparent.gameData.getLostTroopsScore(gamewin);
leveltime.text = thisparent.gameData.getLevelTime();
experience.text = thisparent.gameData.getNewExperience(gamewin);
thisparent.gameData.setUnfinishedLevel();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
}
}
}//package number07_fla
Section 57
//mc_mainmenupage_106 (number07_fla.mc_mainmenupage_106)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_mainmenupage_106 extends MovieClip {
public var btnewgame:SimpleButton;
public var btcredits:SimpleButton;
public var bt_kongcover:SimpleButton;
public var thisparent;
public var btplaymore:SimpleButton;
public var btcontinue:SimpleButton;
public function mc_mainmenupage_106(){
super();
addFrameScript(0, frame1);
}
public function gotoSponsor(e){
thisparent.gotoMoreGame();
}
public function goContinueGame(e=null){
thisparent.gameData.loadData();
thisparent.gotoAndPlay("levelselect");
}
function frame1(){
stop();
thisparent = parent;
bt_kongcover.addEventListener(MouseEvent.MOUSE_UP, gotoSponsor, false, 0, true);
btcontinue.visible = thisparent.gameData.checkData();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goContinueGame, false, 0, true);
btnewgame.addEventListener(MouseEvent.MOUSE_UP, goNewGame, false, 0, true);
btplaymore.addEventListener(MouseEvent.MOUSE_UP, goPlayMore, false, 0, true);
btcredits.addEventListener(MouseEvent.MOUSE_UP, goCredits, false, 0, true);
}
public function goCredits(e=null){
thisparent.gotoAndPlay("creditspage");
}
public function goNewGame(e=null){
thisparent.gameData.resetData();
thisparent.gotoAndPlay("levelselect");
}
public function goPlayMore(e=null){
navigateToURL(new URLRequest(thisparent.moreGameURL), "_blank");
}
}
}//package number07_fla
Section 58
//mc_minimap_225 (number07_fla.mc_minimap_225)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_minimap_225 extends MovieClip {
public var btminimap:SimpleButton;
public var enemyunit;
public var playerbase;
public var stagescene;
public var enemybase;
public var enemytower;
public var playertower;
public var playerunit;
public var gamemgr;
public function mc_minimap_225(){
super();
addFrameScript(0, frame1, 9, frame10, 19, frame20);
}
function frame10(){
stop();
}
public function refreshMinimap(e=null){
var obj:*;
var i:*;
if (!playerbase){
playerbase = new mc_miniplayerbase();
};
if (!enemybase){
enemybase = new mc_minienemybase();
};
if (currentLabel == "shown"){
playerbase.x = (stagescene.playerBaseMC.x / 8);
playerbase.y = (stagescene.playerBaseMC.y / 8);
if (!contains(playerbase)){
addChild(playerbase);
};
enemybase.x = (stagescene.computerBaseMC.x / 8);
enemybase.y = (stagescene.computerBaseMC.y / 8);
if (!contains(enemybase)){
addChild(enemybase);
};
while (playerunit.length < stagescene.playerUnits.length) {
obj = new mc_playerunit();
addChild(obj);
playerunit.push(obj);
};
while (playerunit.length > stagescene.playerUnits.length) {
if (contains(playerunit[0])){
removeChild(playerunit[0]);
};
playerunit.splice(0, 1);
};
while (enemyunit.length < stagescene.computerUnits.length) {
obj = new mc_enemyunit();
addChild(obj);
enemyunit.push(obj);
};
while (enemyunit.length > stagescene.computerUnits.length) {
if (contains(enemyunit[0])){
removeChild(enemyunit[0]);
};
enemyunit.splice(0, 1);
};
while (playertower.length < stagescene.playerTowers.length) {
obj = new mc_playerunit();
addChild(obj);
playertower.push(obj);
};
while (playertower.length > stagescene.playerTowers.length) {
if (contains(playertower[0])){
removeChild(playertower[0]);
};
playertower.splice(0, 1);
};
while (enemytower.length < stagescene.computerTowers.length) {
obj = new mc_enemyunit();
addChild(obj);
enemytower.push(obj);
};
while (enemytower.length > stagescene.computerTowers.length) {
if (contains(enemytower[0])){
removeChild(enemytower[0]);
};
enemytower.splice(0, 1);
};
i = 0;
while (i < playerunit.length) {
playerunit[i].x = (stagescene.playerUnits[i].x / 8);
playerunit[i].y = (stagescene.playerUnits[i].y / 8);
i++;
};
i = 0;
while (i < enemyunit.length) {
enemyunit[i].x = (stagescene.computerUnits[i].x / 8);
enemyunit[i].y = (stagescene.computerUnits[i].y / 8);
i++;
};
i = 0;
while (i < playertower.length) {
playertower[i].x = (stagescene.playerTowers[i].x / 8);
playertower[i].y = (stagescene.playerTowers[i].y / 8);
i++;
};
i = 0;
while (i < enemytower.length) {
enemytower[i].x = (stagescene.computerTowers[i].x / 8);
enemytower[i].y = (stagescene.computerTowers[i].y / 8);
i++;
};
} else {
if (contains(playerbase)){
removeChild(playerbase);
};
if (contains(enemybase)){
removeChild(enemybase);
};
if (playerunit.length > 0){
i = 0;
while (i < playerunit.length) {
removeChild(playerunit[i]);
i++;
};
playerunit.splice(0);
};
if (enemyunit.length > 0){
i = 0;
while (i < enemyunit.length) {
removeChild(enemyunit[i]);
i++;
};
enemyunit.splice(0);
};
if (playertower.length > 0){
i = 0;
while (i < playertower.length) {
removeChild(playertower[i]);
i++;
};
playertower.splice(0);
};
if (enemytower.length > 0){
i = 0;
while (i < enemytower.length) {
removeChild(enemytower[i]);
i++;
};
enemytower.splice(0);
};
};
}
function frame1(){
stop();
gamemgr = parent.parent;
playerunit = new Array();
enemyunit = new Array();
playertower = new Array();
enemytower = new Array();
playerbase = new mc_miniplayerbase();
enemybase = new mc_minienemybase();
btminimap.addEventListener(MouseEvent.MOUSE_UP, toggleMinimap, false, 0, true);
addEventListener(Event.ENTER_FRAME, refreshMinimap, false, 0, true);
if (!stagescene){
stagescene = gamemgr.stageScene;
toggleMinimap();
};
}
function frame20(){
gotoAndStop(1);
}
public function toggleMinimap(e=null){
if (((!((currentLabel == "show"))) && (!((currentLabel == "shown"))))){
gotoAndPlay("show");
} else {
gotoAndPlay("hide");
};
}
}
}//package number07_fla
Section 59
//mc_playerbasehealthbar_172 (number07_fla.mc_playerbasehealthbar_172)
package number07_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mc_playerbasehealthbar_172 extends MovieClip {
public var txt:TextField;
public function mc_playerbasehealthbar_172(){
super();
}
}
}//package number07_fla
Section 60
//mc_preloaderpage_1 (number07_fla.mc_preloaderpage_1)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_preloaderpage_1 extends MovieClip {
public var ptxt:TextField;
public var loaderbar:MovieClip;
public var btn_sponsor:SimpleButton;
public var btn_alg:SimpleButton;
public var btstart:SimpleButton;
public var btn_ads:MovieClip;
public var animtxt:MovieClip;
public var thisparent;
public var bttxt:TextField;
public var bltxt:TextField;
public function mc_preloaderpage_1(){
super();
addFrameScript(0, frame1);
}
public function gotoAlg(e){
thisparent.gotoArtlogic();
}
public function frameEnter(e){
var bt:*;
var bl:*;
bt = parent.loaderInfo.bytesTotal;
bl = parent.loaderInfo.bytesLoaded;
if (bl < bt){
bltxt.text = String(bl);
bttxt.text = String(bt);
ptxt.text = (String(Math.floor(((bl / bt) * 100))) + "%");
loaderbar.gotoAndStop((Math.floor(((bl / bt) * 100)) + 1));
} else {
bltxt.text = String(bt);
bttxt.text = String(bt);
ptxt.text = "100%";
loaderbar.gotoAndStop(101);
removeEventListener(Event.ENTER_FRAME, frameEnter);
btstart.addEventListener(MouseEvent.MOUSE_UP, gotoIntro, false, 0, true);
animtxt.visible = false;
btstart.visible = true;
};
}
public function gotoSponsor(e){
thisparent.gotoMoreGame();
}
function frame1(){
stop();
thisparent = parent;
animtxt.visible = true;
btstart.visible = false;
loaderbar.gotoAndStop(1);
addEventListener(Event.ENTER_FRAME, frameEnter, false, 0, true);
btn_alg.addEventListener(MouseEvent.MOUSE_UP, gotoAlg, false, 0, true);
btn_sponsor.addEventListener(MouseEvent.MOUSE_UP, gotoSponsor, false, 0, true);
btn_ads.addEventListener(MouseEvent.MOUSE_UP, gotoAds, false, 0, true);
}
public function checkSiteLock():Boolean{
var res:*;
res = false;
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("www.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("a.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("chat.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("bin") > -1)));
return (res);
}
public function gotoAds(e){
thisparent.gotoKongaiGame();
}
public function gotoIntro(e=null){
thisparent.gotoAndPlay("intropage");
}
}
}//package number07_fla
Section 61
//mc_repair_28 (number07_fla.mc_repair_28)
package number07_fla {
import flash.display.*;
public dynamic class mc_repair_28 extends MovieClip {
public function mc_repair_28(){
super();
addFrameScript(0, frame1, 29, frame30);
}
function frame1(){
gotoAndStop(2);
}
function frame30(){
gotoAndPlay(3);
}
}
}//package number07_fla
Section 62
//mc_researchpage_132 (number07_fla.mc_researchpage_132)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_researchpage_132 extends MovieClip {
public var btupgrade6:MovieClip;
public var btupgrade5:MovieClip;
public var mcinfo:MovieClip;
public var experiencenote:TextField;
public var btfinish:SimpleButton;
public var kongbanner:MovieClip;
public var thisparent;
public var btupgrade2:MovieClip;
public var btupgrade3:MovieClip;
public var btupgrade7:MovieClip;
public var btupgrade1:MovieClip;
public var btupgrade4:MovieClip;
public function mc_researchpage_132(){
super();
addFrameScript(4, frame5, 8, frame9);
}
public function setPanels(){
experiencenote.text = ("Experience Point : " + Math.floor(thisparent.gameData.experience));
if (thisparent.gameData.research1Enabled()){
btupgrade1.gotoAndStop(2);
} else {
btupgrade1.gotoAndStop(1);
};
if (thisparent.gameData.research2Enabled()){
btupgrade2.gotoAndStop(2);
} else {
btupgrade2.gotoAndStop(1);
};
if (thisparent.gameData.research3Enabled()){
btupgrade3.gotoAndStop(2);
} else {
btupgrade3.gotoAndStop(1);
};
if (thisparent.gameData.research4Enabled()){
btupgrade4.gotoAndStop(2);
} else {
btupgrade4.gotoAndStop(1);
};
if (thisparent.gameData.research5Enabled()){
btupgrade5.gotoAndStop(2);
} else {
btupgrade5.gotoAndStop(1);
};
if (thisparent.gameData.research6Enabled()){
btupgrade6.gotoAndStop(2);
} else {
btupgrade6.gotoAndStop(1);
};
if (thisparent.gameData.research7Enabled()){
btupgrade7.gotoAndStop(2);
} else {
btupgrade7.gotoAndStop(1);
};
btupgrade1.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[0] + 1));
btupgrade2.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[1] + 1));
btupgrade3.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[2] + 1));
btupgrade4.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[3] + 1));
btupgrade5.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[4] + 1));
btupgrade6.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[5] + 1));
btupgrade7.upgradelevel.gotoAndStop((thisparent.gameData.researchlevel[6] + 1));
}
public function gotoSponsor(e){
thisparent.gotoMoreGame();
}
public function setUpgradeNote1(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research1Enabled()){
s1 = "Upgrade Mainbase Level\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[0] + 1))));
s1 = (s1 + ((("\nHealth : " + Math.floor(thisparent.gameData.playermainbasehealth)) + " -> ") + Math.floor((thisparent.gameData.playermainbasehealth * 2))));
s1 = (s1 + ((("\nAttack : " + Math.floor(thisparent.gameData.playermainbaseattack)) + " -> ") + Math.floor((thisparent.gameData.playermainbaseattack * 4))));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(1)) + " XP");
} else {
if (thisparent.gameData.researchlevel[0] == 3){
s1 = "Upgrade Mainbase Level";
s2 = "Maximum reached";
} else {
s1 = "Upgrade Mainbase Level";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(1)) + " XP needed");
};
};
mcinfo.showNote(btupgrade1, s1, s2);
}
public function setUpgradeNote4(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research4Enabled()){
s1 = "Reduce Units Create Time\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[3] + 1))));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(4)) + " XP");
} else {
if (thisparent.gameData.researchlevel[3] == 3){
s1 = "Reduce Units Create Time\n";
s2 = "Maximum reached";
} else {
s1 = "Reduce Units Create Time\n";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(4)) + " XP needed");
};
};
mcinfo.showNote(btupgrade4, s1, s2);
}
public function setUpgradeNote5(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research5Enabled()){
s1 = "Reduce Towers Create Time\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[4] + 1))));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(5)) + " XP");
} else {
if (thisparent.gameData.researchlevel[4] == 3){
s1 = "Reduce Towers Create Time\n";
s2 = "Maximum reached";
} else {
s1 = "Reduce Towers Create Time\n";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(5)) + " XP needed");
};
};
mcinfo.showNote(btupgrade5, s1, s2);
}
public function resetUpgradeNote(e){
mcinfo.hideNote();
}
public function setUpgradeNote3(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research3Enabled()){
s1 = "Upgrade Player Towers Level\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[2] + 1))));
s1 = (s1 + (("\nHealth : +" + (Math.floor((thisparent.gameData.researchlevel[2] + 1)) * 20)) + "%"));
s1 = (s1 + (("\nAttack : +" + (Math.floor((thisparent.gameData.researchlevel[2] + 1)) * 20)) + "%"));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(3)) + " XP");
} else {
if (thisparent.gameData.researchlevel[2] == 3){
s1 = "Upgrade Player Towers Level\n";
s2 = "Maximum reached";
} else {
s1 = "Upgrade Player Towers Level\n";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(3)) + " XP needed");
};
};
mcinfo.showNote(btupgrade3, s1, s2);
}
public function setUpgradeNote7(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research7Enabled()){
s1 = "Increase Enemy Kill Gold\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[6] + 1))));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(7)) + " XP");
} else {
if (thisparent.gameData.researchlevel[6] == 3){
s1 = "Increase Enemy Kill Gold\n";
s2 = "Maximum reached";
} else {
s1 = "Increase Enemy Kill Gold\n";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(7)) + " XP needed");
};
};
mcinfo.showNote(btupgrade7, s1, s2);
}
public function setUpgradeNote6(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research6Enabled()){
s1 = "Increase Gold Interest Rate\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[5] + 1))));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(6)) + " XP");
} else {
if (thisparent.gameData.researchlevel[5] == 3){
s1 = "Increase Gold Interest Rate\n";
s2 = "Maximum reached";
} else {
s1 = "Increase Gold Interest Rate\n";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(6)) + " XP needed");
};
};
mcinfo.showNote(btupgrade6, s1, s2);
}
function frame9(){
thisparent.gotoAndStop("levelselect");
}
public function setUpgradeNote2(e){
var s1:*;
var s2:*;
if (thisparent.gameData.research2Enabled()){
s1 = "Upgrade Player Units Level\n";
s1 = (s1 + ("\nCurrent Level : " + Math.floor((thisparent.gameData.researchlevel[1] + 1))));
s1 = (s1 + (("\nHealth : +" + (Math.floor((thisparent.gameData.researchlevel[1] + 1)) * 20)) + "%"));
s1 = (s1 + (("\nAttack : +" + (Math.floor((thisparent.gameData.researchlevel[1] + 1)) * 20)) + "%"));
s2 = (Math.floor(thisparent.gameData.getResearchPrice(2)) + " XP");
} else {
if (thisparent.gameData.researchlevel[1] == 3){
s1 = "Upgrade Player Units Level\n";
s2 = "Maximum reached";
} else {
s1 = "Upgrade Player Units Level\n";
s2 = (Math.floor(thisparent.gameData.getResearchPrice(2)) + " XP needed");
};
};
mcinfo.showNote(btupgrade2, s1, s2);
}
function frame5(){
stop();
thisparent = parent;
kongbanner.addEventListener(MouseEvent.MOUSE_UP, gotoSponsor, false, 0, true);
setPanels();
btfinish.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
btupgrade1.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote1, false, 0, true);
btupgrade2.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote2, false, 0, true);
btupgrade3.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote3, false, 0, true);
btupgrade4.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote4, false, 0, true);
btupgrade5.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote5, false, 0, true);
btupgrade6.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote6, false, 0, true);
btupgrade7.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote7, false, 0, true);
btupgrade1.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade2.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade3.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade4.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade5.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade6.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade7.addEventListener(MouseEvent.MOUSE_OUT, resetUpgradeNote, false, 0, true);
btupgrade1.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch1, false, 0, true);
btupgrade2.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch2, false, 0, true);
btupgrade3.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch3, false, 0, true);
btupgrade4.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch4, false, 0, true);
btupgrade5.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch5, false, 0, true);
btupgrade6.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch6, false, 0, true);
btupgrade7.upgradebtn1.addEventListener(MouseEvent.MOUSE_UP, doResearch7, false, 0, true);
}
public function goLevelSelect(e=null){
play();
}
public function doResearch2(e=null){
if (thisparent.gameData.research2Enabled()){
thisparent.gameData.doResearch2();
thisparent.gameData.saveData();
setPanels();
};
}
public function doResearch3(e=null){
if (thisparent.gameData.research3Enabled()){
thisparent.gameData.doResearch3();
thisparent.gameData.saveData();
setPanels();
};
}
public function doResearch5(e=null){
if (thisparent.gameData.research5Enabled()){
thisparent.gameData.doResearch5();
thisparent.gameData.saveData();
setPanels();
};
}
public function doResearch6(e=null){
if (thisparent.gameData.research6Enabled()){
thisparent.gameData.doResearch6();
thisparent.gameData.saveData();
setPanels();
};
}
public function doResearch7(e=null){
if (thisparent.gameData.research7Enabled()){
thisparent.gameData.doResearch7();
thisparent.gameData.saveData();
setPanels();
};
}
public function doResearch4(e=null){
if (thisparent.gameData.research4Enabled()){
thisparent.gameData.doResearch4();
thisparent.gameData.saveData();
setPanels();
};
}
public function doResearch1(e=null){
if (thisparent.gameData.research1Enabled()){
thisparent.gameData.doResearch1();
thisparent.gameData.saveData();
setPanels();
};
}
}
}//package number07_fla
Section 63
//mc_select_114 (number07_fla.mc_select_114)
package number07_fla {
import flash.display.*;
public dynamic class mc_select_114 extends MovieClip {
public var selectbtn1:SimpleButton;
public var selectbtn2:SimpleButton;
public var selectbtn3:SimpleButton;
public function mc_select_114(){
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
function frame3(){
stop();
selectbtn1.visible = false;
selectbtn2.visible = true;
selectbtn3.visible = false;
}
function frame4(){
stop();
selectbtn1.visible = false;
selectbtn2.visible = false;
selectbtn3.visible = true;
}
function frame1(){
stop();
selectbtn1.visible = false;
selectbtn2.visible = false;
selectbtn3.visible = false;
}
function frame2(){
stop();
selectbtn1.visible = true;
selectbtn2.visible = false;
selectbtn3.visible = false;
}
}
}//package number07_fla
Section 64
//mc_selectfiremode_217 (number07_fla.mc_selectfiremode_217)
package number07_fla {
import flash.events.*;
import flash.display.*;
public dynamic class mc_selectfiremode_217 extends MovieClip {
public var btautomatic:SimpleButton;
public var btsemiautomatic:SimpleButton;
public var btmanual:SimpleButton;
public var firemode;
public function mc_selectfiremode_217(){
super();
addFrameScript(0, frame1, 6, frame7, 11, frame12);
}
function frame12(){
gotoAndStop(2);
}
function frame7(){
stop();
btmanual.addEventListener(MouseEvent.MOUSE_UP, selectManual, false, 0, true);
btsemiautomatic.addEventListener(MouseEvent.MOUSE_UP, selectSemi, false, 0, true);
btautomatic.addEventListener(MouseEvent.MOUSE_UP, selectAuto, false, 0, true);
}
function frame1(){
firemode = "manual";
gotoAndStop(2);
}
public function selectSemi(e=null){
firemode = "semi";
gotoAndPlay("hide");
}
public function selectAuto(e=null){
firemode = "auto";
gotoAndPlay("hide");
}
public function selectManual(e=null){
firemode = "manual";
gotoAndPlay("hide");
}
}
}//package number07_fla
Section 65
//mc_statisticspage_154 (number07_fla.mc_statisticspage_154)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_statisticspage_154 extends MovieClip {
public var txt:TextField;
public var thisparent;
public var btcontinue:SimpleButton;
public function mc_statisticspage_154(){
super();
addFrameScript(0, frame1, 12, frame13, 22, frame23);
}
function frame1(){
thisparent = parent;
}
function frame13(){
stop();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
txt.text = thisparent.gameData.getStatistics();
}
function frame23(){
thisparent.gotoAndPlay("levelselect");
}
public function goLevelSelect(e=null){
gotoAndPlay("ca");
}
}
}//package number07_fla
Section 66
//mc_towercreatepanel_222 (number07_fla.mc_towercreatepanel_222)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_towercreatepanel_222 extends MovieClip {
public var newlytowers;
public var existtowers;
public var btcreatestart:SimpleButton;
public var capturenum;
public var mousepos;
public var btcreatecancel:SimpleButton;
public var capturestatus;
public var mctowercreate:mc_towercreate;
public function mc_towercreatepanel_222(){
super();
addFrameScript(0, frame1);
}
public function startCreate(e=null){
capturestatus = "finish";
mousepos.x = mctowercreate.x;
mousepos.y = mctowercreate.y;
stopCapture();
}
public function init(){
stopCapture();
}
public function cancelCreate(e=null){
capturestatus = "cancel";
mousepos.x = mctowercreate.x;
mousepos.y = mctowercreate.y;
stopCapture();
}
public function stopCapture(){
mctowercreate.gotoAndStop(2);
this.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
btcreatestart.removeEventListener(MouseEvent.MOUSE_UP, startCreate);
btcreatecancel.removeEventListener(MouseEvent.MOUSE_UP, cancelCreate);
btcreatestart.visible = false;
btcreatecancel.visible = false;
}
public function mouseMoveHandler(e=null){
if (checkNewPosition(new Point(e.stageX, e.stageY))){
mousepos.x = e.stageX;
mousepos.y = e.stageY;
};
mctowercreate.x = mousepos.x;
if (mctowercreate.x < 40){
mctowercreate.x = 40;
} else {
if (mctowercreate.x > 440){
mctowercreate.x = 440;
};
};
mctowercreate.y = mousepos.y;
if (mctowercreate.y < 180){
mctowercreate.y = 180;
} else {
if (mctowercreate.y > 440){
mctowercreate.y = 440;
};
};
}
public function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
function frame1(){
stop();
capturenum = 0;
capturestatus = "ready";
mousepos = new Point(240, 240);
existtowers = null;
newlytowers = null;
startCapture(capturenum);
}
public function startCapture(num=1, _et=null, _nt=null){
existtowers = _et;
newlytowers = _nt;
capturenum = num;
capturestatus = "ready";
btcreatestart.visible = true;
btcreatecancel.visible = true;
mousepos.x = 240;
mousepos.y = 240;
mctowercreate.gotoAndStop((num + 2));
mctowercreate.x = 240;
mctowercreate.y = 240;
this.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, false, 0, true);
btcreatestart.addEventListener(MouseEvent.MOUSE_UP, startCreate, false, 0, true);
btcreatecancel.addEventListener(MouseEvent.MOUSE_UP, cancelCreate, false, 0, true);
}
public function checkNewPosition(pt):Boolean{
var res:*;
var i:*;
res = true;
if (existtowers){
i = 0;
while (i < existtowers.length) {
res = ((res) && ((getDistance(pt, new Point((existtowers[i].x - 240), existtowers[i].y)) > 40)));
i++;
};
};
if (newlytowers){
i = 0;
while (i < newlytowers.length) {
res = ((res) && ((getDistance(pt, new Point((newlytowers[i].x - 240), newlytowers[i].y)) > 40)));
i++;
};
};
return (res);
}
}
}//package number07_fla
Section 67
//mc_ultimatewinpage_151 (number07_fla.mc_ultimatewinpage_151)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_ultimatewinpage_151 extends MovieClip {
public var adsbox:MovieClip;
public var ad;
public var totaltime:TextField;
public var losttroopsscore:TextField;
public var createdtroopscount:TextField;
public var experience:TextField;
public var totalexp:TextField;
public var destroyedenemiescount:TextField;
public var kongbox:MovieClip;
public var leveltime:TextField;
public var losttroopscount:TextField;
public var usemochi;
public var gamewin;
public var destroyedenemiesscore:TextField;
public var thisparent;
public var CPMStarContentSpotID:String;
public var createdtroopsscore:TextField;
public var btcontinue:SimpleButton;
public function mc_ultimatewinpage_151(){
super();
addFrameScript(0, frame1, 84, frame85);
}
function frame85(){
stop();
thisparent = parent;
ad = null;
usemochi = thisparent.usemochi;
CPMStarContentSpotID = "420Q1058780B";
if ((((Math.random() < 0.5)) || (checkSiteLock()))){
kongbox.visible = true;
kongbox.addEventListener(MouseEvent.MOUSE_UP, gotoAds, false, 0, true);
} else {
adsbox.visible = true;
if (usemochi){
MochiAd.showClickAwayAd({clip:adsbox, id:"48450a715b66ea35"});
} else {
ad = new AdLoader(CPMStarContentSpotID);
adsbox.addChild(ad);
};
};
gamewin = true;
destroyedenemiescount.text = thisparent.gameData.getDestroyedEnemiesCount();
destroyedenemiesscore.text = thisparent.gameData.getDestroyedEnemiesScore(gamewin);
createdtroopscount.text = thisparent.gameData.getCreatedTroopsCount();
createdtroopsscore.text = thisparent.gameData.getCreatedTroopsScore(gamewin);
losttroopscount.text = thisparent.gameData.getLostTroopsCount();
losttroopsscore.text = thisparent.gameData.getLostTroopsScore(gamewin);
leveltime.text = thisparent.gameData.getLevelTime();
totaltime.text = thisparent.gameData.getTotalTime();
totalexp.text = String(thisparent.gameData.getTotalExperience());
experience.text = thisparent.gameData.getNewExperience(gamewin);
thisparent.gameData.setFinishedLevel();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
}
function frame1(){
kongbox.visible = false;
adsbox.visible = false;
}
public function goLevelSelect(e=null){
thisparent.gotoAndPlay("levelselect");
}
public function checkSiteLock():Boolean{
var res:*;
res = false;
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("www.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("a.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("chat.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("bin") > -1)));
return (res);
}
public function gotoAds(e){
thisparent.gotoAdsGame();
}
}
}//package number07_fla
Section 68
//mc_unitsqueuer_215 (number07_fla.mc_unitsqueuer_215)
package number07_fla {
import flash.display.*;
public dynamic class mc_unitsqueuer_215 extends MovieClip {
public function mc_unitsqueuer_215(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 69
//mc_unlock1_124 (number07_fla.mc_unlock1_124)
package number07_fla {
import flash.events.*;
import flash.display.*;
public dynamic class mc_unlock1_124 extends MovieClip {
public function mc_unlock1_124(){
super();
addFrameScript(0, frame1, 9, frame10, 19, frame20);
}
function frame10(){
stop();
}
function frame1(){
stop();
addEventListener(MouseEvent.MOUSE_OVER, showContent, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, hideContent, false, 0, true);
}
function frame20(){
gotoAndStop(1);
}
public function showContent(e=null){
if (((!((currentLabel == "show"))) && (!((currentLabel == "shown"))))){
gotoAndPlay("show");
};
}
public function hideContent(e=null){
if (((!((currentLabel == "hide"))) && (!((currentLabel == "hidden"))))){
gotoAndPlay("hide");
};
}
}
}//package number07_fla
Section 70
//mc_unlock2_126 (number07_fla.mc_unlock2_126)
package number07_fla {
import flash.events.*;
import flash.display.*;
public dynamic class mc_unlock2_126 extends MovieClip {
public function mc_unlock2_126(){
super();
addFrameScript(0, frame1, 9, frame10, 19, frame20);
}
function frame10(){
stop();
}
function frame1(){
stop();
addEventListener(MouseEvent.MOUSE_OVER, showContent, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, hideContent, false, 0, true);
}
function frame20(){
gotoAndStop(1);
}
public function showContent(e=null){
if (((!((currentLabel == "show"))) && (!((currentLabel == "shown"))))){
gotoAndPlay("show");
};
}
public function hideContent(e=null){
if (((!((currentLabel == "hide"))) && (!((currentLabel == "hidden"))))){
gotoAndPlay("hide");
};
}
}
}//package number07_fla
Section 71
//mc_unlock3_125 (number07_fla.mc_unlock3_125)
package number07_fla {
import flash.events.*;
import flash.display.*;
public dynamic class mc_unlock3_125 extends MovieClip {
public function mc_unlock3_125(){
super();
addFrameScript(0, frame1, 9, frame10, 19, frame20);
}
function frame10(){
stop();
}
function frame1(){
stop();
addEventListener(MouseEvent.MOUSE_OVER, showContent, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, hideContent, false, 0, true);
}
function frame20(){
gotoAndStop(1);
}
public function showContent(e=null){
if (((!((currentLabel == "show"))) && (!((currentLabel == "shown"))))){
gotoAndPlay("show");
};
}
public function hideContent(e=null){
if (((!((currentLabel == "hide"))) && (!((currentLabel == "hidden"))))){
gotoAndPlay("hide");
};
}
}
}//package number07_fla
Section 72
//mc_unlock4_127 (number07_fla.mc_unlock4_127)
package number07_fla {
import flash.events.*;
import flash.display.*;
public dynamic class mc_unlock4_127 extends MovieClip {
public function mc_unlock4_127(){
super();
addFrameScript(0, frame1, 9, frame10, 19, frame20);
}
function frame10(){
stop();
}
function frame1(){
stop();
addEventListener(MouseEvent.MOUSE_OVER, showContent, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, hideContent, false, 0, true);
}
function frame20(){
gotoAndStop(1);
}
public function showContent(e=null){
if (((!((currentLabel == "show"))) && (!((currentLabel == "shown"))))){
gotoAndPlay("show");
};
}
public function hideContent(e=null){
if (((!((currentLabel == "hide"))) && (!((currentLabel == "hidden"))))){
gotoAndPlay("hide");
};
}
}
}//package number07_fla
Section 73
//mc_upgrade1_136 (number07_fla.mc_upgrade1_136)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade1_136 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade1_136(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 74
//mc_upgrade2_140 (number07_fla.mc_upgrade2_140)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade2_140 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade2_140(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 75
//mc_upgrade3_137 (number07_fla.mc_upgrade3_137)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade3_137 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade3_137(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 76
//mc_upgrade4_138 (number07_fla.mc_upgrade4_138)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade4_138 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade4_138(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 77
//mc_upgrade5_141 (number07_fla.mc_upgrade5_141)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade5_141 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade5_141(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 78
//mc_upgrade6_139 (number07_fla.mc_upgrade6_139)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade6_139 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade6_139(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 79
//mc_upgrade7_133 (number07_fla.mc_upgrade7_133)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgrade7_133 extends MovieClip {
public var upgradebtn1:SimpleButton;
public var upgradebtn2:SimpleButton;
public var upgradelevel:MovieClip;
public function mc_upgrade7_133(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
upgradebtn1.visible = false;
upgradebtn2.visible = true;
}
function frame2(){
stop();
upgradebtn1.visible = true;
upgradebtn2.visible = false;
}
}
}//package number07_fla
Section 80
//mc_upgradelevel_134 (number07_fla.mc_upgradelevel_134)
package number07_fla {
import flash.display.*;
public dynamic class mc_upgradelevel_134 extends MovieClip {
public function mc_upgradelevel_134(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 81
//mc_winpage_146 (number07_fla.mc_winpage_146)
package number07_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_winpage_146 extends MovieClip {
public var adsbox:MovieClip;
public var ad;
public var losttroopsscore:TextField;
public var createdtroopscount:TextField;
public var experience:TextField;
public var destroyedenemiescount:TextField;
public var kongbox:MovieClip;
public var leveltime:TextField;
public var losttroopscount:TextField;
public var usemochi;
public var gamewin;
public var destroyedenemiesscore:TextField;
public var thisparent;
public var CPMStarContentSpotID:String;
public var createdtroopsscore:TextField;
public var btcontinue:SimpleButton;
public function mc_winpage_146(){
super();
addFrameScript(0, frame1, 65, frame66);
}
function frame1(){
kongbox.visible = false;
adsbox.visible = false;
}
public function goLevelSelect(e=null){
if (((((((((((((thisparent.gameData.research1Enabled()) || (thisparent.gameData.research2Enabled()))) || (thisparent.gameData.research3Enabled()))) || (thisparent.gameData.research4Enabled()))) || (thisparent.gameData.research5Enabled()))) || (thisparent.gameData.research6Enabled()))) || (thisparent.gameData.research7Enabled()))){
if (adsbox.visible){
if (ad){
adsbox.removeChild(ad);
};
};
thisparent.gotoAndPlay("researchpage");
} else {
thisparent.gotoAndPlay("levelselect");
};
}
public function checkSiteLock():Boolean{
var res:*;
res = false;
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("www.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("a.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("chat.kongregate.com") > -1)));
res = ((res) || ((parent.loaderInfo.loaderURL.indexOf("bin") > -1)));
return (res);
}
public function gotoAds(e){
thisparent.gotoAdsGame();
}
function frame66(){
stop();
thisparent = parent;
ad = null;
usemochi = thisparent.usemochi;
CPMStarContentSpotID = "420Q1058780B";
if ((((Math.random() < 0.5)) || (checkSiteLock()))){
kongbox.visible = true;
kongbox.addEventListener(MouseEvent.MOUSE_UP, gotoAds, false, 0, true);
} else {
adsbox.visible = true;
if (usemochi){
MochiAd.showClickAwayAd({clip:adsbox, id:"48450a715b66ea35"});
} else {
ad = new AdLoader(CPMStarContentSpotID);
adsbox.addChild(ad);
};
};
gamewin = true;
destroyedenemiescount.text = thisparent.gameData.getDestroyedEnemiesCount();
destroyedenemiesscore.text = thisparent.gameData.getDestroyedEnemiesScore(gamewin);
createdtroopscount.text = thisparent.gameData.getCreatedTroopsCount();
createdtroopsscore.text = thisparent.gameData.getCreatedTroopsScore(gamewin);
losttroopscount.text = thisparent.gameData.getLostTroopsCount();
losttroopsscore.text = thisparent.gameData.getLostTroopsScore(gamewin);
leveltime.text = thisparent.gameData.getLevelTime();
experience.text = thisparent.gameData.getNewExperience(gamewin);
thisparent.gameData.setFinishedLevel();
btcontinue.addEventListener(MouseEvent.MOUSE_UP, goLevelSelect, false, 0, true);
}
}
}//package number07_fla
Section 82
//sceneloader_20 (number07_fla.sceneloader_20)
package number07_fla {
import flash.display.*;
public dynamic class sceneloader_20 extends MovieClip {
public function sceneloader_20(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 83
//soundloader_18 (number07_fla.soundloader_18)
package number07_fla {
import flash.display.*;
public dynamic class soundloader_18 extends MovieClip {
public function soundloader_18(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 84
//specialbtnsplash_174 (number07_fla.specialbtnsplash_174)
package number07_fla {
import flash.display.*;
public dynamic class specialbtnsplash_174 extends MovieClip {
public function specialbtnsplash_174(){
super();
addFrameScript(0, frame1, 1, frame2, 23, frame24);
}
public function blink(){
if (currentLabel != "showblink"){
gotoAndPlay("showblink");
};
}
function frame1(){
gotoAndPlay(2);
}
function frame24(){
gotoAndStop(2);
}
function frame2(){
stop();
}
}
}//package number07_fla
Section 85
//stageScroll_173 (number07_fla.stageScroll_173)
package number07_fla {
import flash.display.*;
public dynamic class stageScroll_173 extends MovieClip {
public function stageScroll_173(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 86
//unitloader_35 (number07_fla.unitloader_35)
package number07_fla {
import flash.display.*;
public dynamic class unitloader_35 extends MovieClip {
public function unitloader_35(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package number07_fla
Section 87
//AdLoader (AdLoader)
package {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.net.*;
public class AdLoader extends Sprite {
private var contentspotid:String;
private var cpmstarLoader:Loader;
public function AdLoader(contentspotid:String){
super();
this.contentspotid = contentspotid;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(event:Event):void{
var cpmstarViewSWFUrl:String;
var container:DisplayObjectContainer;
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
cpmstarViewSWFUrl = "http://server.cpmstar.com/adviewas3.swf";
container = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((cpmstarViewSWFUrl + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(event:Event):void{
dispatchEvent(event);
}
}
}//package
Section 88
//BaseSound (BaseSound)
package {
import flash.events.*;
import flash.media.*;
import flash.utils.*;
public class BaseSound extends Sound {
private var sndTransform:SoundTransform;
public var sndPlaying:Boolean;
private var sndFadeOut:Boolean;
private var sndFadeIn:Boolean;
private var sndPosTime:Number;
private var loop:Boolean;
private var sndObj:Sound;
private var sndChannel:SoundChannel;
private var sndTimer:Timer;
private var sndVolume:Number;
private var sndPan:Number;
public function BaseSound(){
super();
sndObj = this;
sndChannel = null;
sndTransform = null;
sndVolume = 1;
sndPan = 0;
sndPosTime = 0;
sndFadeIn = false;
sndFadeOut = false;
loop = false;
}
public function setVolume(vol:Number):void{
var sndTransform:SoundTransform;
sndVolume = vol;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.volume = sndVolume;
sndChannel.soundTransform = sndTransform;
};
}
public function stopSound():void{
if (sndChannel){
sndPlaying = false;
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_loop);
loop = false;
};
}
public function fadeOut(init:Boolean):void{
sndFadeOut = true;
sndFadeIn = false;
if (init){
setVolume(1);
};
if (!sndTimer){
sndTimer = new Timer(50);
sndTimer.addEventListener(TimerEvent.TIMER, sndTimerHandler, false, 0, true);
sndTimer.start();
};
}
public function pauseSound():void{
if (sndChannel){
sndPlaying = false;
sndPosTime = sndChannel.position;
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_loop);
};
}
public function playSound():void{
stopSound();
sndChannel = sndObj.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_complete, false, 0, true);
setVolume(sndVolume);
setPan(sndPan);
sndPlaying = true;
}
public function fadeIn(init:Boolean):void{
sndFadeIn = true;
sndFadeOut = false;
if (init){
setVolume(0);
};
if (!sndTimer){
sndTimer = new Timer(50);
sndTimer.addEventListener(TimerEvent.TIMER, sndTimerHandler, false, 0, true);
sndTimer.start();
};
}
private function sndTimerHandler(event:TimerEvent):void{
if (((sndFadeIn) && (sndFadeOut))){
sndFadeIn = false;
sndFadeOut = false;
setVolume(1);
};
if (sndFadeIn){
sndVolume = (sndVolume + 0.01);
if (sndVolume > 1){
setVolume(1);
sndFadeIn = false;
} else {
setVolume(sndVolume);
};
};
if (sndFadeOut){
sndVolume = (sndVolume - 0.01);
if (sndVolume < 0){
setVolume(0);
sndFadeOut = false;
} else {
setVolume(sndVolume);
};
};
}
public function setPan(pan:Number):void{
var sndTransform:SoundTransform;
sndPan = pan;
if (sndChannel){
sndTransform = sndChannel.soundTransform;
sndTransform.pan = sndPan;
sndChannel.soundTransform = sndTransform;
};
}
public function resumeSound():void{
stopSound();
sndChannel = sndObj.play(sndPosTime);
if (loop){
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop, false, 0, true);
};
setVolume(sndVolume);
setPan(sndPan);
sndPlaying = true;
}
private function sound_complete(event:Event){
sndChannel.removeEventListener(Event.SOUND_COMPLETE, sound_complete);
sndPlaying = false;
}
private function sound_loop(event:Event){
sndChannel = sndObj.play();
setVolume(sndVolume);
setPan(sndPan);
sndPlaying = true;
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop, false, 0, true);
}
public function playSoundLoop():void{
stopSound();
sndChannel = sndObj.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, sound_loop, false, 0, true);
setVolume(sndVolume);
setPan(sndPan);
sndPlaying = true;
loop = true;
}
}
}//package
Section 89
//bgm_ambient (bgm_ambient)
package {
public dynamic class bgm_ambient extends BaseSound {
public function bgm_ambient(){
super();
}
}
}//package
Section 90
//bgm_cover (bgm_cover)
package {
public dynamic class bgm_cover extends BaseSound {
public function bgm_cover(){
super();
}
}
}//package
Section 91
//bgm_hightension (bgm_hightension)
package {
public dynamic class bgm_hightension extends BaseSound {
public function bgm_hightension(){
super();
}
}
}//package
Section 92
//bgm_lowtension (bgm_lowtension)
package {
public dynamic class bgm_lowtension extends BaseSound {
public function bgm_lowtension(){
super();
}
}
}//package
Section 93
//BulletObjectBase (BulletObjectBase)
package {
import flash.display.*;
public class BulletObjectBase extends MovieClip {
private var speedy;
private var speedx;
private var speed;
public var typed;// = "gunbullet"
public var damage;// = 1
public var target;// = null
private var rnd;
public var owned;// = null
public function BulletObjectBase(){
typed = "gunbullet";
damage = 1;
owned = null;
target = null;
super();
}
public function init(_type, _dmg, _own, _tgt=null){
rnd = ((Math.random() * speed) / 20);
typed = _type;
damage = _dmg;
owned = _own;
target = _tgt;
switch (_type){
case "shipgunbullet":
speed = 20;
break;
case "plasmabullet":
speed = 7;
break;
case "missilebullet":
speed = 3;
break;
case "dropbombbullet":
speed = 1;
break;
case "gunbullet":
default:
speed = 10;
break;
};
speedx = (speed * Math.cos(((this.rotation / 180) * Math.PI)));
speedy = (speed * Math.sin(((this.rotation / 180) * Math.PI)));
this.cacheAsBitmap = true;
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
public function moveClip(){
var lastx:*;
var lasty:*;
var ang:*;
var ang2:*;
var angdif:*;
switch (typed){
case "dropbombbullet":
if (this.rotation < 85){
this.rotation = (this.rotation + 5);
} else {
if (this.rotation > 95){
this.rotation = (this.rotation - 5);
};
};
this.x = (this.x + (speed * Math.cos(((this.rotation * Math.PI) / 180))));
this.y = (this.y + (speed * Math.sin(((this.rotation * Math.PI) / 180))));
speed = (speed * 1.05);
if (target){
if (this.y > (target + 20)){
this.gotoAndPlay("destroyed");
target.reduceHealth2(damage);
};
} else {
if (this.y > 930){
this.gotoAndPlay("destroyed");
};
};
break;
case "missilebullet":
ang = (180 - getAngle(this, target));
if (ang < 0){
ang = (ang + 360);
} else {
if (ang > 360){
ang = (ang - 360);
};
};
ang2 = this.rotation;
if (ang2 < 0){
ang2 = (ang2 + 360);
} else {
if (ang2 > 360){
ang2 = (ang2 - 360);
};
};
angdif = Math.abs((ang2 - ang));
if (angdif > 5){
if (ang2 < ang){
if (angdif < 180){
this.rotation = (this.rotation + 5);
} else {
this.rotation = (this.rotation - 5);
};
} else {
if (angdif < 180){
this.rotation = (this.rotation - 5);
} else {
this.rotation = (this.rotation + 5);
};
};
};
this.x = (this.x + (speed * Math.cos(((this.rotation * Math.PI) / 180))));
this.y = (this.y + (speed * Math.sin(((this.rotation * Math.PI) / 180))));
speed = (speed * 1.05);
break;
case "plasmabullet":
this.rotation = (this.rotation + 20);
if (this.alpha > 0.025){
this.alpha = (this.alpha - 0.025);
} else {
this.alpha = 0;
};
this.x = (this.x + speedx);
this.y = (this.y + speedy);
break;
case "gunbullet":
default:
this.x = (this.x + speedx);
this.y = (this.y + speedy);
break;
};
}
}
}//package
Section 94
//ColorMatrix (ColorMatrix)
package {
public dynamic class ColorMatrix extends Array {
private static const IDENTITY_MATRIX:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
private static const LENGTH:Number = IDENTITY_MATRIX.length;
private static const DELTA_INDEX:Array = [0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11, 0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.2, 0.21, 0.22, 0.24, 0.25, 0.27, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, 0.71, 0.74, 0.77, 0.8, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98, 1, 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2, 2.12, 2.25, 2.37, 2.5, 2.62, 2.75, 2.87, 3, 3.2, 3.4, 3.6, 3.8, 4, 4.3, 4.7, 4.9, 5, 5.5, 6, 6.5, 6.8, 7, 7.3, 7.5, 7.8, 8, 8.4, 8.7, 9, 9.4, 9.6, 9.8, 10];
public function ColorMatrix(p_matrix:Array=null){
super();
p_matrix = fixMatrix(p_matrix);
copyMatrix(((p_matrix.length)==LENGTH) ? p_matrix : IDENTITY_MATRIX);
}
public function adjustBrightness(p_val:Number):void{
p_val = cleanValue(p_val, 100);
if ((((p_val == 0)) || (isNaN(p_val)))){
return;
};
multiplyMatrix([1, 0, 0, 0, p_val, 0, 1, 0, 0, p_val, 0, 0, 1, 0, p_val, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
protected function multiplyMatrix(p_matrix:Array):void{
var col:Array;
var i:uint;
var j:uint;
var val:Number;
var k:Number;
col = [];
i = 0;
while (i < 5) {
j = 0;
while (j < 5) {
col[j] = this[(j + (i * 5))];
j++;
};
j = 0;
while (j < 5) {
val = 0;
k = 0;
while (k < 5) {
val = (val + (p_matrix[(j + (k * 5))] * col[k]));
k++;
};
this[(j + (i * 5))] = val;
j++;
};
i++;
};
}
public function adjustSaturation(p_val:Number):void{
var x:Number;
var lumR:Number;
var lumG:Number;
var lumB:Number;
p_val = cleanValue(p_val, 100);
if ((((p_val == 0)) || (isNaN(p_val)))){
return;
};
x = (1 + ((p_val)>0) ? ((3 * p_val) / 100) : (p_val / 100));
lumR = 0.3086;
lumG = 0.6094;
lumB = 0.082;
multiplyMatrix([((lumR * (1 - x)) + x), (lumG * (1 - x)), (lumB * (1 - x)), 0, 0, (lumR * (1 - x)), ((lumG * (1 - x)) + x), (lumB * (1 - x)), 0, 0, (lumR * (1 - x)), (lumG * (1 - x)), ((lumB * (1 - x)) + x), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function reset():void{
var i:uint;
i = 0;
while (i < LENGTH) {
this[i] = IDENTITY_MATRIX[i];
i++;
};
}
public function adjustColor(p_brightness:Number, p_contrast:Number, p_saturation:Number, p_hue:Number):void{
adjustHue(p_hue);
adjustContrast(p_contrast);
adjustBrightness(p_brightness);
adjustSaturation(p_saturation);
}
public function clone():ColorMatrix{
return (new ColorMatrix(this));
}
public function toArray():Array{
return (slice(0, 20));
}
protected function cleanValue(p_val:Number, p_limit:Number):Number{
return (Math.min(p_limit, Math.max(-(p_limit), p_val)));
}
public function adjustHue(p_val:Number):void{
var cosVal:Number;
var sinVal:Number;
var lumR:Number;
var lumG:Number;
var lumB:Number;
p_val = ((cleanValue(p_val, 180) / 180) * Math.PI);
if ((((p_val == 0)) || (isNaN(p_val)))){
return;
};
cosVal = Math.cos(p_val);
sinVal = Math.sin(p_val);
lumR = 0.213;
lumG = 0.715;
lumB = 0.072;
multiplyMatrix([((lumR + (cosVal * (1 - lumR))) + (sinVal * -(lumR))), ((lumG + (cosVal * -(lumG))) + (sinVal * -(lumG))), ((lumB + (cosVal * -(lumB))) + (sinVal * (1 - lumB))), 0, 0, ((lumR + (cosVal * -(lumR))) + (sinVal * 0.143)), ((lumG + (cosVal * (1 - lumG))) + (sinVal * 0.14)), ((lumB + (cosVal * -(lumB))) + (sinVal * -0.283)), 0, 0, ((lumR + (cosVal * -(lumR))) + (sinVal * -((1 - lumR)))), ((lumG + (cosVal * -(lumG))) + (sinVal * lumG)), ((lumB + (cosVal * (1 - lumB))) + (sinVal * lumB)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function concat(p_matrix:Array):void{
p_matrix = fixMatrix(p_matrix);
if (p_matrix.length != LENGTH){
return;
};
multiplyMatrix(p_matrix);
}
protected function copyMatrix(p_matrix:Array):void{
var l:Number;
var i:uint;
l = LENGTH;
i = 0;
while (i < l) {
this[i] = p_matrix[i];
i++;
};
}
protected function fixMatrix(p_matrix:Array=null):Array{
if (p_matrix == null){
return (IDENTITY_MATRIX);
};
if ((p_matrix is ColorMatrix)){
p_matrix = p_matrix.slice(0);
};
if (p_matrix.length < LENGTH){
p_matrix = p_matrix.slice(0, p_matrix.length).concat(IDENTITY_MATRIX.slice(p_matrix.length, LENGTH));
} else {
if (p_matrix.length > LENGTH){
p_matrix = p_matrix.slice(0, LENGTH);
};
};
return (p_matrix);
}
public function adjustContrast(p_val:Number):void{
var x:Number;
p_val = cleanValue(p_val, 100);
if ((((p_val == 0)) || (isNaN(p_val)))){
return;
};
if (p_val < 0){
x = (127 + ((p_val / 100) * 127));
} else {
x = (p_val % 1);
if (x == 0){
x = DELTA_INDEX[p_val];
} else {
x = ((DELTA_INDEX[(p_val << 0)] * (1 - x)) + (DELTA_INDEX[((p_val << 0) + 1)] * x));
};
x = ((x * 127) + 127);
};
multiplyMatrix([(x / 127), 0, 0, 0, (0.5 * (127 - x)), 0, (x / 127), 0, 0, (0.5 * (127 - x)), 0, 0, (x / 127), 0, (0.5 * (127 - x)), 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function toString():String{
return ((("ColorMatrix [ " + this.join(" , ")) + " ]"));
}
}
}//package
Section 95
//computerbase_mc (computerbase_mc)
package {
public dynamic class computerbase_mc extends LandBaseObjectBase {
public function computerbase_mc(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 96
//ComputerManager (ComputerManager)
package {
import flash.geom.*;
public class ComputerManager {
private var towertype;
private var towertimermax;// = 0
private var timermultiplier;// = 1
private var startcounting;
private var unittimer;
private var towertimer;// = 0
private var towerpos;
private var stageScene;
private var maintimer;// = 0
private var myParent;
private var gameData;
public function ComputerManager(_myParent){
var i:*;
towertimer = 0;
towertimermax = 0;
maintimer = 0;
unittimer = new Array(0, 0, 0, 0, 0, 0, 0);
startcounting = new Array(false, false, false, false, false, false, false);
timermultiplier = 1;
super();
myParent = _myParent;
gameData = myParent.gameData;
stageScene = myParent.stageScene;
i = 0;
while (i < gameData.computerunitcreatetimer.length) {
unittimer[i] = gameData.computerunitcreatetimer[i];
i++;
};
}
private function getNewTowerPosition():Point{
var pt:*;
var j:*;
var i:*;
var newposfound:*;
var res:*;
pt = new Point(0, 0);
i = 0;
newposfound = false;
while (((!(newposfound)) && ((i < 4)))) {
pt.x = gameData.defaultcomputertowerx[i];
pt.y = gameData.defaultcomputertowery[i];
res = true;
if (stageScene.computerTowers.length > 0){
j = 0;
while (j < stageScene.computerTowers.length) {
res = ((res) && ((getDistance(new Point((stageScene.computerTowers[j].x - stageScene.computerBaseMC.x), (stageScene.computerTowers[j].y - stageScene.computerBaseMC.y)), pt) > 20)));
j++;
};
};
if (stageScene.computerCreateTowerPos.length > 0){
j = 0;
while (j < stageScene.computerCreateTowerPos.length) {
res = ((res) && ((getDistance(stageScene.computerCreateTowerPos[j], pt) > 20)));
j++;
};
};
newposfound = res;
i++;
};
if (!newposfound){
pt = null;
};
return (pt);
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
public function moveClip(){
var i:*;
maintimer++;
if (stageScene.computerUnits.length < 15){
if (gameData.selectedlevel < 4){
timermultiplier = 1;
} else {
if (gameData.selectedlevel < 8){
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 8)){
timermultiplier = 0.3;
} else {
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 4)){
timermultiplier = 0.4;
} else {
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 2)){
timermultiplier = 0.5;
} else {
timermultiplier = 1;
};
};
};
} else {
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 16)){
timermultiplier = 0.1;
} else {
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 8)){
timermultiplier = 0.2;
} else {
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 4)){
timermultiplier = 0.3;
} else {
if (stageScene.playerUnits.length > (stageScene.computerUnits.length * 2)){
timermultiplier = 0.4;
} else {
if (stageScene.playerUnits.length > stageScene.computerUnits.length){
timermultiplier = 0.5;
} else {
timermultiplier = 1;
};
};
};
};
};
if (gameData.gold > 50000){
timermultiplier = (timermultiplier * 0.1);
};
if (gameData.gold > 25000){
timermultiplier = (timermultiplier * 0.2);
} else {
if (gameData.gold > 20000){
timermultiplier = (timermultiplier * 0.3);
} else {
if (gameData.gold > 15000){
timermultiplier = (timermultiplier * 0.4);
} else {
if (gameData.gold > 10000){
timermultiplier = (timermultiplier * 0.5);
} else {
if (gameData.gold > 5000){
timermultiplier = (timermultiplier * 0.6);
} else {
if (gameData.gold > 4000){
timermultiplier = (timermultiplier * 0.7);
} else {
if (gameData.gold > 3000){
timermultiplier = (timermultiplier * 0.8);
} else {
if (gameData.gold > 2000){
timermultiplier = (timermultiplier * 0.9);
} else {
timermultiplier = (timermultiplier * 1);
};
};
};
};
};
};
};
};
};
};
i = 0;
while (i < unittimer.length) {
if (startcounting[i]){
var _local2 = unittimer;
var _local3 = i;
var _local4 = (_local2[_local3] - 1);
_local2[_local3] = _local4;
} else {
startcounting[i] = (maintimer > gameData.computerunitstarttimer[i]);
};
if ((((unittimer[i] <= 0)) && (gameData.unlockedcomputerunit[i]))){
unittimer[i] = Math.floor((gameData.computerunitcreatetimer[i] * timermultiplier));
stageScene.createCharacter(gameData.computerunitname[i], "computer");
};
i++;
};
};
if ((stageScene.computerCreateTowerType.length + stageScene.computerTowers.length) < gameData.defaultcomputertowercount){
if (towertimer == 0){
towerpos = getNewTowerPosition();
i = Math.floor((((Math.random() * gameData.selectedlevel) / 4) + 1));
switch (i){
case 2:
towertype = 2;
break;
case 3:
towertype = 3;
break;
case 4:
towertype = 4;
break;
case 1:
default:
towertype = 1;
break;
};
towertimermax = gameData.computertowercreatetimer[(i - 1)];
if (stageScene.computerTowers.length > 0){
towertimer = (towertimermax * gameData.computertowercreateinterval);
} else {
towertimer = 300;
};
} else {
towertimer--;
if (towertimer == 0){
if (towerpos){
stageScene.createComputerTower(towertype, towerpos, towertimermax);
};
};
};
};
}
public function doCounter(_full=true){
if (_full){
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[6]){
stageScene.createCharacter(gameData.computerunitname[6], "computer");
if (gameData.selectedlevel > 9){
stageScene.createCharacter(gameData.computerunitname[6], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[5]){
stageScene.createCharacter(gameData.computerunitname[5], "computer");
if (gameData.selectedlevel > 6){
stageScene.createCharacter(gameData.computerunitname[5], "computer");
};
if (gameData.selectedlevel > 8){
stageScene.createCharacter(gameData.computerunitname[5], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[4]){
stageScene.createCharacter(gameData.computerunitname[4], "computer");
if (gameData.selectedlevel > 5){
stageScene.createCharacter(gameData.computerunitname[4], "computer");
};
if (gameData.selectedlevel > 7){
stageScene.createCharacter(gameData.computerunitname[4], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[3]){
stageScene.createCharacter(gameData.computerunitname[3], "computer");
if (gameData.selectedlevel > 4){
stageScene.createCharacter(gameData.computerunitname[3], "computer");
};
if (gameData.selectedlevel > 6){
stageScene.createCharacter(gameData.computerunitname[3], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[2]){
stageScene.createCharacter(gameData.computerunitname[2], "computer");
if (gameData.selectedlevel > 3){
stageScene.createCharacter(gameData.computerunitname[2], "computer");
};
if (gameData.selectedlevel > 5){
stageScene.createCharacter(gameData.computerunitname[2], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[1]){
stageScene.createCharacter(gameData.computerunitname[1], "computer");
if (gameData.selectedlevel > 2){
stageScene.createCharacter(gameData.computerunitname[1], "computer");
};
if (gameData.selectedlevel > 4){
stageScene.createCharacter(gameData.computerunitname[1], "computer");
};
};
};
if (gameData.unlockedcomputerunit[0]){
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
};
} else {
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[3]){
stageScene.createCharacter(gameData.computerunitname[3], "computer");
if (gameData.selectedlevel > 6){
stageScene.createCharacter(gameData.computerunitname[3], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[2]){
stageScene.createCharacter(gameData.computerunitname[2], "computer");
if (gameData.selectedlevel > 5){
stageScene.createCharacter(gameData.computerunitname[2], "computer");
};
};
};
if (stageScene.computerUnits.length < 10){
if (gameData.unlockedcomputerunit[1]){
stageScene.createCharacter(gameData.computerunitname[1], "computer");
if (gameData.selectedlevel > 4){
stageScene.createCharacter(gameData.computerunitname[1], "computer");
};
};
};
if (gameData.unlockedcomputerunit[0]){
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
stageScene.createCharacter(gameData.computerunitname[0], "computer");
};
};
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
}
}//package
Section 97
//ControlManager (ControlManager)
package {
import flash.events.*;
import flash.ui.*;
public class ControlManager {
private var myParent;
public function ControlManager(_myParent){
super();
myParent = _myParent;
}
private function mouseDownHandler(e){
myParent.mousePress = true;
}
public function startListeners(){
myParent.myParent.stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, false, 0, true);
myParent.myParent.stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler, false, 0, true);
myParent.myParent.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, false, 0, true);
myParent.myParent.stage.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler, false, 0, true);
myParent.stageBackground.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);
myParent.stageBackground.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, false, 0, true);
}
private function keyDownHandler(e){
if (myParent.gameStatus == "playing"){
switch (e.keyCode){
case Keyboard.UP:
myParent.startScrollingUp();
break;
case Keyboard.DOWN:
myParent.startScrollingDown();
break;
case 90:
myParent.startZoomOut();
break;
};
};
}
private function mouseUpHandler(e){
myParent.mousePress = false;
}
private function keyUpHandler(e){
if (myParent.gameStatus == "playing"){
switch (e.keyCode){
case 80:
myParent.pauseClip();
break;
case 49:
myParent.queueUnit1();
break;
case 50:
myParent.queueUnit2();
break;
case 51:
myParent.queueUnit3();
break;
case 52:
myParent.queueUnit4();
break;
case 53:
myParent.queueUnit5();
break;
case 54:
myParent.queueUnit6();
break;
case 55:
myParent.queueUnit7();
break;
case 81:
myParent.getTowerPosition1();
break;
case 87:
myParent.getTowerPosition2();
break;
case 69:
myParent.getTowerPosition3();
break;
case 82:
myParent.getTowerPosition4();
break;
case 84:
myParent.getTowerPosition5();
break;
case 65:
myParent.doUpgrade1();
break;
case 83:
myParent.doUpgrade2();
break;
case 68:
myParent.doUpgrade3();
break;
case 70:
myParent.doUpgrade4();
break;
case 71:
myParent.doUpgrade5();
break;
case Keyboard.ESCAPE:
myParent.cancelNewTowerPos();
break;
case Keyboard.UP:
myParent.stopScrollingUp();
break;
case Keyboard.DOWN:
myParent.stopScrollingDown();
break;
case 90:
myParent.stopZoomOut();
break;
case 77:
myParent.showMap();
break;
};
} else {
if (myParent.gameStatus == "paused"){
switch (e.keyCode){
case Keyboard.ESCAPE:
case 80:
myParent.continueClip();
};
};
};
}
private function mouseMoveHandler(e){
myParent.mouseStageX = e.stageX;
myParent.mouseStageY = e.stageY;
}
public function pauseListeners(){
myParent.myParent.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
myParent.myParent.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
myParent.stageScene.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
myParent.stageScene.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
private function mouseWheelHandler(e){
if (e.delta > 0){
myParent.mouseScrollUp = true;
} else {
if (e.delta < 0){
myParent.mouseScrollDown = true;
};
};
}
public function stopListeners(){
myParent.myParent.stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
myParent.myParent.stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
myParent.myParent.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
myParent.myParent.stage.removeEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler);
myParent.stageScene.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
myParent.stageScene.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
}
}//package
Section 98
//DataManager (DataManager)
package {
import com.kongregate.as3.client.events.*;
import com.kongregate.as3.client.*;
import flash.net.*;
public class DataManager {
public var playertowercreatetimer;
public var unlockedplayertower;
public var initplayertowerattack;
public var playerupgradeprice;
public var computertowercreateinterval;// = 8
public var scenariocomputerunitstarttimer;
public var initplayertowerhealth;
public var playermainbasehealth;
public var initunlockedplayerunit;
public var completedlevel;// = 0
public var towerresearchtimer;
private var GAME_COMPLETED;// = 0
public var unitresearchattack;
public var computerunitname;
public var defaultcomputertower;
public var computerunitattack;
public var initcomputerunitcreatetimer;
public var unitresearchhealth;
public var scenariocomputermainbaseattack;
public var computerunithealth;
public var scenariocomputermainbasehealth;
public var computertowercreatetimer;
public var computertowername;
public var scenariodefaultcomputertowery;
public var gold;
public var scenariodefaultcomputertowerx;
public var playerunitattack;
public var scenariounlockedplayertower;
public var computerunitstarttimer;
public var playerunitprice;
public var unlockedspecial;
public var unlockedlevel;
public var playerunithealth;
public var playedlevel;
public var initunlockedcomputerunit;
public var scenariounlockedplayerunit;
public var gamewincount;// = 0
public var unitlost;
public var computertowerhealth;
public var computertowerattack;
public var baseresearchattack;
public var killgoldresearchvalue;
public var gamelostcount;// = 0
public var computermainbaseattack;
public var computermainbasehealth;
public var playerunitcreatetimer;
public var baseresearchhealth;
public var researchlevel;
public var thisparent;// = null
private var BEST_EXP_EARN;// = 0
public var totalduration;// = 0
public var initdefaultcomputertowerx;
public var initdefaultcomputertowery;
public var unitkilledtotal;
public var unitcreated;
private var BEST_HIGHEST_LEVEL;// = 0
public var unitcreatedtotal;
public var upgradelevel;
public var towerresearchattack;
public var initunlockedplayertower;
private var kongregateServiceLoaded:Boolean;// = false
public var towerresearchhealth;
public var unitkilled;
public var initplayermainbaseattack;// = 1
public var playertowerattack;
public var initplayertowercreatetimer;
public var scenariounlockedcomputerunit;
public var initplayermainbasehealth;// = 1000
public var levelduration;// = 0
private var BEST_ENEMY_KILL;// = 0
public var unlockedplayerunit;
public var interest;
public var defaultcomputertowercount;
public var levelstarttime;// = 0
public var playertowerhealth;
public var initcomputerunitattack;
public var computertowerprice;
public var initdefaultcomputertower;
public var initcomputerunithealth;
public var playerresearchprice;
private var BEST_UNITS_LOST;// = 0
public var computerunitcreatetimer;
public var initcomputertowercreatetimer;
public var playertowername;
public var levelstoptime;// = 0
public var initunlockedspecial;
public var experience;
public var initunlockedlevel;
public var initplayerunitattack;
public var initgold;// = 3500
public var playertowerprice;
public var unitresearchtimer;
public var computerunitprice;
public var initcomputertowerattack;
public var initplayerunithealth;
public var initcomputerunitstarttimer;
private var BEST_UNITS_BUILT;// = 0
public var scenariodefaultcomputertowercount;
public var savelabel;// = "___xsky_invasionx___"
public var initcomputertowerhealth;
public var unitlosttotal;
public var unlockedcomputerunit;
public var playerunitattackupgradeconst;// = 1.1
public var totalexperience;
public var initresearchlevel;
public var scenariocomputerunitcreatetimer;
public var initplayerunitcreatetimer;
public var initcomputermainbaseattack;// = 1
public var playerbaseattackupgradeconst;// = 1.2
public var maxgold;
public var selectedlevel;// = 1
public var scenariocomputertowercreatetimer;
public var interestresearchvalue;
public var playerunithealthupgradeconst;// = 1.1
public var initcomputermainbasehealth;// = 2000
public var playerbasehealthupgradeconst;// = 1.2
public var playertowerattackupgradeconst;// = 1.2
private var kongregate:KongregateAPI;
public var playertowerhealthupgradeconst;// = 1.2
public var defaultcomputertowery;
public var defaultcomputertowerx;
public var playermainbaseattack;
public var scenariodefaultcomputertower;
public var playerunitname;
public var initupgradelevel;
public var scenariogold;
public function DataManager(_thisparent){
var i:*;
thisparent = null;
savelabel = "___xsky_invasionx___";
playerbasehealthupgradeconst = 1.2;
playerbaseattackupgradeconst = 1.2;
playertowerhealthupgradeconst = 1.2;
playertowerattackupgradeconst = 1.2;
playerunithealthupgradeconst = 1.1;
playerunitattackupgradeconst = 1.1;
computertowercreateinterval = 8;
playerunitname = new Array("avenger", "thunderbolt", "defender", "battlecruiser", "valour", "secretstriker", "aircraftcarrier");
playertowername = new Array("guntower", "missiletower", "thundertower", "emptower", "plasmatower");
computerunitname = new Array("intrepid", "excelsior", "steamrunner", "ptolemy", "warhammer", "vanguard", "aircraftcarrier");
computertowername = new Array("guntower", "missiletower", "plasmatower", "thundertower");
playerunitprice = new Array(10, 75, 250, 500, 1500, 450, 3000);
playertowerprice = new Array(500, 1000, 2000, 250, 2000);
playerupgradeprice = new Array([1000, 2500, 10000], [500, 1500, 5000], [500, 1500, 5000], [400, 1200, 4000]);
playerresearchprice = new Array([200, 1500, 3000], [75, 500, 1000], [75, 500, 1000], [50, 300, 750], [50, 300, 750], [100, 750, 1500], [100, 750, 1500]);
computerunitprice = new Array(3, 17, 37, 77, 177, 377, 777);
computertowerprice = new Array(177, 377, 477, 577);
baseresearchhealth = new Array(1000, 2000, 4000, 8000);
baseresearchattack = new Array(1, 4, 16, 64);
unitresearchhealth = new Array([10, 80, 300, 600, 3000, 750, 5000], [12, 96, 360, 720, 3600, 900, 6000], [14, 112, 420, 840, 4200, 1050, 7000], [16, 128, 480, 960, 4800, 1200, 8000]);
unitresearchattack = new Array([1, 4, 12, 25, 40, 20, 15], [1.2, 4.8, 14.4, 30, 48, 24, 18], [1.4, 5.6, 16.8, 35, 56, 28, 21], [1.6, 6.4, 19.2, 40, 64, 32, 24]);
towerresearchhealth = new Array([1000, 1500, 2500, 100, 1500], [1200, 1800, 3000, 120, 1800], [1400, 2100, 3500, 140, 2100], [1600, 2400, 4000, 160, 2400]);
towerresearchattack = new Array([2, 10, 10, 30, 15], [2.4, 12, 12, 36, 18], [2.8, 14, 14, 42, 21], [3.2, 16, 16, 48, 24]);
unitresearchtimer = new Array([30, 60, 90, 120, 150, 60, 150], [24, 48, 72, 96, 120, 48, 120], [18, 36, 54, 72, 90, 36, 90], [12, 24, 36, 48, 60, 24, 60]);
towerresearchtimer = new Array([300, 360, 480, 180, 420], [240, 288, 384, 144, 336], [180, 216, 288, 108, 252], [120, 144, 192, 72, 168]);
interestresearchvalue = new Array(0.005, 0.0052, 0.0055, 0.006);
killgoldresearchvalue = new Array([3, 17, 37, 77, 177, 377, 777, 177, 377, 477, 577], [3.3, 18.7, 44.4, 92.4, 212.4, 452.4, 932.4, 212.4, 452.4, 572.4, 692.4], [3.6, 20.6, 51.8, 107.8, 247.8, 527.8, 1087.8, 247.8, 527.8, 667.8, 807.8], [4, 22.6, 59.2, 123.2, 283.2, 603.2, 1243.2, 283.2, 603.2, 763.2, 923.2]);
initunlockedlevel = new Array(true, false, false, false, false, false, false, false, false, false, false, false);
initunlockedspecial = new Array(false, false, false, false);
initgold = 3500;
initupgradelevel = new Array(0, 0, 0, 0);
initresearchlevel = new Array(0, 0, 0, 0, 0, 0, 0);
initplayermainbasehealth = 1000;
initplayermainbaseattack = 1;
initplayerunithealth = new Array(10, 50, 150, 500, 5000, 750, 4000);
initplayerunitattack = new Array(1, 4, 12, 40, 200, 60, 20);
initplayertowerhealth = new Array(1000, 1500, 2000, 10, 2500);
initplayertowerattack = new Array(1, 5, 5, 50, 10);
initunlockedplayerunit = new Array(true, false, false, false, false);
initunlockedplayertower = new Array(false, false, false);
initplayerunitcreatetimer = new Array(30, 60, 90, 120, 150, 60, 150);
initplayertowercreatetimer = new Array(90, 180, 360, 60, 180);
initcomputermainbasehealth = 2000;
initcomputermainbaseattack = 1;
initcomputerunithealth = new Array(10, 50, 150, 300, 500, 1000, 4000);
initcomputerunitattack = new Array(1, 4, 12, 20, 40, 10, 15);
initcomputertowerhealth = new Array(1000, 1500, 2500, 2500);
initcomputertowerattack = new Array(2, 10, 10, 15);
initunlockedcomputerunit = new Array(true, false, false, false, false, false, false);
initdefaultcomputertower = new Array("guntower", "guntower", "guntower", "guntower");
initdefaultcomputertowerx = new Array(440, 520, 440, 520);
initdefaultcomputertowery = new Array(740, 740, 660, 660);
initcomputerunitstarttimer = new Array(0, 9000, 999999, 999999, 999999, 999999, 999999);
initcomputerunitcreatetimer = new Array(90, 185, 365, 725, 1445, 2885, 5765);
initcomputertowercreatetimer = new Array(90, 180, 360, 60, 180);
totalduration = 0;
levelduration = 0;
levelstarttime = 0;
levelstoptime = 0;
gamewincount = 0;
gamelostcount = 0;
selectedlevel = 1;
unlockedlevel = new Array();
playedlevel = new Array();
completedlevel = 0;
unlockedspecial = new Array();
upgradelevel = new Array();
researchlevel = new Array();
unitcreatedtotal = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitlosttotal = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitkilledtotal = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitcreated = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitlost = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitkilled = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
playerunithealth = new Array();
playerunitattack = new Array();
playertowerhealth = new Array();
playertowerattack = new Array();
unlockedplayerunit = new Array();
unlockedplayertower = new Array();
playerunitcreatetimer = new Array();
playertowercreatetimer = new Array();
computerunithealth = new Array();
computerunitattack = new Array();
computertowerhealth = new Array();
computertowerattack = new Array();
unlockedcomputerunit = new Array();
defaultcomputertowercount = new Array();
defaultcomputertower = new Array();
defaultcomputertowerx = new Array();
defaultcomputertowery = new Array();
computerunitstarttimer = new Array();
computerunitcreatetimer = new Array();
computertowercreatetimer = new Array();
scenariogold = new Array(300, 500, 800, 1100, 1500, 1800, 2100, 2500, 2700, 3000, 3300, 3700);
scenariounlockedplayerunit = new Array([true, false, false, false, false], [true, true, false, false, false], [true, true, true, false, false], [true, true, true, true, false], [true, true, true, true, true], [true, true, true, true, true], [true, true, true, true, true], [true, true, true, true, true], [true, true, true, true, true], [true, true, true, true, true], [true, true, true, true, true], [true, true, true, true, true]);
scenariounlockedplayertower = new Array([false, false, false], [false, false, false], [true, false, false], [true, false, false], [true, false, false], [true, true, false], [true, true, false], [true, true, false], [true, true, true], [true, true, true], [true, true, true], [true, true, true]);
scenariocomputermainbasehealth = new Array(1000, 2000, 2000, 6000, 8000, 10000, 12000, 14000, 16000, 18000, 20000, 25000);
scenariocomputermainbaseattack = new Array(1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 25);
scenariodefaultcomputertowercount = new Array(0, 0, 0, 2, 2, 4, 4, 4, 4, 4, 4, 4);
scenariodefaultcomputertower = new Array(["none", "none", "none", "none"], ["none", "none", "none", "none"], ["none", "none", "none", "none"], ["guntower", "guntower", "none", "none"], ["guntower", "guntower", "none", "none"], ["guntower", "guntower", "guntower", "guntower"], ["missiletower", "missiletower", "guntower", "guntower"], ["missiletower", "missiletower", "guntower", "guntower"], ["missiletower", "missiletower", "guntower", "guntower"], ["thundertower", "thundertower", "guntower", "guntower"], ["thundertower", "thundertower", "missiletower", "missiletower"], ["thundertower", "thundertower", "missiletower", "missiletower"]);
scenariodefaultcomputertowerx = new Array([-40, 40, 440, 520], [-40, 40, -40, 40], [-40, 40, -40, 40], [-40, 40, -40, 40], [-40, 40, -40, 40], [-40, 40, -40, 40], [-40, 40, -40, 40], [-40, 40, -40, 40], [-140, 140, 140, -140], [-140, 140, 140, -140], [-140, 140, 140, -140], [-140, 140, 140, -140]);
scenariodefaultcomputertowery = new Array([-150, 740, 660, 660], [-150, -150, -250, -250], [-150, -150, -250, -250], [-150, -150, -250, -250], [-150, -150, -250, -250], [-150, -150, -250, -250], [-150, -150, -250, -250], [-150, -150, -250, -250], [-75, -75, -150, -150], [-75, -75, -150, -150], [-75, -75, -150, -150], [-75, -75, -150, -150]);
scenariocomputertowercreatetimer = new Array([300, 360, 480, 420], [300, 360, 480, 420], [300, 360, 480, 420], [300, 360, 480, 420], [270, 330, 450, 390], [270, 330, 450, 390], [270, 330, 450, 390], [270, 330, 450, 390], [240, 300, 420, 360], [240, 300, 420, 360], [240, 300, 420, 360], [240, 300, 420, 360]);
scenariounlockedcomputerunit = new Array([true, false, false, false, false, false, false], [true, true, false, false, false, false, false], [true, true, true, false, false, false, false], [true, true, true, false, false, false, false], [true, true, true, true, false, false, false], [true, true, true, true, true, false, false], [true, true, true, true, true, true, false], [true, true, true, true, true, true, true], [false, true, true, true, true, true, true], [false, true, true, true, true, true, true], [false, false, true, true, true, true, true], [false, false, true, true, true, true, true]);
scenariocomputerunitstarttimer = new Array([0, 999999, 999999, 999999, 999999, 999999, 999999], [0, 0, 999999, 999999, 999999, 999999, 999999], [0, 0, 0, 999999, 999999, 999999, 999999], [0, 0, 0, 0, 999999, 999999, 999999], [0, 0, 0, 0, 0, 999999, 999999], [0, 0, 0, 0, 0, 0, 999999], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]);
scenariocomputerunitcreatetimer = new Array([215, 9000, 9000, 9000, 9000, 9000, 9000], [215, 455, 9000, 9000, 9000, 9000, 9000], [185, 455, 905, 9000, 9000, 9000, 9000], [185, 455, 905, 1805, 9000, 9000, 9000], [155, 395, 785, 1565, 3605, 9000, 9000], [155, 395, 785, 1565, 3605, 5405, 9000], [185, 335, 665, 1325, 3125, 4685, 7205], [185, 335, 665, 1325, 3125, 4685, 7205], [215, 395, 545, 1085, 3645, 3965, 6245], [215, 395, 545, 1085, 3645, 3965, 6245], [245, 455, 665, 845, 2165, 3245, 5285], [245, 455, 665, 845, 2165, 3245, 5285]);
kongregateServiceLoaded = false;
BEST_ENEMY_KILL = 0;
BEST_UNITS_BUILT = 0;
BEST_UNITS_LOST = 0;
BEST_EXP_EARN = 0;
BEST_HIGHEST_LEVEL = 0;
GAME_COMPLETED = 0;
super();
thisparent = _thisparent;
initKongregateAPI(thisparent);
totalduration = 0;
levelduration = 0;
gamewincount = 0;
gamelostcount = 0;
experience = 0;
totalexperience = 0;
selectedlevel = 1;
completedlevel = 0;
i = 0;
while (i < initunlockedlevel.length) {
unlockedlevel[i] = initunlockedlevel[i];
playedlevel[i] = false;
i++;
};
i = 0;
while (i < initunlockedspecial.length) {
unlockedspecial[i] = initunlockedspecial[i];
i++;
};
i = 0;
while (i < initresearchlevel.length) {
researchlevel[i] = initresearchlevel[i];
i++;
};
initialize();
}
public function towerEnabled(_n):Boolean{
var res:*;
res = false;
if (_n < 3){
res = unlockedplayertower[_n];
} else {
res = unlockedspecial[(_n - 2)];
};
res = ((res) && ((gold >= playertowerprice[_n])));
return (res);
}
public function getLevelCompleted():int{
var num:*;
var i:*;
num = 0;
i = 0;
while (i < playedlevel.length) {
if (playedlevel[i]){
num++;
};
i++;
};
return (Math.floor(num));
}
public function getCreatedTroopsCount():String{
var i:*;
var j:*;
var k:*;
var s:*;
s = "";
i = (((unitcreated[0] + unitcreated[1]) + unitcreated[2]) + unitcreated[5]);
j = ((unitcreated[3] + unitcreated[4]) + unitcreated[6]);
k = ((((unitcreated[7] + unitcreated[8]) + unitcreated[9]) + unitcreated[10]) + unitcreated[11]);
s = ((((Math.floor(i) + "\n") + Math.floor(j)) + "\n") + Math.floor(k));
return (s);
}
public function research3Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[2] < 3)));
res = ((res) && ((experience >= playerresearchprice[2][researchlevel[2]])));
return (res);
}
public function getUnitLost():String{
var i:*;
var s:*;
s = "";
i = 0;
while (i < unitlost.length) {
s = (s + (String(unitlost[i]) + "\n"));
i++;
};
return (s);
}
public function checkStartTime(_t){
levelstarttime = _t;
}
public function getLostTroopsCount():String{
var i:*;
var j:*;
var k:*;
var s:*;
s = "";
i = (((unitlost[0] + unitlost[1]) + unitlost[2]) + unitlost[5]);
j = ((unitlost[3] + unitlost[4]) + unitlost[6]);
k = ((((unitlost[7] + unitlost[8]) + unitlost[9]) + unitlost[10]) + unitlost[11]);
s = ((((Math.floor(i) + "\n") + Math.floor(j)) + "\n") + Math.floor(k));
return (s);
}
public function unit2Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayerunit[1];
res = ((res) && ((gold >= playerunitprice[1])));
return (res);
}
public function research1Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[0] < 3)));
res = ((res) && ((experience >= playerresearchprice[0][researchlevel[0]])));
return (res);
}
public function getUnitKill():int{
var num:*;
var i:*;
num = 0;
i = 0;
while (i < unitkilledtotal.length) {
num = (num + unitkilledtotal[i]);
i++;
};
return (Math.floor(num));
}
public function submitStat(){
BEST_ENEMY_KILL = getUnitKill();
BEST_UNITS_BUILT = getUnitBuild();
BEST_UNITS_LOST = getUnitDead();
BEST_EXP_EARN = getTotalExperience();
BEST_HIGHEST_LEVEL = getHighestLevel();
GAME_COMPLETED = getLevelCompleted();
if (((kongregate) && (kongregateServiceLoaded))){
kongregate.stats.submit("BEST_ENEMY_KILL", BEST_ENEMY_KILL);
kongregate.stats.submit("BEST_UNITS_BUILT", BEST_UNITS_BUILT);
kongregate.stats.submit("BEST_UNITS_LOST", BEST_UNITS_LOST);
kongregate.stats.submit("BEST_EXP_EARN", BEST_EXP_EARN);
kongregate.stats.submit("BEST_HIGHEST_LEVEL", BEST_HIGHEST_LEVEL);
kongregate.stats.submit("GAME_COMPLETED", GAME_COMPLETED);
};
}
public function unit7Enabled():Boolean{
var res:*;
res = false;
res = unlockedspecial[3];
res = ((res) && ((gold >= playerunitprice[6])));
return (res);
}
public function getUnitBuild():int{
var num:*;
var i:*;
num = 0;
i = 0;
while (i < unitcreatedtotal.length) {
num = (num + unitcreatedtotal[i]);
i++;
};
return (Math.floor(num));
}
public function upgrade4Enabled():Boolean{
var res:*;
res = false;
res = (upgradelevel[3] < 3);
res = ((res) && ((gold >= playerupgradeprice[3][upgradelevel[3]])));
return (res);
}
public function tower4Enabled():Boolean{
var res:*;
res = false;
res = unlockedspecial[1];
res = ((res) && ((gold >= playertowerprice[3])));
return (res);
}
public function addUnitKilled(_type){
switch (_type){
case "intrepid":
var _local2 = unitkilled;
var _local3:int;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 0;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[0]);
break;
case "excelsior":
_local2 = unitkilled;
_local3 = 1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[1]);
break;
case "steamrunner":
_local2 = unitkilled;
_local3 = 2;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 2;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[2]);
break;
case "ptolemy":
_local2 = unitkilled;
_local3 = 3;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 3;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[3]);
break;
case "warhammer":
_local2 = unitkilled;
_local3 = 4;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 4;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[4]);
break;
case "vanguard":
_local2 = unitkilled;
_local3 = 5;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 5;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[5]);
break;
case "aircraftcarrier":
_local2 = unitkilled;
_local3 = 6;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 6;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computerunitprice[6]);
if (!unlockedspecial[3]){
if (unitkilledtotal[6] == 1){
thisparent.gameMgr.showSpecialEvent(4);
unlockedspecial[3] = true;
};
if (unitkilledtotal[6] >= 1){
unlockedspecial[3] = true;
};
};
break;
case "guntower":
_local2 = unitkilled;
_local3 = 7;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 7;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computertowerprice[0]);
break;
case "missiletower":
_local2 = unitkilled;
_local3 = 8;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 8;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computertowerprice[1]);
break;
case "plasmatower":
_local2 = unitkilled;
_local3 = 9;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 9;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computertowerprice[2]);
break;
case "thundertower":
_local2 = unitkilled;
_local3 = 10;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitkilledtotal;
_local3 = 10;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
gold = (gold + computertowerprice[3]);
if (!unlockedspecial[2]){
if (unitkilledtotal[10] == 3){
thisparent.gameMgr.showSpecialEvent(3);
unlockedspecial[2] = true;
};
if (unitkilledtotal[10] >= 3){
unlockedspecial[2] = true;
};
};
break;
};
}
public function addUnitLost(_type){
switch (_type){
case "avenger":
var _local2 = unitlost;
var _local3:int;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 0;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "thunderbolt":
_local2 = unitlost;
_local3 = 1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "defender":
_local2 = unitlost;
_local3 = 2;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 2;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "battlecruiser":
_local2 = unitlost;
_local3 = 3;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 3;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "valour":
_local2 = unitlost;
_local3 = 4;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 4;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "secretstriker":
_local2 = unitlost;
_local3 = 5;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 5;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "aircraftcarrier":
_local2 = unitlost;
_local3 = 6;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 6;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "guntower":
_local2 = unitlost;
_local3 = 7;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 7;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "missiletower":
_local2 = unitlost;
_local3 = 8;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 8;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "thundertower":
_local2 = unitlost;
_local3 = 9;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 9;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "emptower":
_local2 = unitlost;
_local3 = 10;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 10;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "plasmatower":
_local2 = unitlost;
_local3 = 11;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitlosttotal;
_local3 = 11;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
};
}
public function research6Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[5] < 3)));
res = ((res) && ((experience >= playerresearchprice[5][researchlevel[5]])));
return (res);
}
public function tower2Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayertower[1];
res = ((res) && ((gold >= playertowerprice[1])));
return (res);
}
public function upgrade2Enabled():Boolean{
var res:*;
res = false;
res = (upgradelevel[1] < 3);
res = ((res) && ((gold >= playerupgradeprice[1][upgradelevel[1]])));
return (res);
}
public function saveData(){
var so:SharedObject;
so = SharedObject.getLocal(savelabel);
so.data.selectedlevel = selectedlevel;
so.data.unlockedlevel = unlockedlevel;
so.data.playedlevel = playedlevel;
so.data.completedlevel = completedlevel;
so.data.unlockedspecial = unlockedspecial;
so.data.experience = experience;
so.data.totalexperience = totalexperience;
so.data.researchlevel = researchlevel;
so.data.gamewincount = gamewincount;
so.data.gamelostcount = gamelostcount;
so.data.unitcreatedtotal = unitcreatedtotal;
so.data.unitlosttotal = unitlosttotal;
so.data.unitkilledtotal = unitkilledtotal;
so.data.totalduration = totalduration;
so.flush();
}
public function unit5Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayerunit[4];
res = ((res) && ((gold >= playerunitprice[4])));
return (res);
}
public function checkData():Boolean{
var so:*;
so = SharedObject.getLocal(savelabel);
if (so.size == 0){
return (false);
};
return (true);
}
public function recalculateData(){
var i:*;
maxgold = (gold * 2);
interest = ((gold * interestresearchvalue[researchlevel[5]]) / 30);
i = 0;
while (i < killgoldresearchvalue[researchlevel[6]].length) {
if (i < 7){
computerunitprice[i] = killgoldresearchvalue[researchlevel[6]][i];
} else {
computertowerprice[i] = killgoldresearchvalue[researchlevel[6]][i];
};
i++;
};
playermainbasehealth = baseresearchhealth[researchlevel[0]];
playermainbaseattack = baseresearchattack[researchlevel[0]];
i = 0;
while (i < playerunithealth.length) {
playerunithealth[i] = unitresearchhealth[researchlevel[1]][i];
playerunitattack[i] = unitresearchattack[researchlevel[1]][i];
playerunitcreatetimer[i] = unitresearchtimer[researchlevel[3]][i];
i++;
};
i = 0;
while (i < playertowerhealth.length) {
playertowerhealth[i] = towerresearchhealth[researchlevel[2]][i];
playertowerattack[i] = towerresearchattack[researchlevel[2]][i];
playertowercreatetimer[i] = towerresearchtimer[researchlevel[4]][i];
i++;
};
}
public function getResearchPrice(_n):int{
var res:*;
res = 0;
switch (_n){
case 1:
if (researchlevel[0] < 3){
res = playerresearchprice[0][researchlevel[0]];
} else {
res = 0;
};
break;
case 2:
if (researchlevel[1] < 3){
res = playerresearchprice[1][researchlevel[1]];
} else {
res = 0;
};
break;
case 3:
if (researchlevel[2] < 3){
res = playerresearchprice[2][researchlevel[2]];
} else {
res = 0;
};
break;
case 4:
if (researchlevel[3] < 3){
res = playerresearchprice[3][researchlevel[3]];
} else {
res = 0;
};
break;
case 5:
if (researchlevel[4] < 3){
res = playerresearchprice[4][researchlevel[4]];
} else {
res = 0;
};
break;
case 6:
if (researchlevel[5] < 3){
res = playerresearchprice[5][researchlevel[5]];
} else {
res = 0;
};
break;
case 7:
if (researchlevel[6] < 3){
res = playerresearchprice[6][researchlevel[6]];
} else {
res = 0;
};
break;
};
return (res);
}
public function setFinishedLevel(){
gamewincount++;
switch (selectedlevel){
case 1:
playedlevel[0] = true;
unlockedlevel[1] = true;
unlockedlevel[2] = true;
selectedlevel = 2;
if (completedlevel < 1){
completedlevel = 1;
};
break;
case 2:
playedlevel[1] = true;
unlockedlevel[3] = true;
unlockedlevel[4] = true;
selectedlevel = 3;
if (completedlevel < 2){
completedlevel = 2;
};
break;
case 3:
playedlevel[2] = true;
unlockedlevel[3] = true;
unlockedlevel[5] = true;
selectedlevel = 4;
if (completedlevel < 3){
completedlevel = 3;
};
break;
case 4:
playedlevel[3] = true;
unlockedlevel[4] = true;
unlockedlevel[5] = true;
unlockedlevel[6] = true;
selectedlevel = 5;
if (completedlevel < 4){
completedlevel = 4;
};
break;
case 5:
playedlevel[4] = true;
unlockedlevel[5] = true;
unlockedlevel[6] = true;
selectedlevel = 6;
if (completedlevel < 5){
completedlevel = 5;
};
break;
case 6:
playedlevel[5] = true;
unlockedlevel[6] = true;
unlockedlevel[7] = true;
unlockedlevel[8] = true;
selectedlevel = 7;
if (completedlevel < 6){
completedlevel = 6;
};
break;
case 7:
playedlevel[6] = true;
unlockedlevel[5] = true;
unlockedlevel[7] = true;
unlockedlevel[8] = true;
selectedlevel = 8;
if (completedlevel < 7){
completedlevel = 7;
};
break;
case 8:
playedlevel[7] = true;
unlockedlevel[8] = true;
selectedlevel = 9;
if (completedlevel < 8){
completedlevel = 8;
};
if (((((playedlevel[7]) && (playedlevel[8]))) && (playedlevel[9]))){
selectedlevel = 11;
unlockedlevel[10] = true;
};
break;
case 9:
playedlevel[8] = true;
unlockedlevel[7] = true;
unlockedlevel[9] = true;
selectedlevel = 10;
if (completedlevel < 9){
completedlevel = 9;
};
if (((((playedlevel[7]) && (playedlevel[8]))) && (playedlevel[9]))){
selectedlevel = 11;
unlockedlevel[10] = true;
};
break;
case 10:
playedlevel[9] = true;
unlockedlevel[8] = true;
selectedlevel = 11;
if (completedlevel < 10){
completedlevel = 10;
};
if (((((playedlevel[7]) && (playedlevel[8]))) && (playedlevel[9]))){
selectedlevel = 11;
unlockedlevel[10] = true;
};
break;
case 11:
playedlevel[10] = true;
unlockedlevel[11] = true;
selectedlevel = 12;
if (completedlevel < 11){
completedlevel = 11;
};
break;
case 12:
playedlevel[11] = true;
selectedlevel = 1;
if (completedlevel < 12){
completedlevel = 12;
};
break;
};
saveData();
submitStat();
}
public function getUpgradePrice(_n):int{
var res:*;
res = 0;
switch (_n){
case 1:
if (upgradelevel[0] < 3){
res = playerupgradeprice[0][upgradelevel[0]];
} else {
res = 0;
};
break;
case 2:
if (upgradelevel[1] < 3){
res = playerupgradeprice[1][upgradelevel[1]];
} else {
res = 0;
};
break;
case 3:
if (upgradelevel[2] < 3){
res = playerupgradeprice[2][upgradelevel[2]];
} else {
res = 0;
};
break;
case 4:
if (upgradelevel[3] < 3){
res = playerupgradeprice[3][upgradelevel[3]];
} else {
res = 0;
};
break;
case 5:
res = 2;
break;
};
return (res);
}
public function getDestroyedEnemiesScore(_gamewin):String{
var i:*;
var j:*;
var k:*;
var s:*;
s = "";
i = (((((unitkilled[0] * 1) * 2) + ((unitkilled[1] * 2) * 2)) + ((unitkilled[2] * 3) * 2)) + ((unitkilled[3] * 4) * 2));
j = ((((unitkilled[4] * 5) * 2) + ((unitkilled[5] * 6) * 2)) + ((unitkilled[6] * 7) * 2));
k = (((((unitkilled[7] * 8) * 2) + ((unitkilled[8] * 9) * 2)) + ((unitkilled[9] * 10) * 2)) + ((unitkilled[10] * 11) * 2));
s = ((((Math.floor(i) + "\n") + Math.floor(j)) + "\n") + Math.floor(k));
return (s);
}
public function unit3Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayerunit[2];
res = ((res) && ((gold >= playerunitprice[2])));
return (res);
}
public function checkStopTime(_t){
levelstoptime = _t;
levelduration = (levelstoptime - levelstarttime);
totalduration = (totalduration + levelduration);
}
private function serviceLoaded(e:KongregateEvent):void{
kongregate.services.connect();
kongregateServiceLoaded = true;
}
public function getUnitKilled():String{
var i:*;
var s:*;
s = "";
i = 0;
while (i < unitkilled.length) {
s = (s + (String(unitkilled[i]) + "\n"));
i++;
};
return (s);
}
private function initKongregateAPI(_stage){
kongregate = new KongregateAPI();
_stage.addChild(kongregate);
kongregate.addEventListener(KongregateEvent.COMPLETE, serviceLoaded, false, 0, true);
}
public function getStatistics():String{
var s:*;
s = "";
s = (s + (Math.floor(gamewincount) + "\n"));
s = (s + (Math.floor(gamelostcount) + "\n\n"));
s = (s + (Math.floor(((((((unitcreatedtotal[0] + unitcreatedtotal[1]) + unitcreatedtotal[2]) + unitcreatedtotal[3]) + unitcreatedtotal[4]) + unitcreatedtotal[5]) + unitcreatedtotal[6])) + "\n"));
s = (s + (Math.floor(((((((unitlosttotal[0] + unitlosttotal[1]) + unitlosttotal[2]) + unitlosttotal[3]) + unitlosttotal[4]) + unitlosttotal[5]) + unitlosttotal[6])) + "\n"));
s = (s + (Math.floor(((((((unitkilledtotal[0] + unitkilledtotal[1]) + unitkilledtotal[2]) + unitkilledtotal[3]) + unitkilledtotal[4]) + unitkilledtotal[5]) + unitkilledtotal[6])) + "\n\n"));
s = (s + (Math.floor(((((unitcreatedtotal[7] + unitcreatedtotal[8]) + unitcreatedtotal[9]) + unitcreatedtotal[10]) + unitcreatedtotal[11])) + "\n"));
s = (s + (Math.floor(((((unitlosttotal[7] + unitlosttotal[8]) + unitlosttotal[9]) + unitlosttotal[10]) + unitlosttotal[11])) + "\n"));
s = (s + (Math.floor((((unitkilledtotal[7] + unitkilledtotal[8]) + unitkilledtotal[9]) + unitkilledtotal[10])) + "\n\n"));
s = (s + (Math.floor(totalexperience) + "\n"));
s = (s + Math.floor(experience));
return (s);
}
public function research4Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[3] < 3)));
res = ((res) && ((experience >= playerresearchprice[3][researchlevel[3]])));
return (res);
}
public function doUpgrade1(_playerBaseMC){
var newhealth:*;
if (upgradelevel[0] < 3){
gold = (gold - playerupgradeprice[0][upgradelevel[0]]);
var _local3 = upgradelevel;
var _local4:int;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
newhealth = (_playerBaseMC.maxhealth * playerbasehealthupgradeconst);
_playerBaseMC.health = (_playerBaseMC.health + (newhealth - _playerBaseMC.maxhealth));
_playerBaseMC.maxhealth = newhealth;
};
}
public function doUpgrade2(){
var i:*;
if (upgradelevel[1] < 3){
gold = (gold - playerupgradeprice[1][upgradelevel[1]]);
var _local2 = upgradelevel;
var _local3 = 1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
i = 0;
while (i < playertowerhealth.length) {
playertowerhealth[i] = (playertowerhealth[i] * playertowerhealthupgradeconst);
i++;
};
};
}
public function doUpgrade3(){
var i:*;
if (upgradelevel[2] < 3){
gold = (gold - playerupgradeprice[2][upgradelevel[2]]);
var _local2 = upgradelevel;
var _local3 = 2;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
i = 0;
while (i < playerunithealth.length) {
playerunithealth[i] = (playerunithealth[i] * playerunithealthupgradeconst);
i++;
};
};
}
public function doUpgrade4(){
var i:*;
if (upgradelevel[3] < 3){
gold = (gold - playerupgradeprice[3][upgradelevel[3]]);
var _local2 = upgradelevel;
var _local3 = 3;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
i = 0;
while (i < playerunitattack.length) {
playerunitattack[i] = (playerunitattack[i] * playerunitattackupgradeconst);
i++;
};
};
}
public function tower5Enabled():Boolean{
var res:*;
res = false;
res = unlockedspecial[2];
res = ((res) && ((gold >= playertowerprice[4])));
return (res);
}
public function research2Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[1] < 3)));
res = ((res) && ((experience >= playerresearchprice[1][researchlevel[1]])));
return (res);
}
public function unit1Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayerunit[0];
res = ((res) && ((gold >= playerunitprice[0])));
return (res);
}
public function addUnitCreated(_type){
switch (_type){
case "avenger":
var _local2 = unitcreated;
var _local3:int;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 0;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "thunderbolt":
_local2 = unitcreated;
_local3 = 1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 1;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (!unlockedspecial[0]){
if (unitcreatedtotal[1] == 100){
thisparent.gameMgr.showSpecialEvent(1);
unlockedspecial[0] = true;
};
if (unitcreatedtotal[1] >= 100){
unlockedspecial[0] = true;
};
};
break;
case "defender":
_local2 = unitcreated;
_local3 = 2;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 2;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "battlecruiser":
_local2 = unitcreated;
_local3 = 3;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 3;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "valour":
_local2 = unitcreated;
_local3 = 4;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 4;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "secretstriker":
_local2 = unitcreated;
_local3 = 5;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 5;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "aircraftcarrier":
_local2 = unitcreated;
_local3 = 6;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 6;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "guntower":
_local2 = unitcreated;
_local3 = 7;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 7;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (!unlockedspecial[1]){
if (unitcreatedtotal[7] == 10){
thisparent.gameMgr.showSpecialEvent(2);
unlockedspecial[1] = true;
};
if (unitcreatedtotal[7] >= 10){
unlockedspecial[1] = true;
};
};
break;
case "missiletower":
_local2 = unitcreated;
_local3 = 8;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 8;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "thundertower":
_local2 = unitcreated;
_local3 = 9;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 9;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "emptower":
_local2 = unitcreated;
_local3 = 10;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 10;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
case "plasmatower":
_local2 = unitcreated;
_local3 = 11;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
_local2 = unitcreatedtotal;
_local3 = 11;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
break;
};
}
public function getTotalTime():String{
var tparser:*;
tparser = new TimeParser();
return (tparser.Parse(totalduration));
}
public function setUnfinishedLevel(){
gamelostcount++;
saveData();
submitStat();
}
public function upgrade5Enabled(_health, _maxhealth):Boolean{
var res:*;
res = false;
res = (gold >= 2);
res = ((res) && ((_health < _maxhealth)));
return (res);
}
public function getNewExperience(_gamewin):int{
var exp:*;
var i:*;
exp = 0;
i = 0;
while (i < unitkilled.length) {
exp = (exp + ((unitkilled[i] * (i + 1)) * 2));
i++;
};
i = 0;
while (i < unitcreated.length) {
exp = (exp + (unitcreated[i] * (i + 1)));
i++;
};
i = 0;
while (i < unitlost.length) {
exp = (exp - ((unitlost[i] * (i + 1)) / 2));
i++;
};
if (exp < 0){
exp = 0;
};
if (_gamewin){
totalexperience = (totalexperience + Math.floor(exp));
experience = (experience + Math.floor(exp));
} else {
totalexperience = (totalexperience + Math.floor((exp / 2)));
experience = (experience + Math.floor((exp / 2)));
};
return (exp);
}
public function getUnitDead():int{
var num:*;
var i:*;
num = 0;
i = 0;
while (i < unitlosttotal.length) {
num = (num + unitlosttotal[i]);
i++;
};
return (Math.floor(num));
}
public function getDestroyedEnemiesCount():String{
var i:*;
var j:*;
var k:*;
var s:*;
s = "";
i = (((unitkilled[0] + unitkilled[1]) + unitkilled[2]) + unitkilled[3]);
j = ((unitkilled[4] + unitkilled[5]) + unitkilled[6]);
k = (((unitkilled[7] + unitkilled[8]) + unitkilled[9]) + unitkilled[10]);
s = ((((Math.floor(i) + "\n") + Math.floor(j)) + "\n") + Math.floor(k));
return (s);
}
public function tower3Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayertower[2];
res = ((res) && ((gold >= playertowerprice[2])));
return (res);
}
public function resetData(){
selectedlevel = 1;
unlockedlevel = new Array(true, false, false, false, false, false, false, false, false, false, false, false);
playedlevel = new Array(false, false, false, false, false, false, false, false, false, false, false, false);
completedlevel = 0;
unlockedspecial = new Array(false, false, false, false);
experience = 0;
totalexperience = 0;
researchlevel = new Array(0, 0, 0, 0, 0, 0, 0);
gamewincount = 0;
gamelostcount = 0;
unitcreatedtotal = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitlosttotal = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitkilledtotal = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
levelduration = 0;
totalduration = 0;
unitcreated = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitlost = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
unitkilled = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
public function research7Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[6] < 3)));
res = ((res) && ((experience >= playerresearchprice[6][researchlevel[6]])));
return (res);
}
public function getCreatedTroopsScore(_gamewin):String{
var i:*;
var j:*;
var k:*;
var s:*;
s = "";
i = ((((unitcreated[0] * 1) + (unitcreated[1] * 2)) + (unitcreated[2] * 3)) + (unitcreated[5] * 6));
j = (((unitcreated[3] * 4) + (unitcreated[4] * 5)) + (unitcreated[6] * 7));
k = (((((unitcreated[7] * 8) + (unitcreated[8] * 9)) + (unitcreated[9] * 10)) + (unitcreated[10] * 11)) + (unitcreated[11] * 12));
s = ((((Math.floor(i) + "\n") + Math.floor(j)) + "\n") + Math.floor(k));
return (s);
}
public function doResearch1(){
experience = (experience - playerresearchprice[0][researchlevel[0]]);
var _local1 = researchlevel;
var _local2:int;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function doResearch2(){
experience = (experience - playerresearchprice[1][researchlevel[1]]);
var _local1 = researchlevel;
var _local2 = 1;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function doResearch3(){
experience = (experience - playerresearchprice[2][researchlevel[2]]);
var _local1 = researchlevel;
var _local2 = 2;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function unit6Enabled():Boolean{
var res:*;
res = false;
res = unlockedspecial[0];
res = ((res) && ((gold >= playerunitprice[5])));
return (res);
}
public function upgrade3Enabled():Boolean{
var res:*;
res = false;
res = (upgradelevel[2] < 3);
res = ((res) && ((gold >= playerupgradeprice[2][upgradelevel[2]])));
return (res);
}
private function initialize(){
var i:*;
levelduration = 0;
i = 0;
while (i < initupgradelevel.length) {
upgradelevel[i] = initupgradelevel[i];
i++;
};
i = 0;
while (i < unitkilled.length) {
unitkilled[0] = 0;
i++;
};
i = 0;
while (i < unitcreated.length) {
unitcreated[0] = 0;
unitlost[0] = 0;
i++;
};
playermainbasehealth = initplayermainbasehealth;
playermainbaseattack = initplayermainbaseattack;
i = 0;
while (i < initplayerunithealth.length) {
playerunithealth[i] = initplayerunithealth[i];
playerunitattack[i] = initplayerunitattack[i];
playerunitcreatetimer[i] = initplayerunitcreatetimer[i];
i++;
};
i = 0;
while (i < initplayertowerhealth.length) {
playertowerhealth[i] = initplayertowerhealth[i];
playertowerattack[i] = initplayertowerattack[i];
playertowercreatetimer[i] = initplayertowercreatetimer[i];
i++;
};
i = 0;
while (i < initunlockedplayerunit.length) {
unlockedplayerunit[i] = initunlockedplayerunit[i];
i++;
};
i = 0;
while (i < initunlockedplayertower.length) {
unlockedplayertower[i] = initunlockedplayertower[i];
i++;
};
computermainbasehealth = initcomputermainbasehealth;
computermainbaseattack = initcomputermainbaseattack;
i = 0;
while (i < initcomputerunithealth.length) {
computerunithealth[i] = initcomputerunithealth[i];
computerunitattack[i] = initcomputerunitattack[i];
computerunitstarttimer[i] = initcomputerunitstarttimer[i];
computerunitcreatetimer[i] = initcomputerunitcreatetimer[i];
unlockedcomputerunit[i] = initunlockedcomputerunit[i];
i++;
};
i = 0;
while (i < initcomputertowerhealth.length) {
computertowerhealth[i] = initcomputertowerhealth[i];
computertowerattack[i] = initcomputertowerattack[i];
computertowercreatetimer[i] = initcomputertowercreatetimer[i];
i++;
};
i = 0;
while (i < initdefaultcomputertowerx.length) {
defaultcomputertower[i] = initdefaultcomputertower[i];
defaultcomputertowerx[i] = initdefaultcomputertowerx[i];
defaultcomputertowery[i] = initdefaultcomputertowery[i];
i++;
};
}
public function doResearch6(){
experience = (experience - playerresearchprice[5][researchlevel[5]]);
var _local1 = researchlevel;
var _local2 = 5;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function doResearch5(){
experience = (experience - playerresearchprice[4][researchlevel[4]]);
var _local1 = researchlevel;
var _local2 = 4;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function loadData():Boolean{
var res:*;
var so:*;
res = true;
so = SharedObject.getLocal(savelabel);
if (so.size == 0){
so.data.selectedlevel = selectedlevel;
so.data.unlockedlevel = unlockedlevel;
so.data.playedlevel = playedlevel;
so.data.completedlevel = completedlevel;
so.data.unlockedspecial = unlockedspecial;
so.data.experience = experience;
so.data.totalexperience = totalexperience;
so.data.researchlevel = researchlevel;
so.data.gamewincount = gamewincount;
so.data.gamelostcount = gamelostcount;
so.data.unitcreatedtotal = unitcreatedtotal;
so.data.unitlosttotal = unitlosttotal;
so.data.unitkilledtotal = unitkilledtotal;
so.data.totalduration = totalduration;
so.flush();
res = false;
};
resetData();
if (so.data.selectedlevel){
selectedlevel = so.data.selectedlevel;
unlockedlevel = so.data.unlockedlevel;
playedlevel = so.data.playedlevel;
completedlevel = so.data.completedlevel;
unlockedspecial = so.data.unlockedspecial;
experience = so.data.experience;
totalexperience = so.data.totalexperience;
researchlevel = so.data.researchlevel;
gamewincount = so.data.gamewincount;
gamelostcount = so.data.gamelostcount;
unitcreatedtotal = so.data.unitcreatedtotal;
unitlosttotal = so.data.unitlosttotal;
unitkilledtotal = so.data.unitkilledtotal;
totalduration = so.data.totalduration;
} else {
res = false;
};
return (res);
}
public function getLevelTime():String{
var tparser:*;
tparser = new TimeParser();
return (tparser.Parse(levelduration));
}
public function getTotalExperience():int{
var num:*;
num = 0;
num = totalexperience;
return (Math.floor(num));
}
public function getHighestLevel():int{
var num:*;
num = 0;
num = completedlevel;
return (Math.floor(num));
}
public function doResearch7(){
experience = (experience - playerresearchprice[6][researchlevel[6]]);
var _local1 = researchlevel;
var _local2 = 6;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function tower1Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayertower[0];
res = ((res) && ((gold >= playertowerprice[0])));
return (res);
}
public function doResearch4(){
experience = (experience - playerresearchprice[3][researchlevel[3]]);
var _local1 = researchlevel;
var _local2 = 3;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
}
public function getLostTroopsScore(_gamewin):String{
var i:*;
var j:*;
var k:*;
var s:*;
s = "";
i = ((((-1 * ((unitlost[0] * 1) / 2)) + ((unitlost[1] * 2) / 2)) + ((unitlost[2] * 3) / 2)) + ((unitlost[5] * 6) / 2));
j = (((-1 * ((unitlost[3] * 4) / 2)) + ((unitlost[4] * 5) / 2)) + ((unitlost[6] * 7) / 2));
k = (((((-1 * ((unitlost[7] * 8) / 2)) + ((unitlost[8] * 9) / 2)) + ((unitlost[9] * 10) / 2)) + ((unitlost[10] * 11) / 2)) + ((unitlost[11] * 12) / 2));
s = ((((Math.floor(i) + "\n") + Math.floor(j)) + "\n") + Math.floor(k));
return (s);
}
public function selectLevel(_lev=0){
var i:*;
if (_lev != 0){
if (unlockedlevel[(_lev - 1)]){
selectedlevel = _lev;
} else {
selectedlevel = 1;
};
};
gold = scenariogold[(selectedlevel - 1)];
initcomputermainbasehealth = scenariocomputermainbasehealth[(selectedlevel - 1)];
initcomputermainbaseattack = scenariocomputermainbaseattack[(selectedlevel - 1)];
i = 0;
while (i < initunlockedplayerunit.length) {
initunlockedplayerunit[i] = scenariounlockedplayerunit[(selectedlevel - 1)][i];
i++;
};
i = 0;
while (i < initunlockedplayertower.length) {
initunlockedplayertower[i] = scenariounlockedplayertower[(selectedlevel - 1)][i];
i++;
};
defaultcomputertowercount = scenariodefaultcomputertowercount[(selectedlevel - 1)];
i = 0;
while (i < initdefaultcomputertower.length) {
initdefaultcomputertower[i] = scenariodefaultcomputertower[(selectedlevel - 1)][i];
initdefaultcomputertowerx[i] = scenariodefaultcomputertowerx[(selectedlevel - 1)][i];
initdefaultcomputertowery[i] = scenariodefaultcomputertowery[(selectedlevel - 1)][i];
initcomputertowercreatetimer[i] = scenariocomputertowercreatetimer[(selectedlevel - 1)][i];
i++;
};
i = 0;
while (i < initunlockedcomputerunit.length) {
initunlockedcomputerunit[i] = scenariounlockedcomputerunit[(selectedlevel - 1)][i];
initcomputerunitstarttimer[i] = scenariocomputerunitstarttimer[(selectedlevel - 1)][i];
initcomputerunitcreatetimer[i] = scenariocomputerunitcreatetimer[(selectedlevel - 1)][i];
i++;
};
initialize();
recalculateData();
if (!unlockedspecial[0]){
if (unitcreatedtotal[1] >= 100){
unlockedspecial[0] = true;
};
};
if (!unlockedspecial[1]){
if (unitcreatedtotal[7] >= 10){
unlockedspecial[1] = true;
};
};
if (!unlockedspecial[2]){
if (unitkilledtotal[10] >= 3){
unlockedspecial[2] = true;
};
};
if (!unlockedspecial[3]){
if (unitkilledtotal[6] >= 1){
unlockedspecial[3] = true;
};
};
}
public function research5Enabled():Boolean{
var res:*;
res = true;
res = ((res) && ((researchlevel[4] < 3)));
res = ((res) && ((experience >= playerresearchprice[4][researchlevel[4]])));
return (res);
}
public function unit4Enabled():Boolean{
var res:*;
res = false;
res = unlockedplayerunit[3];
res = ((res) && ((gold >= playerunitprice[3])));
return (res);
}
public function upgrade1Enabled():Boolean{
var res:*;
res = false;
res = (upgradelevel[0] < 3);
res = ((res) && ((gold >= playerupgradeprice[0][upgradelevel[0]])));
return (res);
}
}
}//package
Section 99
//DropParticleBase (DropParticleBase)
package {
import flash.events.*;
import flash.display.*;
public class DropParticleBase extends MovieClip {
public var live;
public var scalestep;// = 0.01
public var alphastep;// = 0.02
public var xstep;
public var ystep;
public function DropParticleBase(){
alphastep = 0.02;
scalestep = 0.01;
super();
}
public function init(){
live = Math.floor(((Math.random() * 20) + 10));
xstep = ((Math.random() * 10) - 5);
ystep = ((Math.random() * 10) - 5);
this.rotation = ((Math.random() * 360) - 180);
this.gotoAndStop(1);
this.addEventListener(Event.ENTER_FRAME, moveClip, false, 0, true);
}
public function moveClip(e=null){
if (live > 0){
live--;
ystep = (ystep + 0.3);
if (xstep > 0.3){
xstep = (xstep - 0.3);
} else {
if (xstep < -0.3){
xstep = (xstep + 0.3);
} else {
xstep = 0;
};
};
this.x = (this.x + xstep);
this.y = (this.y + ystep);
this.scaleX = (this.scaleX - scalestep);
this.scaleY = (this.scaleY - scalestep);
this.rotation++;
} else {
if (this.currentLabel != "destroyed"){
this.removeEventListener(Event.ENTER_FRAME, moveClip);
this.gotoAndStop("destroyed");
};
};
}
}
}//package
Section 100
//FloatingBaseObjectBase (FloatingBaseObjectBase)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class FloatingBaseObjectBase extends MovieClip {
public var maxhealth;
public var attack;
public var health;
public var typed;// = "mainbase"
private var unitstatus;// = "idle"
private var target;
private var targetdistance;
private var stopy;
public var mcrepair:MovieClip;
private var createtime;
private var thisparent;
private var firemode;// = "auto"
private var gamemgr;
public var sided;// = "player"
public var gun1:MovieClip;
public var gun2:MovieClip;
public function FloatingBaseObjectBase(){
sided = "player";
typed = "mainbase";
unitstatus = "idle";
firemode = "auto";
super();
}
public function init(){
thisparent = this.parent;
gamemgr = thisparent.myParent;
unitstatus = "idle";
createtime = getTimer();
stopy = this.y;
health = gamemgr.gameData.playermainbasehealth;
attack = gamemgr.gameData.playermainbaseattack;
maxhealth = health;
gamemgr.stagePanel.mcplayerbasehealthbar.gotoAndStop(101);
gamemgr.stagePanel.mcplayerbasehealthbar.txt.text = Math.floor(health);
this.cacheAsBitmap = true;
this.addEventListener(MouseEvent.MOUSE_UP, toggleFireMenu, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OVER, showData, false, 0, true);
}
public function reduceHealth2(_dmg){
var prevhealth:*;
if (_dmg > health){
health = 0;
gamemgr.stagePanel.mcplayerbasehealthbar.gotoAndStop(1);
gamemgr.stagePanel.mcplayerbasehealthbar.txt.text = "0";
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
} else {
prevhealth = health;
health = (health - _dmg);
gamemgr.stagePanel.mcplayerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mcplayerbasehealthbar.txt.text = Math.floor(health);
if ((health / maxhealth) < 0.33){
if ((prevhealth / maxhealth) >= 0.33){
gamemgr.showMessage("Our base is in critical point");
gamemgr.sndMgr.playBGM("high");
};
};
};
}
private function getClosestEnemy():Object{
var dist:*;
var obj:*;
var dist2:*;
var obj2:*;
var i:*;
dist = 100;
obj = null;
if (thisparent.computerUnits.length > 0){
obj = thisparent.computerUnits[0];
dist = getDistance(this, obj);
i = 1;
while (i < thisparent.computerUnits.length) {
obj2 = thisparent.computerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
};
if (obj){
target = obj;
targetdistance = dist;
};
return (obj);
}
public function deinit(){
this.stop();
this.removeEventListener(MouseEvent.MOUSE_UP, toggleFireMenu);
this.removeEventListener(MouseEvent.MOUSE_OVER, showData);
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
private function toggleFireMenu(e){
if (gamemgr.stagePanel.selectfiremode.currentLabel == "shown"){
gamemgr.stagePanel.selectfiremode.gotoAndPlay("hide");
} else {
gamemgr.stagePanel.selectfiremode.gotoAndPlay("show");
};
}
private function attackMove(){
var t:*;
t = getTimer();
this.y = (stopy + (Math.sin((((t - createtime) / 3000) * Math.PI)) * 5));
}
private function showData(e=null){
gamemgr.setFocusObject(this);
}
public function reduceHealth(_obj){
var prevhealth:*;
if (_obj.damage > health){
health = 0;
gamemgr.stagePanel.mcplayerbasehealthbar.gotoAndStop(1);
gamemgr.stagePanel.mcplayerbasehealthbar.txt.text = "0";
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
} else {
prevhealth = health;
health = (health - _obj.damage);
gamemgr.stagePanel.mcplayerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mcplayerbasehealthbar.txt.text = Math.floor(health);
gamemgr.stageParticle.createParticle(_obj.typed, _obj.x, _obj.y, _obj.rotation);
if ((health / maxhealth) < 0.33){
if ((prevhealth / maxhealth) >= 0.33){
gamemgr.showMessage("Our base is in critical point");
gamemgr.sndMgr.playBGM("high");
};
};
};
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
private function moveWeaponAutomatic(){
var gunangle1:*;
var gunangle2:*;
gunangle1 = 90;
gunangle2 = 90;
target = getClosestEnemy();
if (((target) && ((targetdistance < 400)))){
gunangle1 = (180 - getAngle(new Point(((this.x + gun1.x) - 240), (this.y + gun1.y)), new Point((target.x - 240), target.y)));
gunangle2 = (180 - getAngle(new Point(((this.x + gun2.x) - 240), (this.y + gun2.y)), new Point((target.x - 240), target.y)));
};
gun1.rotation = gunangle1;
gun2.rotation = gunangle2;
}
private function moveWeaponManual(){
var gunangle1:*;
var gunangle2:*;
gunangle1 = (180 - getAngle(new Point(((this.x + gun1.x) - 240), (this.y + gun1.y)), new Point(gamemgr.mouseStageX, gamemgr.mouseStageY)));
gunangle2 = (180 - getAngle(new Point(((this.x + gun2.x) - 240), (this.y + gun2.y)), new Point(gamemgr.mouseStageX, gamemgr.mouseStageY)));
gun1.rotation = gunangle1;
gun2.rotation = gunangle2;
}
private function doAttack(){
if (gun1.mcgunfire.currentFrame == 2){
gun1.mcgunfire.gotoAndPlay(3);
gamemgr.stageParticle.createPlayerBullet("gunbullet", attack, (this.x + gun1.x), (this.y + gun1.y), gun1.rotation, this);
};
if (gun2.mcgunfire.currentFrame == 2){
gun2.mcgunfire.gotoAndPlay(3);
gamemgr.stageParticle.createPlayerBullet("gunbullet", attack, (this.x + gun2.x), (this.y + gun2.y), gun2.rotation, this);
};
}
public function moveClip(){
if (gamemgr.stagePanel.selectfiremode.currentFrame == gamemgr.stagePanel.selectfiremode.totalFrames){
firemode = gamemgr.stagePanel.selectfiremode.firemode;
};
if (unitstatus == "idle"){
idleMove();
if (firemode == "manual"){
moveWeaponManual();
if (gamemgr.mousePress){
doAttack();
};
} else {
if (firemode == "semi"){
moveWeaponManual();
target = getClosestEnemy();
if (((target) && ((targetdistance < 300)))){
doAttack();
};
} else {
if (firemode == "auto"){
moveWeaponAutomatic();
if (((target) && ((targetdistance < 250)))){
doAttack();
};
};
};
};
};
gamemgr.stagePanel.mcplayerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mcplayerbasehealthbar.txt.text = Math.floor(health);
}
public function reinit(){
this.play();
this.addEventListener(MouseEvent.MOUSE_UP, toggleFireMenu, false, 0, true);
this.addEventListener(MouseEvent.MOUSE_OVER, showData, false, 0, true);
}
private function idleMove(){
var t:*;
t = getTimer();
this.y = (stopy + (Math.sin((((t - createtime) / 3000) * Math.PI)) * 5));
}
}
}//package
Section 101
//GameManager (GameManager)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.filters.*;
public class GameManager extends MovieClip {
public var mouseScrollUp;// = false
public var mouseStageY;// = 240
public var stageScene;
private var focusObject;// = null
private var towerPosCapture;// = false
private var focusType;// = "Avenger"
public var mouseStageX;// = 240
private var focusSide;// = "Player"
public var gameStatus;// = "playing"
public var mousePress;// = false
private var stageScrollDown;// = false
public var gameData;
public var stageBackground;
public var stageTutor;// = null
private var unitQueueCountDown;// = 0
public var computerMgr;
public var stageOption;
private var zoomingLocked;// = false
public var repairing;// = false
private var focusTimer;// = 0
private var unitQueueTimer;
private var unitQueueNames;
private var stageScrollUp;// = false
public var myParent;
public var controlMgr;
public var mouseScrollDown;// = false
private var zoomingOut;// = false
public var stageParticle;
public var stagePanel;
private var repairtimer;// = 0
public var sndMgr;
public function GameManager(_myParent){
stageOption = new mc_optionpanel();
stageTutor = null;
stagePanel = new StagePanel();
stageScene = new SceneContainer();
stageParticle = new ParticleContainerBase();
mouseStageX = 240;
mouseStageY = 240;
mousePress = false;
mouseScrollUp = false;
mouseScrollDown = false;
zoomingOut = false;
zoomingLocked = false;
stageScrollUp = false;
stageScrollDown = false;
unitQueueNames = new Array();
unitQueueTimer = new Array();
unitQueueCountDown = 0;
focusTimer = 0;
focusObject = null;
focusSide = "Player";
focusType = "Avenger";
towerPosCapture = false;
gameStatus = "playing";
repairing = false;
repairtimer = 0;
super();
myParent = MovieClip(_myParent);
gameData = myParent.gameData;
sndMgr = myParent.sndMgr;
startGame();
}
public function stopScrollingUp(e=null){
stageScrollUp = false;
}
public function getTowerPosition2(e=null){
if (gameData.tower2Enabled()){
if ((stageScene.playerTowers.length + stageScene.playerCreateTowerType.length) < 4){
resetView();
stagePanel.towercreatepanel.gotoAndStop(1);
stagePanel.towercreatepanel.startCapture(2, stageScene.playerTowers, stageScene.playerCreateTowerPos);
towerPosCapture = true;
showMessage("Put your new tower");
showMessage("Press [ESC] to cancel");
} else {
showMessage("Maximum number of tower");
};
} else {
showMessage("Can't create tower");
};
}
public function getTowerPosition3(e=null){
if (gameData.tower3Enabled()){
if ((stageScene.playerTowers.length + stageScene.playerCreateTowerType.length) < 4){
resetView();
stagePanel.towercreatepanel.gotoAndStop(1);
stagePanel.towercreatepanel.startCapture(3, stageScene.playerTowers, stageScene.playerCreateTowerPos);
towerPosCapture = true;
showMessage("Put your new tower");
showMessage("Press [ESC] to cancel");
} else {
showMessage("Maximum number of tower");
};
} else {
showMessage("Can't create tower");
};
}
public function getTowerPosition4(e=null){
if (gameData.tower4Enabled()){
if ((stageScene.playerTowers.length + stageScene.playerCreateTowerType.length) < 4){
resetView();
stagePanel.towercreatepanel.gotoAndStop(1);
stagePanel.towercreatepanel.startCapture(4, stageScene.playerTowers, stageScene.playerCreateTowerPos);
towerPosCapture = true;
showMessage("Put your new tower");
showMessage("Press [ESC] to cancel");
} else {
showMessage("Maximum number of tower");
};
} else {
showMessage("Can't create tower");
};
}
public function getTowerPosition1(e=null){
if (gameData.tower1Enabled()){
if ((stageScene.playerTowers.length + stageScene.playerCreateTowerType.length) < 4){
resetView();
stagePanel.towercreatepanel.gotoAndStop(1);
stagePanel.towercreatepanel.startCapture(1, stageScene.playerTowers, stageScene.playerCreateTowerPos);
towerPosCapture = true;
showMessage("Put your new tower");
showMessage("Press [ESC] to cancel");
} else {
showMessage("Maximum number of tower");
};
} else {
showMessage("Can't create tower");
};
}
private function createPlayerUnit(_playertype){
var obj:*;
switch (_playertype){
default:
obj = new mc_character2();
obj.init("player", "fast");
break;
};
stageScene.addPlayerCharacter(obj);
}
private function checkNewTowerPos(){
var res:*;
res = gameData.towerEnabled((stagePanel.towercreatepanel.capturenum - 1));
if (stagePanel.towercreatepanel.capturestatus == "finish"){
if (res){
towerPosCapture = false;
gameData.gold = (gameData.gold - gameData.playertowerprice[(stagePanel.towercreatepanel.capturenum - 1)]);
stageScene.createPlayerTower(stagePanel.towercreatepanel.capturenum, new Point((stagePanel.towercreatepanel.mousepos.x + 240), stagePanel.towercreatepanel.mousepos.y), gameData.playertowercreatetimer[(stagePanel.towercreatepanel.capturenum - 1)]);
};
} else {
if (stagePanel.towercreatepanel.capturestatus == "cancel"){
showMessage("Create tower cancelled");
towerPosCapture = false;
} else {
if (!res){
showMessage("Can't create tower");
cancelNewTowerPos();
};
};
};
}
public function getTowerPosition5(e=null){
if (gameData.tower5Enabled()){
if ((stageScene.playerTowers.length + stageScene.playerCreateTowerType.length) < 4){
resetView();
stagePanel.towercreatepanel.gotoAndStop(1);
stagePanel.towercreatepanel.startCapture(5, stageScene.playerTowers, stageScene.playerCreateTowerPos);
towerPosCapture = true;
showMessage("Put your new tower");
showMessage("Press [ESC] to cancel");
} else {
showMessage("Maximum number of tower");
};
} else {
showMessage("Can't create tower");
};
}
public function stopZoomOut(){
zoomingOut = false;
}
private function resetGrayscale(){
this.filters = [];
}
private function stopEventHandlers(_pause=false){
this.removeEventListener(Event.ENTER_FRAME, moveClip);
if (_pause){
controlMgr.pauseListeners();
} else {
controlMgr.stopListeners();
};
stageScene.btzoomlock.removeEventListener(MouseEvent.MOUSE_UP, toggleZoomLock);
stagePanel.scrollup.removeEventListener(MouseEvent.MOUSE_OVER, startScrollingUp);
stagePanel.scrolldown.removeEventListener(MouseEvent.MOUSE_OVER, startScrollingDown);
stagePanel.scrollup.removeEventListener(MouseEvent.MOUSE_OUT, stopScrollingUp);
stagePanel.scrolldown.removeEventListener(MouseEvent.MOUSE_OUT, stopScrollingDown);
mousePress = false;
zoomingOut = false;
zoomingLocked = false;
stageScrollUp = false;
stageScrollDown = false;
resetPanels(_pause);
}
public function showMessage(_str=" "){
stagePanel.addNotes(_str);
}
private function showData(){
focusTimer++;
if ((focusTimer % 10) == 0){
if (focusObject){
stagePanel.panelnote.text = (((((focusType + focusSide) + "\nHealth : ") + Math.ceil(focusObject.health)) + "\nAttack : ") + Math.ceil(focusObject.attack));
if ((((focusTimer >= 90)) || ((focusObject.unitstatus == "destroyed")))){
focusTimer = 0;
focusObject = null;
};
} else {
stagePanel.panelnote.text = (((((("Level : " + gameData.selectedlevel) + "\n\nPlayer : ") + (stageScene.playerUnits.length + stageScene.playerTowers.length)) + " units\nComputer : ") + (stageScene.computerUnits.length + stageScene.computerTowers.length)) + " units");
};
};
}
public function pauseClip(e=null){
if (gameStatus == "playing"){
stopGame(true);
setGrayscale();
gameStatus = "paused";
if (stageTutor){
if (stageTutor.currentFrame != 1){
stageTutor.stop();
};
};
stageOption.showPanel();
} else {
if (gameStatus == "paused"){
continueGame();
resetGrayscale();
gameStatus = "playing";
if (stageTutor){
if (stageTutor.currentFrame != 1){
stageTutor.play();
};
};
stageOption.hidePanel();
zoomingLocked = false;
stageScene.btzoomlock.gotoAndStop(1);
};
};
}
private function goMoreGames(e=null){
myParent.gotoMoreGame();
}
public function setFocusObject(_obj){
if (_obj){
focusTimer = 0;
focusObject = _obj;
switch (focusObject.sided){
case "player":
focusSide = "Player Unit\n";
break;
case "computer":
focusSide = "Computer Unit\n";
break;
};
switch (focusObject.typed){
case "mainbase":
focusType = "Main Base\n";
break;
case "guntower":
focusType = "AAA Gun Tower\n";
break;
case "missiletower":
focusType = "SAM Rocket Tower\n";
break;
case "thundertower":
focusType = "Blue Corona Tower\n";
break;
case "emptower":
focusType = "EMP Generator Tower\n";
break;
case "plasmatower":
focusType = "Plasma Gun Tower\n";
break;
case "avenger":
focusType = "Avenger\n";
break;
case "secretstriker":
focusType = "Secret Striker\n";
break;
case "thunderbolt":
focusType = "Thunderbolt\n";
break;
case "defender":
focusType = "Defender\n";
break;
case "battlecruiser":
focusType = "Battlecruiser\n";
break;
case "valour":
focusType = "Valour\n";
break;
case "intrepid":
focusType = "Intrepid\n";
break;
case "excelsior":
focusType = "Excelsior\n";
break;
case "steamrunner":
focusType = "Steamrunner\n";
break;
case "ptolemy":
focusType = "Ptolemy\n";
break;
case "warhammer":
focusType = "Warhammer\n";
break;
case "vanguard":
focusType = "Vanguard\n";
break;
case "aircraftcarrier":
focusType = "Aircraft Carrier\n";
break;
};
};
}
public function quitGameRequest(e=null){
gameStatus = "stopplayerrequest";
stopClip();
}
public function stopClip(e=null){
stopGame();
setGrayscale();
switch (gameStatus){
case "stopplayerwin":
if (gameData.selectedlevel == 12){
myParent.gotoAndPlay("ultimatewinpage");
} else {
myParent.gotoAndPlay("winpage");
};
break;
case "stopplayerlost":
myParent.gotoAndPlay("lostpage");
break;
case "stopplayerrequest":
myParent.gotoAndPlay("abortpage");
break;
};
}
private function setGrayscale(){
var cm:ColorMatrix;
cm = new ColorMatrix();
cm.adjustColor(0, 0, -100, 0);
this.filters = [new ColorMatrixFilter(cm)];
}
private function resetView(){
stageScene.scaleX = 1;
stageScene.scaleY = 1;
stageScene.y = 0;
stageScene.x = -240;
stageBackground.scaleX = stageScene.scaleX;
stageBackground.scaleY = stageScene.scaleY;
stageBackground.y = stageScene.y;
stageBackground.x = stageScene.x;
stageParticle.scaleX = stageScene.scaleX;
stageParticle.scaleY = stageScene.scaleY;
stageParticle.y = stageScene.y;
stageParticle.x = stageScene.x;
}
public function continueClip(e=null){
if (gameStatus == "paused"){
gameStatus = "playing";
resetGrayscale();
continueGame();
if (stageTutor){
if (stageTutor.currentFrame != 1){
stageTutor.play();
};
};
stageOption.hidePanel();
zoomingLocked = false;
stageScene.btzoomlock.gotoAndStop(1);
};
}
public function queueUnit2(e=null){
if (gameData.unit2Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[1]);
unitQueueNames.push(gameData.playerunitname[1]);
unitQueueTimer.push(gameData.playerunitcreatetimer[1]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
public function queueUnit4(e=null){
if (gameData.unit4Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[3]);
unitQueueNames.push(gameData.playerunitname[3]);
unitQueueTimer.push(gameData.playerunitcreatetimer[3]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
public function queueUnit6(e=null){
if (gameData.unit6Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[5]);
unitQueueNames.push(gameData.playerunitname[5]);
unitQueueTimer.push(gameData.playerunitcreatetimer[5]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
public function queueUnit1(e=null){
if (gameData.unit1Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[0]);
unitQueueNames.push(gameData.playerunitname[0]);
unitQueueTimer.push(gameData.playerunitcreatetimer[0]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
public function queueUnit5(e=null){
if (gameData.unit5Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[4]);
unitQueueNames.push(gameData.playerunitname[4]);
unitQueueTimer.push(gameData.playerunitcreatetimer[4]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
public function queueUnit7(e=null){
if (gameData.unit7Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[6]);
unitQueueNames.push(gameData.playerunitname[6]);
unitQueueTimer.push(gameData.playerunitcreatetimer[6]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
private function refreshMouseScrolling(){
if (stageScene.scaleX == 1){
if (mouseScrollUp){
mouseScrollUp = false;
stageScene.y = (stageScene.y + 50);
if (stageScene.y > 0){
stageScene.y = 0;
};
};
if (mouseScrollDown){
mouseScrollDown = false;
stageScene.y = (stageScene.y - 50);
if (stageScene.y < -480){
stageScene.y = -480;
};
};
stageBackground.y = stageScene.y;
stageBackground.x = stageScene.x;
stageParticle.y = stageScene.y;
stageParticle.x = stageScene.x;
};
}
private function moveClip(e=null){
if (gameStatus == "playing"){
computerMgr.moveClip();
refreshUnitQueue();
if (repairing){
repairtimer++;
if (repairtimer > 5){
repairtimer = 0;
if ((((gameData.gold >= 2)) && ((stageScene.playerBaseMC.health < stageScene.playerBaseMC.maxhealth)))){
gameData.gold = (gameData.gold - 2);
stageScene.playerBaseMC.health++;
} else {
stagePanel.btupgrade5.repairlighter.gotoAndStop(1);
stageScene.playerBaseMC.mcrepair.gotoAndStop(2);
repairing = false;
};
};
};
detectHit();
stageScene.moveClip();
stageParticle.moveClip();
if (towerPosCapture){
checkNewTowerPos();
} else {
refreshZooming();
refreshMouseScrolling();
refreshScrolling();
};
refreshPanels();
showData();
recalculateGold();
if (stageScene.playerBaseMC.health <= 0){
gameStatus = "stopplayerlost";
} else {
if (stageScene.computerBaseMC.health <= 0){
gameStatus = "stopplayerwin";
};
};
} else {
if (gameStatus == "stopplayerlost"){
if (stageScene.scaleX < 1){
stageScene.scaleX = 1;
stageScene.scaleY = 1;
stageScene.x = -240;
stageScene.y = -240;
};
if (stageBackground.y < -5){
stageScene.y = (stageScene.y + 5);
} else {
stageScene.y = 0;
stopClip();
};
stageBackground.scaleX = stageScene.scaleX;
stageBackground.scaleY = stageScene.scaleY;
stageBackground.y = stageScene.y;
stageBackground.x = stageScene.x;
stageParticle.scaleX = stageScene.scaleX;
stageParticle.scaleY = stageScene.scaleY;
stageParticle.y = stageScene.y;
stageParticle.x = stageScene.x;
} else {
if (gameStatus == "stopplayerwin"){
if (stageScene.scaleX < 1){
stageScene.scaleX = 1;
stageScene.scaleY = 1;
stageScene.x = -240;
stageScene.y = -240;
};
if (stageScene.computerBaseMC.y > 720){
if (stageScene.y > -485){
stageScene.y = (stageScene.y - 5);
} else {
stageScene.y = -480;
stopClip();
};
} else {
if ((stageScene.y - stageScene.computerBaseMC.y) > -478){
stageScene.y = (stageScene.y - 2);
} else {
stopClip();
};
};
stageBackground.scaleX = stageScene.scaleX;
stageBackground.scaleY = stageScene.scaleY;
stageBackground.y = stageScene.y;
stageBackground.x = stageScene.x;
stageParticle.scaleX = stageScene.scaleX;
stageParticle.scaleY = stageScene.scaleY;
stageParticle.y = stageScene.y;
stageParticle.x = stageScene.x;
};
};
};
}
private function setSpecialNote2(e){
var s1:*;
var s2:*;
if (gameData.tower4Enabled()){
s1 = "Create EMP Generator \n";
s1 = (s1 + "Shortcut : [R]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[3])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[3])) + " \n"));
s2 = ("G " + gameData.playertowerprice[3]);
stagePanel.mcinfo.showNote(stagePanel.btspecial2, s1, s2);
} else {
if (gameData.unlockedspecial[1]){
s1 = "Create EMP Generator \n";
s1 = (s1 + "Shortcut : [R]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[3])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[3])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playertowerprice[3]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btspecial2, s1, s2);
};
};
}
private function setSpecialNote3(e){
var s1:*;
var s2:*;
if (gameData.tower5Enabled()){
s1 = "Create Plasma Tower \n";
s1 = (s1 + "Shortcut : [T]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[4])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[4])) + " \n"));
s2 = ("G " + gameData.playertowerprice[4]);
stagePanel.mcinfo.showNote(stagePanel.btspecial3, s1, s2);
} else {
if (gameData.unlockedspecial[2]){
s1 = "Create Plasma Tower \n";
s1 = (s1 + "Shortcut : [T]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[4])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[4])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playertowerprice[4]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btspecial3, s1, s2);
};
};
}
private function setSpecialNote1(e){
var s1:*;
var s2:*;
if (gameData.unit6Enabled()){
s1 = "Create Secret Striker \n";
s1 = (s1 + "Shortcut : [6]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[5])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[5])) + " \n"));
s2 = ("G " + gameData.playerunitprice[5]);
stagePanel.mcinfo.showNote(stagePanel.btspecial1, s1, s2);
} else {
if (gameData.unlockedspecial[0]){
s1 = "Create Secret Striker \n";
s1 = (s1 + "Shortcut : [6]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[5])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[5])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[5]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btspecial1, s1, s2);
};
};
}
private function setSpecialNote4(e){
var s1:*;
var s2:*;
if (gameData.unit7Enabled()){
s1 = "Create Aircraft Carrier \n";
s1 = (s1 + "Shortcut : [7]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[6])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[6])) + " \n"));
s2 = ("G " + gameData.playerunitprice[6]);
stagePanel.mcinfo.showNote(stagePanel.btspecial4, s1, s2);
} else {
if (gameData.unlockedspecial[3]){
s1 = "Create Aircraft Carrier \n";
s1 = (s1 + "Shortcut : [7]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[6])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[6])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[6]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btspecial4, s1, s2);
};
};
}
public function queueUnit3(e=null){
if (gameData.unit3Enabled()){
if (unitQueueNames.length < 5){
gameData.gold = (gameData.gold - gameData.playerunitprice[2]);
unitQueueNames.push(gameData.playerunitname[2]);
unitQueueTimer.push(gameData.playerunitcreatetimer[2]);
if (unitQueueTimer.length == 1){
unitQueueCountDown = unitQueueTimer[0];
};
} else {
showMessage("Max. unit queue number reached");
};
} else {
showMessage("Unit is not available");
};
}
public function startScrollingDown(e=null){
if (stageScene.scaleX == 1){
stageScrollUp = false;
stageScrollDown = true;
if (stagePanel.scrolldown.currentFrame == 1){
stagePanel.scrolldown.gotoAndPlay(2);
};
};
}
private function setCreateUnitNote3(e){
var s1:*;
var s2:*;
if (gameData.unit3Enabled()){
s1 = "Create Defender Unit\n";
s1 = (s1 + "Shortcut : [3]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[2])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[2])) + " \n"));
s2 = ("G " + gameData.playerunitprice[2]);
stagePanel.mcinfo.showNote(stagePanel.btcreateunit3, s1, s2);
} else {
if (gameData.unlockedplayerunit[2]){
s1 = "Create Defender Unit\n";
s1 = (s1 + "Shortcut : [3]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[2])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[2])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[2]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreateunit3, s1, s2);
};
};
}
private function setCreateUnitNote4(e){
var s1:*;
var s2:*;
if (gameData.unit4Enabled()){
s1 = "Create Battlecruiser Unit\n";
s1 = (s1 + "Shortcut : [4]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[3])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[3])) + " \n"));
s2 = ("G " + gameData.playerunitprice[3]);
stagePanel.mcinfo.showNote(stagePanel.btcreateunit4, s1, s2);
} else {
if (gameData.unlockedplayerunit[3]){
s1 = "Create Battlecruiser Unit\n";
s1 = (s1 + "Shortcut : [4]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[3])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[3])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[3]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreateunit4, s1, s2);
};
};
}
private function setCreateUnitNote5(e){
var s1:*;
var s2:*;
if (gameData.unit5Enabled()){
s1 = "Create Valour Unit\n";
s1 = (s1 + "Shortcut : [5]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[4])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[4])) + " \n"));
s2 = ("G " + gameData.playerunitprice[4]);
stagePanel.mcinfo.showNote(stagePanel.btcreateunit5, s1, s2);
} else {
if (gameData.unlockedplayerunit[4]){
s1 = "Create Valour Unit\n";
s1 = (s1 + "Shortcut : [5]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[4])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[4])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[4]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreateunit5, s1, s2);
};
};
}
private function setCreateUnitNote1(e){
var s1:*;
var s2:*;
if (gameData.unit1Enabled()){
s1 = "Create Avenger Unit\n";
s1 = (s1 + "Shortcut : [1]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[0])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[0])) + " \n"));
s2 = ("G " + gameData.playerunitprice[0]);
stagePanel.mcinfo.showNote(stagePanel.btcreateunit1, s1, s2);
} else {
if (gameData.unlockedplayerunit[0]){
s1 = "Create Avenger Unit\n";
s1 = (s1 + "Shortcut : [1]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[0])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[0])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[0]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreateunit1, s1, s2);
};
};
}
public function showSpecialEvent(n){
var s:*;
switch (n){
case 1:
s = "New Technology Achieved - Secret Striker";
stagePanel.addNotes(s, true);
stagePanel.blinker1.blink();
break;
case 2:
s = "New Technology Achieved - EMP Tower";
stagePanel.addNotes(s, true);
stagePanel.blinker2.blink();
break;
case 3:
s = "New Technology Achieved - Plasma Tower";
stagePanel.addNotes(s, true);
stagePanel.blinker3.blink();
break;
case 4:
s = "New Technology Achieved - Aircraft Carrier";
stagePanel.addNotes(s, true);
stagePanel.blinker4.blink();
break;
};
}
private function setCreateUnitNote2(e){
var s1:*;
var s2:*;
if (gameData.unit2Enabled()){
s1 = "Create Thunderbolt Unit\n";
s1 = (s1 + "Shortcut : [2]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[1])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[1])) + " \n"));
s2 = ("G " + gameData.playerunitprice[1]);
stagePanel.mcinfo.showNote(stagePanel.btcreateunit2, s1, s2);
} else {
if (gameData.unlockedplayerunit[1]){
s1 = "Create Thunderbolt Unit\n";
s1 = (s1 + "Shortcut : [2]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playerunithealth[1])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playerunitattack[1])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playerunitprice[1]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreateunit2, s1, s2);
};
};
}
private function toggleZoomLock(e=null){
if (zoomingLocked){
zoomingLocked = false;
stageScene.btzoomlock.gotoAndStop(1);
} else {
zoomingLocked = true;
stageScene.btzoomlock.gotoAndStop(2);
};
}
public function stopGame(_pause=false){
stopEventHandlers(_pause);
stageScene.deinit();
stageParticle.deinit();
sndMgr.stopSFX();
gameData.checkStopTime(getTimer());
}
private function resetPanels(_pause=false){
stagePanel.btquit.removeEventListener(MouseEvent.MOUSE_UP, quitGameRequest);
stagePanel.btmoregames.removeEventListener(MouseEvent.MOUSE_UP, goMoreGames);
if (!_pause){
stagePanel.btoptions.removeEventListener(MouseEvent.MOUSE_UP, pauseClip);
};
stagePanel.btcreateunit1.removeEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote1);
stagePanel.btcreateunit2.removeEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote2);
stagePanel.btcreateunit3.removeEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote3);
stagePanel.btcreateunit4.removeEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote4);
stagePanel.btcreateunit5.removeEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote5);
stagePanel.btspecial1.removeEventListener(MouseEvent.MOUSE_OVER, setSpecialNote1);
stagePanel.btspecial2.removeEventListener(MouseEvent.MOUSE_OVER, setSpecialNote2);
stagePanel.btspecial3.removeEventListener(MouseEvent.MOUSE_OVER, setSpecialNote3);
stagePanel.btspecial4.removeEventListener(MouseEvent.MOUSE_OVER, setSpecialNote4);
stagePanel.btcreatetower1.removeEventListener(MouseEvent.MOUSE_OVER, setCreateTowerNote1);
stagePanel.btcreatetower2.removeEventListener(MouseEvent.MOUSE_OVER, setCreateTowerNote2);
stagePanel.btcreatetower3.removeEventListener(MouseEvent.MOUSE_OVER, setCreateTowerNote3);
stagePanel.btupgrade1.removeEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote1);
stagePanel.btupgrade2.removeEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote2);
stagePanel.btupgrade3.removeEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote3);
stagePanel.btupgrade4.removeEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote4);
stagePanel.btupgrade5.removeEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote5);
stagePanel.btcreateunit1.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreateunit2.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreateunit3.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreateunit4.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreateunit5.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btspecial1.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btspecial2.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btspecial3.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btspecial4.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreatetower1.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreatetower2.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreatetower3.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btupgrade1.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btupgrade2.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btupgrade3.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btupgrade4.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btupgrade5.removeEventListener(MouseEvent.MOUSE_OUT, resetNote);
stagePanel.btcreateunit1.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit1);
stagePanel.btcreateunit2.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit2);
stagePanel.btcreateunit3.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit3);
stagePanel.btcreateunit4.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit4);
stagePanel.btcreateunit5.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit5);
stagePanel.btspecial1.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit6);
stagePanel.btspecial4.btactive.removeEventListener(MouseEvent.MOUSE_UP, queueUnit7);
stagePanel.unitsqueuer1.removeEventListener(MouseEvent.MOUSE_UP, dequeueUnit1);
stagePanel.unitsqueuer2.removeEventListener(MouseEvent.MOUSE_UP, dequeueUnit2);
stagePanel.unitsqueuer3.removeEventListener(MouseEvent.MOUSE_UP, dequeueUnit3);
stagePanel.unitsqueuer4.removeEventListener(MouseEvent.MOUSE_UP, dequeueUnit4);
stagePanel.unitsqueuer5.removeEventListener(MouseEvent.MOUSE_UP, dequeueUnit5);
stagePanel.btcreatetower1.btactive.removeEventListener(MouseEvent.MOUSE_UP, getTowerPosition1);
stagePanel.btcreatetower2.btactive.removeEventListener(MouseEvent.MOUSE_UP, getTowerPosition2);
stagePanel.btcreatetower3.btactive.removeEventListener(MouseEvent.MOUSE_UP, getTowerPosition3);
stagePanel.btspecial2.btactive.removeEventListener(MouseEvent.MOUSE_UP, getTowerPosition4);
stagePanel.btspecial3.btactive.removeEventListener(MouseEvent.MOUSE_UP, getTowerPosition5);
stagePanel.btupgrade1.btactive.removeEventListener(MouseEvent.MOUSE_UP, doUpgrade1);
stagePanel.btupgrade2.btactive.removeEventListener(MouseEvent.MOUSE_UP, doUpgrade2);
stagePanel.btupgrade3.btactive.removeEventListener(MouseEvent.MOUSE_UP, doUpgrade3);
stagePanel.btupgrade4.btactive.removeEventListener(MouseEvent.MOUSE_UP, doUpgrade4);
stagePanel.btupgrade5.btactive.removeEventListener(MouseEvent.MOUSE_UP, doUpgrade5);
}
public function showMap(){
stagePanel.minimap.toggleMinimap();
}
public function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
public function continueGame(){
startEventHandlers();
stageScene.reinit();
stageParticle.reinit();
}
public function doUpgrade3(e=null){
if (gameData.upgrade3Enabled()){
gameData.doUpgrade3();
} else {
showMessage("Upgrade is not available");
};
}
public function doUpgrade4(e=null){
if (gameData.upgrade4Enabled()){
gameData.doUpgrade4();
} else {
showMessage("Upgrade is not available");
};
}
public function doUpgrade5(e=null){
if (gameData.upgrade5Enabled(stageScene.playerBaseMC.health, stageScene.playerBaseMC.maxhealth)){
if (!repairing){
stagePanel.btupgrade5.repairlighter.gotoAndStop(2);
stageScene.playerBaseMC.mcrepair.gotoAndPlay(3);
repairing = true;
trace(stagePanel.btupgrade5.repairlighter.currentFrame);
} else {
stagePanel.btupgrade5.repairlighter.gotoAndStop(1);
stageScene.playerBaseMC.mcrepair.gotoAndStop(2);
repairing = false;
};
} else {
showMessage("Cannot repair base");
};
}
private function setUpgradeNote1(e){
var s1:*;
var s2:*;
if (gameData.upgrade1Enabled()){
s1 = "Upgrade Mainbase HP \n";
s1 = (s1 + "Shortcut : [A]\n\n");
s1 = (s1 + "Increase 20% health point for your Mainbase\n");
s2 = ("G " + gameData.getUpgradePrice(1));
} else {
s1 = "Upgrade Mainbase HP \n";
s1 = (s1 + "Shortcut : [A]\n\n");
if (gameData.upgradelevel[0] < 3){
s1 = (s1 + ("Price : G " + gameData.getUpgradePrice(1)));
s2 = "Not enough gold";
} else {
s2 = "Maximum Reached";
};
};
stagePanel.mcinfo.showNote(stagePanel.btupgrade1, s1, s2);
}
public function doUpgrade1(e=null){
if (gameData.upgrade1Enabled()){
gameData.doUpgrade1(stageScene.playerBaseMC);
} else {
showMessage("Upgrade is not available");
};
}
private function setUpgradeNote5(e){
var s1:*;
var s2:*;
if (gameData.upgrade5Enabled(stageScene.playerBaseMC.health, stageScene.playerBaseMC.maxhealth)){
s1 = "Repair Mainbase\n";
s1 = (s1 + "Shortcut : [G]\n\n");
s1 = (s1 + "We keep repairing even you are under attack");
s2 = ("G " + gameData.getUpgradePrice(5));
} else {
s1 = "Repair Mainbase\n";
s1 = (s1 + "Shortcut : [G]\n\n");
if (stageScene.playerBaseMC.health < 100){
s1 = (s1 + ("Price : G " + gameData.getUpgradePrice(5)));
s2 = "Not enough gold";
} else {
s2 = "Nothing to worry about";
};
};
stagePanel.mcinfo.showNote(stagePanel.btupgrade5, s1, s2);
}
private function setUpgradeNote3(e){
var s1:*;
var s2:*;
if (gameData.upgrade3Enabled()){
s1 = "Upgrade Units HP \n";
s1 = (s1 + "Shortcut : [D]\n\n");
s1 = (s1 + "Increased armor for newly created units\n");
s2 = ("G " + gameData.getUpgradePrice(3));
} else {
s1 = "Upgrade Units HP \n";
s1 = (s1 + "Shortcut : [D]\n\n");
if (gameData.upgradelevel[2] < 3){
s1 = (s1 + ("Price : G " + gameData.getUpgradePrice(3)));
s2 = "Not enough gold";
} else {
s2 = "Maximum Reached";
};
};
stagePanel.mcinfo.showNote(stagePanel.btupgrade3, s1, s2);
}
private function setUpgradeNote4(e){
var s1:*;
var s2:*;
if (gameData.upgrade4Enabled()){
s1 = "Upgrade Units Attack \n";
s1 = (s1 + "Shortcut : [F]\n\n");
s1 = (s1 + "Greater attack point for new units");
s2 = ("G " + gameData.getUpgradePrice(4));
} else {
s1 = "Upgrade Units Attack \n";
s1 = (s1 + "Shortcut : [F]\n\n");
if (gameData.upgradelevel[3] < 3){
s1 = (s1 + ("Price : G " + gameData.getUpgradePrice(4)));
s2 = "Not enough gold";
} else {
s2 = "Maximum Reached";
};
};
stagePanel.mcinfo.showNote(stagePanel.btupgrade4, s1, s2);
}
public function doUpgrade2(e=null){
if (gameData.unlockedplayertower[0]){
if (gameData.upgrade2Enabled()){
gameData.doUpgrade2();
} else {
showMessage("Money is not enough");
};
} else {
showMessage("Upgrade is not available");
};
}
private function refreshUnitQueue(){
var i:*;
if (unitQueueTimer.length > 0){
if (unitQueueCountDown > 0){
unitQueueCountDown--;
stagePanel.mcunitprogress.gotoAndStop((Math.floor((((unitQueueTimer[0] - unitQueueCountDown) / unitQueueTimer[0]) * 100)) + 1));
} else {
stageScene.createCharacter(unitQueueNames[0], "player");
unitQueueNames.splice(0, 1);
unitQueueTimer.splice(0, 1);
stagePanel.mcunitprogress.gotoAndStop(1);
if (unitQueueTimer.length > 0){
unitQueueCountDown = unitQueueTimer[0];
};
};
if (unitQueueNames.length > 0){
stagePanel.unitsqueuer1.gotoAndStop(unitQueueNames[0]);
} else {
stagePanel.unitsqueuer1.gotoAndStop(1);
};
if (unitQueueNames.length > 1){
stagePanel.unitsqueuer2.gotoAndStop(unitQueueNames[1]);
} else {
stagePanel.unitsqueuer2.gotoAndStop(1);
};
if (unitQueueNames.length > 2){
stagePanel.unitsqueuer3.gotoAndStop(unitQueueNames[2]);
} else {
stagePanel.unitsqueuer3.gotoAndStop(1);
};
if (unitQueueNames.length > 3){
stagePanel.unitsqueuer4.gotoAndStop(unitQueueNames[3]);
} else {
stagePanel.unitsqueuer4.gotoAndStop(1);
};
if (unitQueueNames.length > 4){
stagePanel.unitsqueuer5.gotoAndStop(unitQueueNames[4]);
} else {
stagePanel.unitsqueuer5.gotoAndStop(1);
};
} else {
stagePanel.mcunitprogress.gotoAndStop(1);
stagePanel.unitsqueuer1.gotoAndStop(1);
stagePanel.unitsqueuer2.gotoAndStop(1);
stagePanel.unitsqueuer3.gotoAndStop(1);
stagePanel.unitsqueuer4.gotoAndStop(1);
stagePanel.unitsqueuer5.gotoAndStop(1);
};
}
private function setUpgradeNote2(e){
var s1:*;
var s2:*;
if (gameData.unlockedplayertower[0]){
if (gameData.upgrade2Enabled()){
s1 = "Upgrade Tower HP \n";
s1 = (s1 + "Shortcut : [S]\n\n");
s1 = (s1 + "Increased armor for newly created towers");
s2 = ("G " + gameData.getUpgradePrice(2));
} else {
s1 = "Upgrade Tower HP \n";
s1 = (s1 + "Shortcut : [S]\n\n");
if (gameData.upgradelevel[1] < 3){
s1 = (s1 + ("Price : G " + gameData.getUpgradePrice(2)));
s2 = "Not enough gold";
} else {
s2 = "Maximum Reached";
};
};
} else {
s1 = "Upgrade Tower HP \n";
s2 = "Tower is unavailable";
};
stagePanel.mcinfo.showNote(stagePanel.btupgrade2, s1, s2);
}
public function reduceHealth(_tgt, _obj){
if (_tgt){
_tgt.reduceHealth(_obj);
};
}
public function stopScrollingDown(e=null){
stageScrollDown = false;
}
private function refreshScrolling(){
if (stageScene.scaleX == 1){
if (stageScrollUp){
stageScene.y = (stageScene.y + 10);
if (stageScene.y > 0){
stageScene.y = 0;
};
};
if (stageScrollDown){
stageScene.y = (stageScene.y - 10);
if (stageScene.y < -480){
stageScene.y = -480;
};
};
stageBackground.y = stageScene.y;
stageBackground.x = stageScene.x;
stageParticle.y = stageScene.y;
stageParticle.x = stageScene.x;
};
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
public function cancelNewTowerPos(e=null){
showMessage("Create tower cancelled");
stagePanel.towercreatepanel.cancelCreate();
}
public function startGame(){
switch (gameData.selectedlevel){
case 1:
case 2:
case 3:
case 4:
stageBackground = new mc_background1();
break;
case 5:
case 6:
case 7:
case 8:
stageBackground = new mc_background2();
break;
case 9:
case 10:
case 11:
case 12:
stageBackground = new mc_background3();
break;
};
this.addChild(stageBackground);
this.addChild(stageScene);
stageScene.init();
this.addChild(stageParticle);
stageParticle.init();
this.addChild(stagePanel);
if ((((gameData.selectedlevel == 1)) && ((gameData.unitkilledtotal[0] == 0)))){
stageTutor = new stageTutorial();
this.addChild(stageTutor);
stageTutor.showTutorial1();
} else {
if ((((gameData.selectedlevel == 2)) && ((gameData.unitkilledtotal[1] == 0)))){
stageTutor = new stageTutorial();
this.addChild(stageTutor);
stageTutor.showTutorial2();
};
};
stageOption.x = 240;
stageOption.y = 240;
this.addChild(stageOption);
controlMgr = new ControlManager(this);
computerMgr = new ComputerManager(this);
myParent.addChild(this);
mousePress = false;
zoomingOut = false;
zoomingLocked = false;
stageScrollUp = false;
stageScrollDown = false;
startEventHandlers();
sndMgr.playBGM("low");
gameStatus = "playing";
showMessage("HQ Connected...");
switch (gameData.selectedlevel){
case 1:
showMessage("Ghardala, November AD 2569");
break;
case 2:
showMessage("New Memphis, November AD 2569");
break;
case 3:
showMessage("Roswell, December AD 2569");
break;
case 4:
showMessage("Santiago, January AD 2570");
break;
case 5:
showMessage("Calabozo, January AD 2570");
break;
case 6:
showMessage("Chengdu, January AD 2570");
break;
case 7:
showMessage("Samarqand, February AD 2570");
break;
case 8:
showMessage("Shiraj, February AD 2570");
break;
case 9:
showMessage("Elazig, March AD 2570");
break;
case 10:
showMessage("Zaporizhzhia, March AD 2570");
break;
case 11:
showMessage("Valence, April AD 2570");
break;
case 12:
showMessage("Antioch, May AD 2570");
break;
};
gameData.checkStartTime(getTimer());
}
public function createEnemyUnit(_enemytype){
var obj:*;
switch (_enemytype){
default:
obj = new mc_character2();
obj.init("computer", "fast");
break;
};
stageScene.addComputerCharacter(obj);
}
private function setCreateTowerNote2(e){
var s1:*;
var s2:*;
if (gameData.tower2Enabled()){
s1 = "Create SAM Tower \n";
s1 = (s1 + "Shortcut : [W]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[1])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[1])) + " \n"));
s2 = ("G " + gameData.playertowerprice[1]);
stagePanel.mcinfo.showNote(stagePanel.btcreatetower2, s1, s2);
} else {
if (gameData.unlockedplayertower[1]){
s1 = "Create SAM Tower \n";
s1 = (s1 + "Shortcut : [W]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[1])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[1])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playertowerprice[1]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreatetower2, s1, s2);
};
};
}
private function recalculateGold(){
gameData.gold = (gameData.gold + gameData.interest);
if (gameData.gold > 99999){
gameData.gold = 99999;
};
stagePanel.mcgoldbar.txt.text = ("G " + Math.floor(gameData.gold));
}
private function setCreateTowerNote3(e){
var s1:*;
var s2:*;
if (gameData.tower3Enabled()){
s1 = "Create Corona Tower \n";
s1 = (s1 + "Shortcut : [W]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[2])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[2])) + " \n"));
s2 = ("G " + gameData.playertowerprice[2]);
stagePanel.mcinfo.showNote(stagePanel.btcreatetower3, s1, s2);
} else {
if (gameData.unlockedplayertower[2]){
s1 = "Create Corona Tower \n";
s1 = (s1 + "Shortcut : [W]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[2])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[2])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playertowerprice[2]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreatetower3, s1, s2);
};
};
}
private function refreshPanels(){
if (!gameData.unit1Enabled()){
if (gameData.unlockedplayerunit[0]){
stagePanel.btcreateunit1.gotoAndStop(2);
} else {
stagePanel.btcreateunit1.gotoAndStop(1);
};
} else {
stagePanel.btcreateunit1.gotoAndStop(3);
};
if (!gameData.unit2Enabled()){
if (gameData.unlockedplayerunit[1]){
stagePanel.btcreateunit2.gotoAndStop(2);
} else {
stagePanel.btcreateunit2.gotoAndStop(1);
};
} else {
stagePanel.btcreateunit2.gotoAndStop(3);
};
if (!gameData.unit3Enabled()){
if (gameData.unlockedplayerunit[2]){
stagePanel.btcreateunit3.gotoAndStop(2);
} else {
stagePanel.btcreateunit3.gotoAndStop(1);
};
} else {
stagePanel.btcreateunit3.gotoAndStop(3);
};
if (!gameData.unit4Enabled()){
if (gameData.unlockedplayerunit[3]){
stagePanel.btcreateunit4.gotoAndStop(2);
} else {
stagePanel.btcreateunit4.gotoAndStop(1);
};
} else {
stagePanel.btcreateunit4.gotoAndStop(3);
};
if (!gameData.unit5Enabled()){
if (gameData.unlockedplayerunit[4]){
stagePanel.btcreateunit5.gotoAndStop(2);
} else {
stagePanel.btcreateunit5.gotoAndStop(1);
};
} else {
stagePanel.btcreateunit5.gotoAndStop(3);
};
if (!gameData.unit6Enabled()){
if (gameData.unlockedspecial[0]){
stagePanel.btspecial1.gotoAndStop(2);
} else {
stagePanel.btspecial1.gotoAndStop(1);
};
} else {
stagePanel.btspecial1.gotoAndStop(3);
};
if (!gameData.tower4Enabled()){
if (gameData.unlockedspecial[1]){
stagePanel.btspecial2.gotoAndStop(2);
} else {
stagePanel.btspecial2.gotoAndStop(1);
};
} else {
stagePanel.btspecial2.gotoAndStop(3);
};
if (!gameData.tower5Enabled()){
if (gameData.unlockedspecial[2]){
stagePanel.btspecial3.gotoAndStop(2);
} else {
stagePanel.btspecial3.gotoAndStop(1);
};
} else {
stagePanel.btspecial3.gotoAndStop(3);
};
if (!gameData.unit7Enabled()){
if (gameData.unlockedspecial[3]){
stagePanel.btspecial4.gotoAndStop(2);
} else {
stagePanel.btspecial4.gotoAndStop(1);
};
} else {
stagePanel.btspecial4.gotoAndStop(3);
};
if (!gameData.tower1Enabled()){
if (gameData.unlockedplayertower[0]){
stagePanel.btcreatetower1.gotoAndStop(2);
} else {
stagePanel.btcreatetower1.gotoAndStop(1);
};
} else {
stagePanel.btcreatetower1.gotoAndStop(3);
};
if (!gameData.tower2Enabled()){
if (gameData.unlockedplayertower[1]){
stagePanel.btcreatetower2.gotoAndStop(2);
} else {
stagePanel.btcreatetower2.gotoAndStop(1);
};
} else {
stagePanel.btcreatetower2.gotoAndStop(3);
};
if (!gameData.tower3Enabled()){
if (gameData.unlockedplayertower[2]){
stagePanel.btcreatetower3.gotoAndStop(2);
} else {
stagePanel.btcreatetower3.gotoAndStop(1);
};
} else {
stagePanel.btcreatetower3.gotoAndStop(3);
};
if (!gameData.upgrade1Enabled()){
stagePanel.btupgrade1.gotoAndStop(1);
} else {
stagePanel.btupgrade1.gotoAndStop(2);
};
if (gameData.unlockedplayertower[0]){
if (!gameData.upgrade2Enabled()){
stagePanel.btupgrade2.gotoAndStop(1);
} else {
stagePanel.btupgrade2.gotoAndStop(2);
};
} else {
stagePanel.btupgrade2.gotoAndStop(1);
};
if (!gameData.upgrade3Enabled()){
stagePanel.btupgrade3.gotoAndStop(1);
} else {
stagePanel.btupgrade3.gotoAndStop(2);
};
if (!gameData.upgrade4Enabled()){
stagePanel.btupgrade4.gotoAndStop(1);
} else {
stagePanel.btupgrade4.gotoAndStop(2);
};
if (!gameData.upgrade5Enabled(stageScene.playerBaseMC.health, stageScene.playerBaseMC.maxhealth)){
stagePanel.btupgrade5.gotoAndStop(1);
} else {
stagePanel.btupgrade5.gotoAndStop(2);
};
}
private function setCreateTowerNote1(e){
var s1:*;
var s2:*;
if (gameData.tower1Enabled()){
s1 = "Create AAA Cannon \n";
s1 = (s1 + "Shortcut : [Q]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[0])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[0])) + " \n"));
s2 = ("G " + gameData.playertowerprice[0]);
stagePanel.mcinfo.showNote(stagePanel.btcreatetower1, s1, s2);
} else {
if (gameData.unlockedplayertower[0]){
s1 = "Create AAA Cannon \n";
s1 = (s1 + "Shortcut : [Q]\n");
s1 = (s1 + (("Health : " + Math.floor(gameData.playertowerhealth[0])) + " \n"));
s1 = (s1 + (("Attack : " + Math.floor(gameData.playertowerattack[0])) + " \n"));
s1 = (s1 + ("Price : G " + gameData.playertowerprice[0]));
s2 = "Not enough gold";
stagePanel.mcinfo.showNote(stagePanel.btcreatetower1, s1, s2);
};
};
}
public function startScrollingUp(e=null){
if (stageScene.scaleX == 1){
stageScrollUp = true;
stageScrollDown = false;
if (stagePanel.scrollup.currentFrame == 1){
stagePanel.scrollup.gotoAndPlay(2);
};
};
}
public function startZoomOut(){
if (!zoomingLocked){
zoomingOut = true;
};
}
private function refreshZooming(){
if (!zoomingLocked){
if (zoomingOut){
if (stageScene.scaleX > 0.5){
stageScene.scaleX = (stageScene.scaleX - 0.025);
stageScene.scaleY = (stageScene.scaleY - 0.025);
stageScrollUp = false;
stageScrollDown = false;
stageScene.y = 0;
stageScene.x = (stageScene.x + 12);
} else {
stageScene.scaleX = 0.5;
stageScene.scaleY = 0.5;
stageScrollUp = false;
stageScrollDown = false;
stageScene.y = 0;
stageScene.x = 0;
};
} else {
if (stageScene.scaleX < 1){
stageScene.scaleX = (stageScene.scaleX + 0.025);
stageScene.scaleY = (stageScene.scaleY + 0.025);
stageScrollUp = false;
stageScrollDown = false;
stageScene.y = 0;
stageScene.x = (stageScene.x - 12);
} else {
stageScene.scaleX = 1;
stageScene.scaleY = 1;
stageScene.x = ((-1 * stageScene.width) / 4);
};
};
} else {
stageScene.scaleX = 0.5;
stageScene.scaleY = 0.5;
stageScrollUp = false;
stageScrollDown = false;
stageScene.y = 0;
stageScene.x = 0;
};
stageBackground.scaleX = stageScene.scaleX;
stageBackground.scaleY = stageScene.scaleY;
stageBackground.y = stageScene.y;
stageBackground.x = stageScene.x;
stageParticle.scaleX = stageScene.scaleX;
stageParticle.scaleY = stageScene.scaleY;
stageParticle.y = stageScene.y;
stageParticle.x = stageScene.x;
}
public function dequeueUnit1(e=null){
if (unitQueueTimer.length > 0){
showMessage("Unit queue cancelled");
switch (unitQueueNames[0]){
case "avenger":
gameData.gold = (gameData.gold + gameData.playerunitprice[0]);
break;
case "thunderbolt":
gameData.gold = (gameData.gold + gameData.playerunitprice[1]);
break;
case "defender":
gameData.gold = (gameData.gold + gameData.playerunitprice[2]);
break;
case "battlecruiser":
gameData.gold = (gameData.gold + gameData.playerunitprice[3]);
break;
case "valour":
gameData.gold = (gameData.gold + gameData.playerunitprice[4]);
break;
case "secretstriker":
gameData.gold = (gameData.gold + gameData.playerunitprice[5]);
break;
case "aircraftcarrier":
gameData.gold = (gameData.gold + gameData.playerunitprice[6]);
break;
};
unitQueueNames.splice(0, 1);
unitQueueTimer.splice(0, 1);
if (unitQueueTimer.length > 0){
unitQueueCountDown = unitQueueTimer[0];
} else {
unitQueueCountDown = 0;
};
};
}
public function dequeueUnit4(e=null){
if (unitQueueTimer.length > 0){
showMessage("Unit queue cancelled");
switch (unitQueueNames[3]){
case "avenger":
gameData.gold = (gameData.gold + gameData.playerunitprice[0]);
break;
case "thunderbolt":
gameData.gold = (gameData.gold + gameData.playerunitprice[1]);
break;
case "defender":
gameData.gold = (gameData.gold + gameData.playerunitprice[2]);
break;
case "battlecruiser":
gameData.gold = (gameData.gold + gameData.playerunitprice[3]);
break;
case "valour":
gameData.gold = (gameData.gold + gameData.playerunitprice[4]);
break;
case "secretstriker":
gameData.gold = (gameData.gold + gameData.playerunitprice[5]);
break;
case "aircraftcarrier":
gameData.gold = (gameData.gold + gameData.playerunitprice[6]);
break;
};
unitQueueNames.splice(3, 1);
unitQueueTimer.splice(3, 1);
};
}
private function startEventHandlers(){
this.addEventListener(Event.ENTER_FRAME, moveClip, false, 0, true);
controlMgr.startListeners();
stageScene.btzoomlock.addEventListener(MouseEvent.MOUSE_UP, toggleZoomLock, false, 0, true);
stagePanel.scrollup.addEventListener(MouseEvent.MOUSE_OVER, startScrollingUp, false, 0, true);
stagePanel.scrolldown.addEventListener(MouseEvent.MOUSE_OVER, startScrollingDown, false, 0, true);
stagePanel.scrollup.addEventListener(MouseEvent.MOUSE_OUT, stopScrollingUp, false, 0, true);
stagePanel.scrolldown.addEventListener(MouseEvent.MOUSE_OUT, stopScrollingDown, false, 0, true);
setPanels();
}
public function dequeueUnit2(e=null){
if (unitQueueTimer.length > 1){
showMessage("Unit queue cancelled");
switch (unitQueueNames[1]){
case "avenger":
gameData.gold = (gameData.gold + gameData.playerunitprice[0]);
break;
case "thunderbolt":
gameData.gold = (gameData.gold + gameData.playerunitprice[1]);
break;
case "defender":
gameData.gold = (gameData.gold + gameData.playerunitprice[2]);
break;
case "battlecruiser":
gameData.gold = (gameData.gold + gameData.playerunitprice[3]);
break;
case "valour":
gameData.gold = (gameData.gold + gameData.playerunitprice[4]);
break;
case "secretstriker":
gameData.gold = (gameData.gold + gameData.playerunitprice[5]);
break;
case "aircraftcarrier":
gameData.gold = (gameData.gold + gameData.playerunitprice[6]);
break;
};
unitQueueNames.splice(1, 1);
unitQueueTimer.splice(1, 1);
};
}
public function dequeueUnit3(e=null){
if (unitQueueTimer.length > 2){
showMessage("Unit queue cancelled");
switch (unitQueueNames[2]){
case "avenger":
gameData.gold = (gameData.gold + gameData.playerunitprice[0]);
break;
case "thunderbolt":
gameData.gold = (gameData.gold + gameData.playerunitprice[1]);
break;
case "defender":
gameData.gold = (gameData.gold + gameData.playerunitprice[2]);
break;
case "battlecruiser":
gameData.gold = (gameData.gold + gameData.playerunitprice[3]);
break;
case "valour":
gameData.gold = (gameData.gold + gameData.playerunitprice[4]);
break;
case "secretstriker":
gameData.gold = (gameData.gold + gameData.playerunitprice[5]);
break;
case "aircraftcarrier":
gameData.gold = (gameData.gold + gameData.playerunitprice[6]);
break;
};
unitQueueNames.splice(2, 1);
unitQueueTimer.splice(2, 1);
};
}
public function dequeueUnit5(e=null){
if (unitQueueTimer.length > 4){
showMessage("Unit queue cancelled");
switch (unitQueueNames[4]){
case "avenger":
gameData.gold = (gameData.gold + gameData.playerunitprice[0]);
break;
case "thunderbolt":
gameData.gold = (gameData.gold + gameData.playerunitprice[1]);
break;
case "defender":
gameData.gold = (gameData.gold + gameData.playerunitprice[2]);
break;
case "battlecruiser":
gameData.gold = (gameData.gold + gameData.playerunitprice[3]);
break;
case "valour":
gameData.gold = (gameData.gold + gameData.playerunitprice[4]);
break;
case "secretstriker":
gameData.gold = (gameData.gold + gameData.playerunitprice[5]);
break;
case "aircraftcarrier":
gameData.gold = (gameData.gold + gameData.playerunitprice[6]);
break;
};
unitQueueNames.splice(4, 1);
unitQueueTimer.splice(4, 1);
};
}
private function detectHit(){
var i:*;
var j:*;
i = (stageScene.playerUnits.length - 1);
while (i >= 0) {
j = (stageParticle.computerBullets.length - 1);
while (j >= 0) {
if (getDistance(stageScene.playerUnits[i], stageParticle.computerBullets[j]) < (stageScene.playerUnits[i].height * 0.5)){
stageScene.playerUnits[i].reduceHealth(stageParticle.computerBullets[j]);
stageParticle.computerBullets[j].gotoAndStop("destroyed");
};
j--;
};
i--;
};
i = (stageScene.playerTowers.length - 1);
while (i >= 0) {
j = (stageParticle.computerBullets.length - 1);
while (j >= 0) {
if (getDistance(stageScene.playerTowers[i], stageParticle.computerBullets[j]) < (stageScene.playerTowers[i].height * 0.5)){
stageScene.playerTowers[i].reduceHealth(stageParticle.computerBullets[j]);
stageParticle.computerBullets[j].gotoAndStop("destroyed");
};
j--;
};
i--;
};
i = (stageScene.computerUnits.length - 1);
while (i >= 0) {
j = (stageParticle.playerBullets.length - 1);
while (j >= 0) {
if (getDistance(stageScene.computerUnits[i], stageParticle.playerBullets[j]) < (stageScene.computerUnits[i].height * 0.5)){
stageScene.computerUnits[i].reduceHealth(stageParticle.playerBullets[j]);
stageParticle.playerBullets[j].gotoAndStop("destroyed");
};
j--;
};
i--;
};
i = (stageScene.computerTowers.length - 1);
while (i >= 0) {
j = (stageParticle.playerBullets.length - 1);
while (j >= 0) {
if (getDistance(stageScene.computerTowers[i], stageParticle.playerBullets[j]) < (stageScene.computerTowers[i].height * 0.5)){
stageScene.computerTowers[i].reduceHealth(stageParticle.playerBullets[j]);
stageParticle.playerBullets[j].gotoAndStop("destroyed");
};
j--;
};
i--;
};
j = (stageParticle.computerBullets.length - 1);
while (j >= 0) {
if (getDistance(stageScene.playerBaseMC, stageParticle.computerBullets[j]) < (stageScene.playerBaseMC.height * 0.5)){
stageScene.playerBaseMC.reduceHealth(stageParticle.computerBullets[j]);
stageParticle.computerBullets[j].gotoAndStop("destroyed");
};
j--;
};
j = (stageParticle.playerBullets.length - 1);
while (j >= 0) {
if (stageParticle.playerBullets[j].typed != "dropbombbullet"){
if (getDistance(stageScene.computerBaseMC, stageParticle.playerBullets[j]) < (stageScene.computerBaseMC.height * 0.5)){
stageScene.computerBaseMC.reduceHealth(stageParticle.playerBullets[j]);
stageParticle.playerBullets[j].gotoAndStop("destroyed");
};
} else {
if (stageParticle.playerBullets[j].currentLabel == "destroyed"){
stageScene.computerBaseMC.reduceHealth(stageParticle.playerBullets[j]);
};
};
j--;
};
}
private function setPanels(){
stagePanel.btquit.addEventListener(MouseEvent.MOUSE_UP, quitGameRequest, false, 0, true);
stagePanel.btmoregames.addEventListener(MouseEvent.MOUSE_UP, goMoreGames, false, 0, true);
stagePanel.btoptions.addEventListener(MouseEvent.MOUSE_UP, pauseClip, false, 0, true);
stagePanel.btcreateunit1.addEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote1, false, 0, true);
stagePanel.btcreateunit2.addEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote2, false, 0, true);
stagePanel.btcreateunit3.addEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote3, false, 0, true);
stagePanel.btcreateunit4.addEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote4, false, 0, true);
stagePanel.btcreateunit5.addEventListener(MouseEvent.MOUSE_OVER, setCreateUnitNote5, false, 0, true);
stagePanel.btspecial1.addEventListener(MouseEvent.MOUSE_OVER, setSpecialNote1, false, 0, true);
stagePanel.btspecial2.addEventListener(MouseEvent.MOUSE_OVER, setSpecialNote2, false, 0, true);
stagePanel.btspecial3.addEventListener(MouseEvent.MOUSE_OVER, setSpecialNote3, false, 0, true);
stagePanel.btspecial4.addEventListener(MouseEvent.MOUSE_OVER, setSpecialNote4, false, 0, true);
stagePanel.btcreatetower1.addEventListener(MouseEvent.MOUSE_OVER, setCreateTowerNote1, false, 0, true);
stagePanel.btcreatetower2.addEventListener(MouseEvent.MOUSE_OVER, setCreateTowerNote2, false, 0, true);
stagePanel.btcreatetower3.addEventListener(MouseEvent.MOUSE_OVER, setCreateTowerNote3, false, 0, true);
stagePanel.btupgrade1.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote1, false, 0, true);
stagePanel.btupgrade2.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote2, false, 0, true);
stagePanel.btupgrade3.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote3, false, 0, true);
stagePanel.btupgrade4.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote4, false, 0, true);
stagePanel.btupgrade5.addEventListener(MouseEvent.MOUSE_OVER, setUpgradeNote5, false, 0, true);
stagePanel.btcreateunit1.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreateunit2.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreateunit3.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreateunit4.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreateunit5.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btspecial1.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btspecial2.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btspecial3.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btspecial4.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreatetower1.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreatetower2.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreatetower3.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btupgrade1.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btupgrade2.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btupgrade3.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btupgrade4.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btupgrade5.addEventListener(MouseEvent.MOUSE_OUT, resetNote, false, 0, true);
stagePanel.btcreateunit1.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit1, false, 0, true);
stagePanel.btcreateunit2.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit2, false, 0, true);
stagePanel.btcreateunit3.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit3, false, 0, true);
stagePanel.btcreateunit4.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit4, false, 0, true);
stagePanel.btcreateunit5.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit5, false, 0, true);
stagePanel.btspecial1.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit6, false, 0, true);
stagePanel.btspecial4.btactive.addEventListener(MouseEvent.MOUSE_UP, queueUnit7, false, 0, true);
stagePanel.unitsqueuer1.addEventListener(MouseEvent.MOUSE_UP, dequeueUnit1, false, 0, true);
stagePanel.unitsqueuer2.addEventListener(MouseEvent.MOUSE_UP, dequeueUnit2, false, 0, true);
stagePanel.unitsqueuer3.addEventListener(MouseEvent.MOUSE_UP, dequeueUnit3, false, 0, true);
stagePanel.unitsqueuer4.addEventListener(MouseEvent.MOUSE_UP, dequeueUnit4, false, 0, true);
stagePanel.unitsqueuer5.addEventListener(MouseEvent.MOUSE_UP, dequeueUnit5, false, 0, true);
stagePanel.btcreatetower1.btactive.addEventListener(MouseEvent.MOUSE_UP, getTowerPosition1, false, 0, true);
stagePanel.btcreatetower2.btactive.addEventListener(MouseEvent.MOUSE_UP, getTowerPosition2, false, 0, true);
stagePanel.btcreatetower3.btactive.addEventListener(MouseEvent.MOUSE_UP, getTowerPosition3, false, 0, true);
stagePanel.btspecial2.btactive.addEventListener(MouseEvent.MOUSE_UP, getTowerPosition4, false, 0, true);
stagePanel.btspecial3.btactive.addEventListener(MouseEvent.MOUSE_UP, getTowerPosition5, false, 0, true);
stagePanel.btupgrade1.btactive.addEventListener(MouseEvent.MOUSE_UP, doUpgrade1, false, 0, true);
stagePanel.btupgrade2.btactive.addEventListener(MouseEvent.MOUSE_UP, doUpgrade2, false, 0, true);
stagePanel.btupgrade3.btactive.addEventListener(MouseEvent.MOUSE_UP, doUpgrade3, false, 0, true);
stagePanel.btupgrade4.btactive.addEventListener(MouseEvent.MOUSE_UP, doUpgrade4, false, 0, true);
stagePanel.btupgrade5.btactive.addEventListener(MouseEvent.MOUSE_UP, doUpgrade5, false, 0, true);
}
private function resetNote(e){
stagePanel.mcinfo.hideNote();
}
}
}//package
Section 102
//LandBaseObjectBase (LandBaseObjectBase)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class LandBaseObjectBase extends MovieClip {
public var sided;// = "computer"
public var gun3:MovieClip;
private var repairtimer;// = 0
public var maxhealth;
private var plasmatimer;// = 0
public var attack;
public var health;
public var typed;// = "mainbase"
private var unitstatus;// = "idle"
private var target;
private var targetdistance;
private var attackstatus;// = "normal"
private var stopy;
public var mcrepair:MovieClip;
private var createtime;
private var thisparent;
private var gamemgr;
private var missiletimer;// = 0
public var gun1:MovieClip;
public var gun2:MovieClip;
public function LandBaseObjectBase(){
sided = "computer";
typed = "mainbase";
unitstatus = "idle";
plasmatimer = 0;
missiletimer = 0;
repairtimer = 0;
attackstatus = "normal";
super();
}
public function repairBase(){
if (mcrepair.currentFrame == 2){
mcrepair.gotoAndPlay(3);
};
repairtimer++;
if (repairtimer > 5){
repairtimer = 0;
health = (health + 25);
if (health > maxhealth){
health = maxhealth;
};
gamemgr.stagePanel.mccomputerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mccomputerbasehealthbar.txt.text = Math.floor(health);
};
}
public function init(){
thisparent = this.parent;
gamemgr = thisparent.myParent;
health = gamemgr.gameData.computermainbasehealth;
attack = gamemgr.gameData.computermainbaseattack;
maxhealth = health;
gamemgr.stagePanel.mccomputerbasehealthbar.gotoAndStop(101);
gamemgr.stagePanel.mccomputerbasehealthbar.txt.text = Math.floor(health);
this.cacheAsBitmap = true;
this.addEventListener(MouseEvent.MOUSE_OVER, showData, false, 0, true);
}
public function reduceHealth2(_dmg){
var prevhealth:*;
if (_dmg > health){
health = 0;
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
} else {
prevhealth = health;
health = (health - _dmg);
gamemgr.stagePanel.mccomputerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mccomputerbasehealthbar.txt.text = Math.floor(health);
checkCounter(prevhealth, health, maxhealth);
};
}
private function getClosestEnemy():Object{
var dist:*;
var obj:*;
var dist2:*;
var obj2:*;
var i:*;
dist = 100;
obj = null;
if (thisparent.playerUnits.length > 0){
obj = thisparent.playerUnits[0];
dist = getDistance(this, obj);
i = 1;
while (i < thisparent.playerUnits.length) {
obj2 = thisparent.playerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
};
if (obj){
target = obj;
targetdistance = dist;
};
return (obj);
}
public function deinit(){
this.stop();
this.removeEventListener(MouseEvent.MOUSE_OVER, showData);
}
private function doAttackMissile(){
var ang:*;
missiletimer++;
if (missiletimer >= 15){
missiletimer = 0;
ang = (180 - getAngle(this, target));
gamemgr.stageParticle.createComputerBullet("missilebullet", (attack * 1.5), this.x, this.y, ang, this, target);
};
}
private function closingMove(){
var i:*;
if (this.y > 450){
target = getClosestEnemy();
if (target){
this.y = (this.y - 0.2);
i = 0;
while (i < gamemgr.stageScene.computerTowers.length) {
gamemgr.stageScene.computerTowers[i].stopy = (gamemgr.stageScene.computerTowers[i].stopy - 0.2);
i++;
};
};
if (this.y <= 300){
attackstatus = "close";
createtime = getTimer();
stopy = 300;
};
};
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
private function showData(e=null){
gamemgr.setFocusObject(this);
}
public function reduceHealth(_obj){
var prevhealth:*;
if (_obj.damage > health){
health = 0;
gamemgr.stagePanel.mccomputerbasehealthbar.gotoAndStop(1);
gamemgr.stagePanel.mccomputerbasehealthbar.txt.text = "0";
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
} else {
prevhealth = health;
health = (health - _obj.damage);
gamemgr.stagePanel.mccomputerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mccomputerbasehealthbar.txt.text = Math.floor(health);
gamemgr.stageParticle.createParticle(_obj.typed, _obj.x, _obj.y, _obj.rotation);
checkCounter(prevhealth, health, maxhealth);
};
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
private function moveWeapon(){
var gunangle1:*;
var gunangle2:*;
var gunangle3:*;
gunangle1 = -90;
gunangle2 = -90;
gunangle3 = -90;
target = getClosestEnemy();
if (((target) && ((targetdistance < 500)))){
gunangle1 = (180 - getAngle(new Point(((this.x + gun1.x) - 240), (this.y + gun1.y)), new Point((target.x - 240), target.y)));
gunangle2 = (180 - getAngle(new Point(((this.x + gun2.x) - 240), (this.y + gun2.y)), new Point((target.x - 240), target.y)));
gunangle3 = (180 - getAngle(new Point(((this.x + gun3.x) - 240), (this.y + gun3.y)), new Point((target.x - 240), target.y)));
};
gun1.rotation = gunangle1;
gun2.rotation = gunangle2;
gun3.rotation = gunangle3;
}
private function doAttackGun(){
if (gun1.mcgunfire.currentFrame == 2){
gun1.mcgunfire.gotoAndPlay(3);
gamemgr.stageParticle.createComputerBullet("gunbullet", attack, (this.x + gun1.x), (this.y + gun1.y), gun1.rotation, this);
};
if (gun2.mcgunfire.currentFrame == 2){
gun2.mcgunfire.gotoAndPlay(3);
gamemgr.stageParticle.createComputerBullet("gunbullet", attack, (this.x + gun2.x), (this.y + gun2.y), gun2.rotation, this);
};
if (gun3.mcgunfire.currentFrame == 2){
gun3.mcgunfire.gotoAndPlay(3);
gamemgr.stageParticle.createComputerBullet("gunbullet", attack, (this.x + gun3.x), (this.y + gun3.y), gun3.rotation, this);
};
}
public function moveClip(){
if (unitstatus == "idle"){
moveWeapon();
if (((target) && ((targetdistance < 250)))){
doAttackGun();
if (gamemgr.gameData.selectedlevel > 8){
doAttackMissile();
};
if (gamemgr.gameData.selectedlevel > 10){
doAttackPlasma();
};
};
if (attackstatus == "close"){
repairBase();
idleMove();
} else {
if (attackstatus == "closing"){
repairBase();
closingMove();
};
};
};
gamemgr.stagePanel.mccomputerbasehealthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
gamemgr.stagePanel.mccomputerbasehealthbar.txt.text = Math.floor(health);
}
public function reinit(){
this.play();
this.addEventListener(MouseEvent.MOUSE_OVER, showData, false, 0, true);
}
private function idleMove(){
var t:*;
t = getTimer();
this.y = (stopy + (Math.sin((((t - createtime) / 3000) * Math.PI)) * 5));
}
private function doAttackPlasma(){
plasmatimer++;
if (plasmatimer >= 10){
plasmatimer = 0;
gamemgr.stageParticle.createComputerBullet("plasmabullet", (attack * 2), (this.x + gun1.x), (this.y + gun1.y), gun1.rotation, this);
gamemgr.stageParticle.createComputerBullet("plasmabullet", (attack * 2), (this.x + gun3.x), (this.y + gun3.y), gun3.rotation, this);
};
}
private function checkCounter(_prevhealth, _health, _maxhealth){
var hprev:*;
var hnext:*;
hprev = (_prevhealth / _maxhealth);
hnext = (_health / _maxhealth);
if (gamemgr.gameData.selectedlevel > 2){
if (hnext < 0.16){
if (hprev >= 0.16){
gamemgr.computerMgr.doCounter();
};
gamemgr.sndMgr.playBGM("cover");
} else {
if (hnext < 0.33){
if (hprev >= 0.33){
gamemgr.showMessage("Enemy base is in critical point");
gamemgr.computerMgr.doCounter(false);
gamemgr.sndMgr.playBGM("high");
};
} else {
if (hnext < 0.5){
if (hprev >= 0.5){
gamemgr.computerMgr.doCounter();
if (gamemgr.gameData.selectedlevel == 12){
attackstatus = "closing";
this.gotoAndStop(2);
};
};
} else {
if (hnext < 0.66){
if (hprev >= 0.66){
gamemgr.computerMgr.doCounter(false);
};
};
};
};
};
} else {
if (hnext < 0.16){
if (hprev >= 0.16){
gamemgr.computerMgr.doCounter(false);
};
gamemgr.sndMgr.playBGM("cover");
} else {
if (hnext < 0.33){
if (hprev >= 0.33){
gamemgr.showMessage("Enemy base is in critical point");
gamemgr.computerMgr.doCounter(false);
gamemgr.sndMgr.playBGM("high");
};
};
};
};
}
}
}//package
Section 103
//mc_background1 (mc_background1)
package {
import flash.display.*;
public dynamic class mc_background1 extends MovieClip {
public function mc_background1(){
super();
}
}
}//package
Section 104
//mc_background2 (mc_background2)
package {
import flash.display.*;
public dynamic class mc_background2 extends MovieClip {
public function mc_background2(){
super();
}
}
}//package
Section 105
//mc_background3 (mc_background3)
package {
import flash.display.*;
public dynamic class mc_background3 extends MovieClip {
public function mc_background3(){
super();
}
}
}//package
Section 106
//mc_blowparticle1 (mc_blowparticle1)
package {
public dynamic class mc_blowparticle1 extends DropParticleBase {
public function mc_blowparticle1(){
super();
}
}
}//package
Section 107
//mc_blowparticle2 (mc_blowparticle2)
package {
public dynamic class mc_blowparticle2 extends DropParticleBase {
public function mc_blowparticle2(){
super();
}
}
}//package
Section 108
//mc_bombbullet (mc_bombbullet)
package {
public dynamic class mc_bombbullet extends BulletObjectBase {
public function mc_bombbullet(){
super();
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 109
//mc_character1 (mc_character1)
package {
public dynamic class mc_character1 extends UnitObjectBase {
public function mc_character1(){
super();
}
}
}//package
Section 110
//mc_character2 (mc_character2)
package {
public dynamic class mc_character2 extends UnitObjectBase {
public function mc_character2(){
super();
}
}
}//package
Section 111
//mc_empbullet (mc_empbullet)
package {
import flash.display.*;
public dynamic class mc_empbullet extends MovieClip {
public function mc_empbullet(){
super();
addFrameScript(17, frame18);
}
function frame18(){
stop();
}
}
}//package
Section 112
//mc_emptower (mc_emptower)
package {
public dynamic class mc_emptower extends TowerObjectBase {
public function mc_emptower(){
super();
}
}
}//package
Section 113
//mc_enemy1 (mc_enemy1)
package {
public dynamic class mc_enemy1 extends UnitObjectBase {
public function mc_enemy1(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 114
//mc_enemy2 (mc_enemy2)
package {
public dynamic class mc_enemy2 extends UnitObjectBase {
public function mc_enemy2(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 115
//mc_enemy3 (mc_enemy3)
package {
public dynamic class mc_enemy3 extends UnitObjectBase {
public function mc_enemy3(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 116
//mc_enemy4 (mc_enemy4)
package {
public dynamic class mc_enemy4 extends UnitObjectBase {
public function mc_enemy4(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 117
//mc_enemy5 (mc_enemy5)
package {
public dynamic class mc_enemy5 extends UnitObjectBase {
public function mc_enemy5(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 118
//mc_enemy6 (mc_enemy6)
package {
public dynamic class mc_enemy6 extends UnitObjectBase {
public function mc_enemy6(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 119
//mc_enemy7 (mc_enemy7)
package {
public dynamic class mc_enemy7 extends UnitObjectBase {
public function mc_enemy7(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 120
//mc_enemy7_shuttle (mc_enemy7_shuttle)
package {
public dynamic class mc_enemy7_shuttle extends ShuttleObjectBase {
public function mc_enemy7_shuttle(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 121
//mc_enemyunit (mc_enemyunit)
package {
import flash.display.*;
public dynamic class mc_enemyunit extends MovieClip {
public function mc_enemyunit(){
super();
}
}
}//package
Section 122
//mc_explodesplash (mc_explodesplash)
package {
import flash.display.*;
public dynamic class mc_explodesplash extends MovieClip {
public function mc_explodesplash(){
super();
}
}
}//package
Section 123
//mc_gunbullet (mc_gunbullet)
package {
public dynamic class mc_gunbullet extends BulletObjectBase {
public function mc_gunbullet(){
super();
}
}
}//package
Section 124
//mc_gunparticle (mc_gunparticle)
package {
import flash.display.*;
public dynamic class mc_gunparticle extends MovieClip {
public function mc_gunparticle(){
super();
}
}
}//package
Section 125
//mc_guntower (mc_guntower)
package {
public dynamic class mc_guntower extends TowerObjectBase {
public function mc_guntower(){
super();
}
}
}//package
Section 126
//mc_guntowerenemy (mc_guntowerenemy)
package {
public dynamic class mc_guntowerenemy extends TowerObjectBase {
public function mc_guntowerenemy(){
super();
}
}
}//package
Section 127
//mc_minienemybase (mc_minienemybase)
package {
import flash.display.*;
public dynamic class mc_minienemybase extends MovieClip {
public function mc_minienemybase(){
super();
}
}
}//package
Section 128
//mc_miniplayerbase (mc_miniplayerbase)
package {
import flash.display.*;
public dynamic class mc_miniplayerbase extends MovieClip {
public function mc_miniplayerbase(){
super();
}
}
}//package
Section 129
//mc_missilebullet (mc_missilebullet)
package {
public dynamic class mc_missilebullet extends BulletObjectBase {
public function mc_missilebullet(){
super();
addFrameScript(30, frame31);
}
function frame31(){
stop();
}
}
}//package
Section 130
//mc_missiletower (mc_missiletower)
package {
public dynamic class mc_missiletower extends TowerObjectBase {
public function mc_missiletower(){
super();
}
}
}//package
Section 131
//mc_missiletowerenemy (mc_missiletowerenemy)
package {
public dynamic class mc_missiletowerenemy extends TowerObjectBase {
public function mc_missiletowerenemy(){
super();
}
}
}//package
Section 132
//mc_optionpanel (mc_optionpanel)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mc_optionpanel extends MovieClip {
public var btsfx:SimpleButton;
public var btabort:SimpleButton;
public var btbgm:SimpleButton;
public var btmore:SimpleButton;
public var txt1:TextField;
public var txt2:TextField;
public var txt3:TextField;
public var txt5:TextField;
public var thisparent;
public var txt4:TextField;
public var btresume:SimpleButton;
public function mc_optionpanel(){
super();
addFrameScript(0, frame1, 7, frame8, 14, frame15);
}
public function abortOut(e=null){
txt4.text = "Abort Mission";
}
public function showPanel(){
if (currentFrame == 1){
gotoAndPlay("2");
};
}
public function sfxClick(e=null){
if (thisparent.sndMgr.sfxVolume > 0){
thisparent.sndMgr.sfxVolume = 0;
txt2.text = "Sound FX OFF";
} else {
thisparent.sndMgr.sfxVolume = 1;
txt2.text = "Sound FX ON";
};
thisparent.sndMgr.refreshVolume();
}
public function abortOver(e=null){
txt4.text = "Click to quit game";
}
public function moreClick(e=null){
thisparent.myParent.gotoMoreGame();
}
public function abortClick(e=null){
stopListeners();
thisparent.quitGameRequest();
this.gotoAndPlay(9);
}
public function resumeClick(e=null){
stopListeners();
thisparent.continueClip();
this.gotoAndPlay(9);
}
public function bgmOut(e=null){
if (thisparent.sndMgr.bgmVolume > 0){
txt3.text = "BG Music ON";
} else {
txt3.text = "BG Music OFF";
};
}
function frame15(){
gotoAndStop(1);
}
function frame1(){
stop();
thisparent = parent;
}
public function stopListeners(){
btmore.removeEventListener(MouseEvent.CLICK, moreClick);
btsfx.removeEventListener(MouseEvent.CLICK, sfxClick);
btbgm.removeEventListener(MouseEvent.CLICK, bgmClick);
btabort.removeEventListener(MouseEvent.CLICK, abortClick);
btresume.removeEventListener(MouseEvent.CLICK, resumeClick);
btmore.removeEventListener(MouseEvent.MOUSE_OVER, moreOver);
btsfx.removeEventListener(MouseEvent.MOUSE_OVER, sfxOver);
btbgm.removeEventListener(MouseEvent.MOUSE_OVER, bgmOver);
btabort.removeEventListener(MouseEvent.MOUSE_OVER, abortOver);
btresume.removeEventListener(MouseEvent.MOUSE_OVER, resumeOver);
btmore.removeEventListener(MouseEvent.MOUSE_OUT, moreOut);
btsfx.removeEventListener(MouseEvent.MOUSE_OUT, sfxOut);
btbgm.removeEventListener(MouseEvent.MOUSE_OUT, bgmOut);
btabort.removeEventListener(MouseEvent.MOUSE_OUT, abortOut);
btresume.removeEventListener(MouseEvent.MOUSE_OUT, resumeOut);
}
function frame8(){
stop();
startListeners();
}
public function sfxOut(e=null){
if (thisparent.sndMgr.sfxVolume > 0){
txt2.text = "Sound FX ON";
} else {
txt2.text = "Sound FX OFF";
};
}
public function resumeOver(e=null){
txt5.text = "Click to resume game";
}
public function bgmClick(e=null){
if (thisparent.sndMgr.bgmVolume > 0){
thisparent.sndMgr.bgmVolume = 0;
txt3.text = "BG Music OFF";
} else {
thisparent.sndMgr.bgmVolume = 1;
txt3.text = "BG Music ON";
};
thisparent.sndMgr.refreshVolume();
}
public function moreOut(e=null){
txt1.text = "More Invasion Games";
}
public function moreOver(e=null){
txt1.text = "Click to get more fun";
}
public function bgmOver(e=null){
if (thisparent.sndMgr.bgmVolume > 0){
txt3.text = "Click to turn off music";
} else {
txt3.text = "Click to turn on music";
};
}
public function resumeOut(e=null){
txt5.text = "Resume Game";
}
public function hidePanel(){
if (currentFrame == 8){
gotoAndPlay("9");
};
}
public function sfxOver(e=null){
if (thisparent.sndMgr.sfxVolume > 0){
txt2.text = "Click to turn off sound FX";
} else {
txt2.text = "Click to turn on sound FX";
};
}
public function startListeners(){
btmore.addEventListener(MouseEvent.CLICK, moreClick, false, 0, true);
btsfx.addEventListener(MouseEvent.CLICK, sfxClick, false, 0, true);
btbgm.addEventListener(MouseEvent.CLICK, bgmClick, false, 0, true);
btabort.addEventListener(MouseEvent.CLICK, abortClick, false, 0, true);
btresume.addEventListener(MouseEvent.CLICK, resumeClick, false, 0, true);
btmore.addEventListener(MouseEvent.MOUSE_OVER, moreOver, false, 0, true);
btsfx.addEventListener(MouseEvent.MOUSE_OVER, sfxOver, false, 0, true);
btbgm.addEventListener(MouseEvent.MOUSE_OVER, bgmOver, false, 0, true);
btabort.addEventListener(MouseEvent.MOUSE_OVER, abortOver, false, 0, true);
btresume.addEventListener(MouseEvent.MOUSE_OVER, resumeOver, false, 0, true);
btmore.addEventListener(MouseEvent.MOUSE_OUT, moreOut, false, 0, true);
btsfx.addEventListener(MouseEvent.MOUSE_OUT, sfxOut, false, 0, true);
btbgm.addEventListener(MouseEvent.MOUSE_OUT, bgmOut, false, 0, true);
btabort.addEventListener(MouseEvent.MOUSE_OUT, abortOut, false, 0, true);
btresume.addEventListener(MouseEvent.MOUSE_OUT, resumeOut, false, 0, true);
}
}
}//package
Section 133
//mc_plasmabullet (mc_plasmabullet)
package {
public dynamic class mc_plasmabullet extends BulletObjectBase {
public function mc_plasmabullet(){
super();
addFrameScript(40, frame41);
}
function frame41(){
stop();
}
}
}//package
Section 134
//mc_plasmatower (mc_plasmatower)
package {
public dynamic class mc_plasmatower extends TowerObjectBase {
public function mc_plasmatower(){
super();
}
}
}//package
Section 135
//mc_plasmatowerenemy (mc_plasmatowerenemy)
package {
public dynamic class mc_plasmatowerenemy extends TowerObjectBase {
public function mc_plasmatowerenemy(){
super();
}
}
}//package
Section 136
//mc_player1 (mc_player1)
package {
public dynamic class mc_player1 extends UnitObjectBase {
public function mc_player1(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 137
//mc_player2 (mc_player2)
package {
public dynamic class mc_player2 extends UnitObjectBase {
public function mc_player2(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 138
//mc_player3 (mc_player3)
package {
public dynamic class mc_player3 extends UnitObjectBase {
public function mc_player3(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 139
//mc_player4 (mc_player4)
package {
public dynamic class mc_player4 extends UnitObjectBase {
public function mc_player4(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 140
//mc_player5 (mc_player5)
package {
public dynamic class mc_player5 extends UnitObjectBase {
public function mc_player5(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 141
//mc_playerunit (mc_playerunit)
package {
import flash.display.*;
public dynamic class mc_playerunit extends MovieClip {
public function mc_playerunit(){
super();
}
}
}//package
Section 142
//mc_redsplashfx (mc_redsplashfx)
package {
import flash.display.*;
public dynamic class mc_redsplashfx extends MovieClip {
public function mc_redsplashfx(){
super();
}
}
}//package
Section 143
//mc_shipgunbullet (mc_shipgunbullet)
package {
public dynamic class mc_shipgunbullet extends BulletObjectBase {
public function mc_shipgunbullet(){
super();
}
}
}//package
Section 144
//mc_special1 (mc_special1)
package {
public dynamic class mc_special1 extends UnitObjectBase {
public function mc_special1(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 145
//mc_special4 (mc_special4)
package {
public dynamic class mc_special4 extends UnitObjectBase {
public function mc_special4(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 146
//mc_special4_shuttle (mc_special4_shuttle)
package {
public dynamic class mc_special4_shuttle extends ShuttleObjectBase {
public function mc_special4_shuttle(){
super();
addFrameScript(2, frame3, 5, frame6, 8, frame9);
}
function frame3(){
gotoAndPlay("p1");
}
function frame6(){
gotoAndPlay("p2");
}
function frame9(){
gotoAndPlay("p3");
}
}
}//package
Section 147
//mc_thunderbullet (mc_thunderbullet)
package {
import flash.display.*;
public dynamic class mc_thunderbullet extends MovieClip {
public function mc_thunderbullet(){
super();
addFrameScript(1, frame2, 3, frame4, 5, frame6, 7, frame8, 9, frame10, 10, frame11);
}
function frame10(){
gotoAndPlay("destroyed");
}
function frame6(){
gotoAndPlay("destroyed");
}
function frame8(){
gotoAndPlay("destroyed");
}
function frame4(){
gotoAndPlay("destroyed");
}
function frame2(){
gotoAndPlay("destroyed");
}
function frame11(){
stop();
}
}
}//package
Section 148
//mc_thundertower (mc_thundertower)
package {
public dynamic class mc_thundertower extends TowerObjectBase {
public function mc_thundertower(){
super();
}
}
}//package
Section 149
//mc_thundertowerenemy (mc_thundertowerenemy)
package {
public dynamic class mc_thundertowerenemy extends TowerObjectBase {
public function mc_thundertowerenemy(){
super();
}
}
}//package
Section 150
//mc_towercreate (mc_towercreate)
package {
import flash.display.*;
public dynamic class mc_towercreate extends MovieClip {
public function mc_towercreate(){
super();
}
}
}//package
Section 151
//mc_towerprogress (mc_towerprogress)
package {
import flash.display.*;
public dynamic class mc_towerprogress extends MovieClip {
public function mc_towerprogress(){
super();
}
}
}//package
Section 152
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return ("2.7");
}
public static function showClickAwayAd(options:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = options;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
sendHostProgress = false;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var ad_clip:Object;
var elapsed:Number;
var finished:Boolean;
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
ad_clip = this.parent._mochiad_ctr;
elapsed = (getTimer() - this.started);
finished = false;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String;
hostname = server.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!clip._mochiad){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = options;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object;
_chk = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var ad_clip:Object;
var elapsed:Number;
var finished:Boolean;
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
ad_clip = this.parent._mochiad_ctr;
elapsed = (getTimer() - this.started);
finished = false;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var optcopy:Object;
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
optcopy = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(options:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = options;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array;
var i:Number;
nameArray = methodName.split(".");
i = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip;
mc = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var b:Object;
var w:Number;
var h:Number;
var xy:Array;
b = clip.getBounds(clip.root);
w = 0;
h = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array;
var i:Number;
nameArray = objectName.split(".");
i = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array;
var i:Number;
nameArray = objectName.split(".");
i = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = options;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (percent:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number;
p = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object;
_chk = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _clip:Object;
var ad_clip:Object;
var elapsed:Number;
var finished:Boolean;
var clip_total:Number;
var clip_loaded:Number;
var clip_pcnt:Number;
var ad_pcnt:Number;
var _inside:Object;
var pcnt:Number;
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_clip = this.parent.parent.root;
ad_clip = this.parent._mochiad_ctr;
elapsed = (getTimer() - this.started);
finished = false;
clip_total = _clip.loaderInfo.bytesTotal;
clip_loaded = _clip.loaderInfo.bytesLoaded;
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
clip_pcnt = ((100 * clip_loaded) / clip_total);
ad_pcnt = ((100 * elapsed) / chk.ad_msec);
_inside = this._mochiad_bar._inside;
pcnt = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var f:Function;
var mc = mc;
f = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 153
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.system.*;
import flash.net.*;
public dynamic class MochiBot extends Sprite {
public function MochiBot(){
super();
}
public static function track(parent:Sprite, tag:String):MochiBot{
var self:MochiBot;
var server:String;
var lv:URLVariables;
var url:String;
var req:URLRequest;
var loader:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
self = new (MochiBot);
parent.addChild(self);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
server = "http://core.mochibot.com/my/core.swf";
lv = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
url = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
req = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package
Section 154
//ParticleContainerBase (ParticleContainerBase)
package {
import flash.display.*;
public class ParticleContainerBase extends Sprite {
public var computerBullets;
public var playerBullets;
private var particles;
private var thisparent;
private var sndMgr;
public function ParticleContainerBase(){
playerBullets = new Array();
computerBullets = new Array();
particles = new Array();
super();
}
public function init(){
thisparent = MovieClip(this.parent);
sndMgr = thisparent.sndMgr;
playerBullets.splice(0);
computerBullets.splice(0);
}
public function createComputerBullet(_type, _dmg, _xx, _yy, _ang, _own, _tgt=null){
var obj:*;
switch (_type){
case "shipgunbullet":
obj = new mc_shipgunbullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own);
sndMgr.playSFX("sfxgunshot");
break;
case "plasmabullet":
obj = new mc_plasmabullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own);
sndMgr.playSFX("sfxplasmashot");
break;
case "missilebullet":
obj = new mc_missilebullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own, _tgt);
sndMgr.playSFX("sfxmissileshot");
break;
case "gunbullet":
default:
obj = new mc_gunbullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own);
sndMgr.playSFX("sfxgunshot");
break;
};
if (obj){
this.addChild(obj);
computerBullets.push(obj);
};
}
public function deinit(){
var i:*;
var num:*;
var obj:*;
num = this.numChildren;
i = (num - 1);
while (i >= 0) {
obj = this.getChildAt(i);
obj.stop();
i--;
};
}
public function removeParticle(_obj){
var i:*;
i = particles.indexOf(_obj);
if (i >= 0){
this.removeChild(particles[i]);
particles.splice(i, 1);
};
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
public function createPlayerBullet(_type, _dmg, _xx, _yy, _ang, _own, _tgt=null){
var obj:*;
switch (_type){
case "shipgunbullet":
obj = new mc_shipgunbullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own);
sndMgr.playSFX("sfxgunshot");
break;
case "plasmabullet":
obj = new mc_plasmabullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own);
sndMgr.playSFX("sfxplasmashot");
break;
case "missilebullet":
obj = new mc_missilebullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own, _tgt);
sndMgr.playSFX("sfxmissileshot");
break;
case "dropbombbullet":
obj = new mc_bombbullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own, _tgt);
break;
case "gunbullet":
default:
obj = new mc_gunbullet();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _ang;
obj.init(_type, _dmg, _own);
sndMgr.playSFX("sfxgunshot");
break;
};
if (obj){
this.addChild(obj);
playerBullets.push(obj);
};
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
public function removeComputerBullet(_obj){
var obj:*;
var i:*;
i = computerBullets.indexOf(_obj);
if (i >= 0){
switch (computerBullets[i].typed){
case "missilebullet":
obj = new mc_redsplashfx();
obj.x = computerBullets[i].x;
obj.y = computerBullets[i].y;
obj.rotation = computerBullets[i].rotation;
obj.width = 10;
obj.height = 10;
this.addChild(obj);
particles.push(obj);
sndMgr.playSFX("sfxdmissileexplode");
break;
};
this.removeChild(computerBullets[i]);
computerBullets.splice(i, 1);
};
}
public function createParticle(_type, _xx, _yy, _aa=0, _ww=0){
var obj:*;
var i:*;
switch (_type){
case "guntower":
case "missiletower":
case "thundertower":
case "emptower":
case "plasmatower":
case "avenger":
case "thunderbolt":
case "defender":
case "battlecruiser":
case "secretstriker":
case "intrepid":
case "excelsior":
case "steamrunner":
case "ptolemy":
case "warhammer":
obj = new mc_redsplashfx();
obj.x = _xx;
obj.y = _yy;
obj.width = (_ww / 2);
obj.height = (_ww / 2);
obj.rotation = _aa;
this.addChild(obj);
particles.push(obj);
i = 0;
while (i < 20) {
obj = new mc_blowparticle1();
obj.x = _xx;
obj.y = _yy;
obj.init();
this.addChild(obj);
particles.push(obj);
i++;
};
sndMgr.playSFX("sfxsmallshipexplode");
break;
case "valour":
case "vanguard":
case "aircraftcarrier":
obj = new mc_redsplashfx();
obj.x = _xx;
obj.y = _yy;
obj.width = (_ww / 4);
obj.height = (_ww / 4);
obj.rotation = _aa;
this.addChild(obj);
particles.push(obj);
i = 0;
while (i < 20) {
obj = new mc_blowparticle1();
obj.x = _xx;
obj.y = _yy;
obj.init();
this.addChild(obj);
particles.push(obj);
i++;
};
sndMgr.playSFX("sfxbigshipexplode");
break;
case "empbullet":
obj = new mc_empbullet();
obj.x = _xx;
obj.y = _yy;
this.addChild(obj);
particles.push(obj);
break;
case "thunderbullet":
obj = new mc_thunderbullet();
obj.gotoAndPlay(((Math.ceil((Math.random() * 5)) * 2) - 1));
obj.x = _xx;
obj.y = _yy;
obj.width = _ww;
obj.rotation = _aa;
this.addChild(obj);
particles.push(obj);
break;
case "dropbombbullet":
case "missilebullet":
obj = new mc_redsplashfx();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _aa;
obj.scaleX = 0.3;
obj.scaleY = 0.3;
this.addChild(obj);
particles.push(obj);
break;
case "gunbullet":
default:
obj = new mc_gunparticle();
obj.x = _xx;
obj.y = _yy;
obj.rotation = _aa;
this.addChild(obj);
particles.push(obj);
break;
};
}
public function moveClip(){
var i:*;
i = (playerBullets.length - 1);
while (i >= 0) {
playerBullets[i].moveClip();
if (playerBullets[i].currentLabel == "destroyed"){
removePlayerBullet(playerBullets[i]);
};
i--;
};
i = (computerBullets.length - 1);
while (i >= 0) {
computerBullets[i].moveClip();
if (computerBullets[i].currentLabel == "destroyed"){
removeComputerBullet(computerBullets[i]);
};
i--;
};
i = (particles.length - 1);
while (i >= 0) {
if (particles[i].currentLabel == "destroyed"){
removeParticle(particles[i]);
};
i--;
};
}
public function reinit(){
var i:*;
var num:*;
var obj:*;
num = this.numChildren;
i = (num - 1);
while (i >= 0) {
obj = this.getChildAt(i);
obj.play();
i--;
};
}
public function removePlayerBullet(_obj){
var obj:*;
var i:*;
i = playerBullets.indexOf(_obj);
if (i >= 0){
switch (playerBullets[i].typed){
case "dropbombbullet":
obj = new mc_explodesplash();
obj.x = playerBullets[i].x;
obj.y = playerBullets[i].y;
this.addChild(obj);
particles.push(obj);
sndMgr.playSFX("sfxdropbombexplode");
break;
case "missilebullet":
obj = new mc_redsplashfx();
obj.x = playerBullets[i].x;
obj.y = playerBullets[i].y;
obj.rotation = playerBullets[i].rotation;
obj.scaleX = 1;
obj.scaleY = 1;
this.addChild(obj);
particles.push(obj);
sndMgr.playSFX("sfxdmissileexplode");
break;
};
this.removeChild(playerBullets[i]);
playerBullets.splice(i, 1);
};
}
}
}//package
Section 155
//playerbase_mc (playerbase_mc)
package {
public dynamic class playerbase_mc extends FloatingBaseObjectBase {
public function playerbase_mc(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 156
//SceneContainer (SceneContainer)
package {
public dynamic class SceneContainer extends SceneContainerBase {
public function SceneContainer(){
super();
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 157
//SceneContainerBase (SceneContainerBase)
package {
import flash.display.*;
public class SceneContainerBase extends MovieClip {
public var playerUnits;
public var computerUnits;
public var computerBaseMC;
public var playerCreateTowerType;
public var playerCreateTowerProgress;
public var playerbase:playerbase_mc;
public var computerCreateTowerTime;
public var myParent;
public var playerBaseMC;
public var computerbase:computerbase_mc;
public var computerCreateTowerProgress;
public var computerCreateTowerMaxTime;
public var computerCreateTowerPos;
public var computerCreateTowerType;
public var playerCreateTowerTime;
public var computerTowers;
public var btzoomlock:MovieClip;
public var playerTowers;
public var playerCreateTowerMaxTime;
public var playerCreateTowerPos;
public function SceneContainerBase(){
playerUnits = new Array();
computerUnits = new Array();
playerTowers = new Array();
computerTowers = new Array();
playerCreateTowerProgress = new Array();
playerCreateTowerType = new Array();
playerCreateTowerPos = new Array();
playerCreateTowerMaxTime = new Array();
playerCreateTowerTime = new Array();
computerCreateTowerProgress = new Array();
computerCreateTowerType = new Array();
computerCreateTowerPos = new Array();
computerCreateTowerMaxTime = new Array();
computerCreateTowerTime = new Array();
super();
}
public function init(){
var i:*;
var obj:*;
myParent = this.parent;
this.x = -240;
this.scaleX = 1;
this.scaleY = 1;
playerBaseMC = playerbase;
playerBaseMC.init();
computerBaseMC = computerbase;
computerBaseMC.init();
playerUnits.splice(0);
computerUnits.splice(0);
playerTowers.splice(0);
computerTowers.splice(0);
i = 0;
while (i < 4) {
obj = new mc_towerprogress();
obj.gotoAndStop(1);
this.addChild(obj);
playerCreateTowerProgress.push(obj);
obj.x = 100;
obj.y = 100;
obj = new mc_towerprogress();
obj.gotoAndStop(1);
this.addChild(obj);
computerCreateTowerProgress.push(obj);
obj.x = 100;
obj.y = 100;
i++;
};
}
public function createComputerTower(_type, _pos, _time){
if ((computerCreateTowerType.length + computerTowers.length) < 4){
computerCreateTowerType.push(_type);
computerCreateTowerPos.push(_pos);
computerCreateTowerMaxTime.push(_time);
computerCreateTowerTime.push(0);
};
}
public function deinit(){
var i:*;
var num:*;
playerBaseMC.deinit();
computerBaseMC.deinit();
i = 0;
while (i < playerUnits.length) {
playerUnits[i].deinit();
i++;
};
i = 0;
while (i < computerUnits.length) {
computerUnits[i].deinit();
i++;
};
i = 0;
while (i < playerTowers.length) {
playerTowers[i].deinit();
i++;
};
i = 0;
while (i < computerTowers.length) {
computerTowers[i].deinit();
i++;
};
}
public function createPlayerTower(_type, _pos, _time){
if ((playerCreateTowerType.length + playerTowers.length) < 4){
myParent.gameData.addUnitCreated(_type);
playerCreateTowerType.push(_type);
playerCreateTowerPos.push(_pos);
playerCreateTowerMaxTime.push(_time);
playerCreateTowerTime.push(0);
};
}
public function createCharacter(_named, _sided){
var obj:*;
switch (_named){
case "avenger":
obj = new mc_player1();
break;
case "thunderbolt":
obj = new mc_player2();
break;
case "defender":
obj = new mc_player3();
break;
case "battlecruiser":
obj = new mc_player4();
break;
case "valour":
obj = new mc_player5();
break;
case "secretstriker":
obj = new mc_special1();
break;
case "intrepid":
obj = new mc_enemy1();
break;
case "excelsior":
obj = new mc_enemy2();
break;
case "steamrunner":
obj = new mc_enemy3();
break;
case "ptolemy":
obj = new mc_enemy4();
break;
case "warhammer":
obj = new mc_enemy5();
break;
case "vanguard":
obj = new mc_enemy6();
break;
case "aircraftcarrier":
if (_sided == "computer"){
obj = new mc_enemy7();
} else {
obj = new mc_special4();
};
break;
};
this.addChild(obj);
obj.init(_sided, _named);
if (_sided == "player"){
myParent.gameData.addUnitCreated(_named);
obj.x = playerBaseMC.x;
obj.y = playerBaseMC.y;
playerUnits.push(obj);
} else {
obj.x = computerBaseMC.x;
obj.y = computerBaseMC.y;
computerUnits.push(obj);
};
}
public function moveClip(){
var i:*;
var obj:*;
setCreateTowerProgress();
playerBaseMC.moveClip();
computerBaseMC.moveClip();
i = (playerUnits.length - 1);
while (i >= 0) {
playerUnits[i].moveClip();
if (playerUnits[i].unitstatus == "destroyed"){
myParent.gameData.addUnitLost(playerUnits[i].typed);
playerUnits[i].destroyShuttle();
playerUnits[i].deinit();
this.removeChild(playerUnits[i]);
playerUnits.splice(i, 1);
};
i--;
};
i = (computerUnits.length - 1);
while (i >= 0) {
computerUnits[i].moveClip();
if (computerUnits[i].unitstatus == "destroyed"){
myParent.gameData.addUnitKilled(computerUnits[i].typed);
computerUnits[i].destroyShuttle();
computerUnits[i].deinit();
this.removeChild(computerUnits[i]);
computerUnits.splice(i, 1);
};
i--;
};
i = (playerTowers.length - 1);
while (i >= 0) {
playerTowers[i].moveClip();
if (playerTowers[i].unitstatus == "destroyed"){
myParent.gameData.addUnitLost(playerTowers[i].typed);
playerTowers[i].deinit();
this.removeChild(playerTowers[i]);
playerTowers.splice(i, 1);
};
i--;
};
i = (computerTowers.length - 1);
while (i >= 0) {
computerTowers[i].moveClip();
if (computerTowers[i].unitstatus == "destroyed"){
myParent.gameData.addUnitKilled(computerTowers[i].typed);
computerTowers[i].deinit();
this.removeChild(computerTowers[i]);
computerTowers.splice(i, 1);
};
i--;
};
i = 0;
while (i < (this.numChildren - 1)) {
obj = this.getChildAt(i);
if ((((((((obj.x < 10)) || ((obj.y < 10)))) || ((obj.x > 950)))) || ((obj.y > 950)))){
if (obj.width < 480){
trace(obj, obj.x, obj.y);
};
};
i++;
};
}
public function reinit(){
var i:*;
var num:*;
playerBaseMC.reinit();
computerBaseMC.reinit();
i = 0;
while (i < playerUnits.length) {
playerUnits[i].reinit();
i++;
};
i = 0;
while (i < computerUnits.length) {
computerUnits[i].reinit();
i++;
};
i = 0;
while (i < playerTowers.length) {
playerTowers[i].reinit();
i++;
};
i = 0;
while (i < computerTowers.length) {
computerTowers[i].reinit();
i++;
};
}
private function addTower(_type, _side, _pos){
var obj:*;
switch (_type){
case 1:
if (_side == "player"){
myParent.gameData.addUnitCreated("guntower");
obj = new mc_guntower();
obj.x = _pos.x;
obj.y = _pos.y;
} else {
obj = new mc_guntowerenemy();
obj.x = (_pos.x + computerBaseMC.x);
obj.y = (_pos.y + computerBaseMC.y);
};
this.addChild(obj);
obj.init(_side, "guntower");
break;
case 2:
if (_side == "player"){
myParent.gameData.addUnitCreated("missiletower");
obj = new mc_missiletower();
obj.x = _pos.x;
obj.y = _pos.y;
} else {
obj = new mc_missiletowerenemy();
obj.x = (_pos.x + computerBaseMC.x);
obj.y = (_pos.y + computerBaseMC.y);
};
this.addChild(obj);
obj.init(_side, "missiletower");
break;
case 3:
if (_side == "player"){
myParent.gameData.addUnitCreated("thundertower");
obj = new mc_thundertower();
obj.x = _pos.x;
obj.y = _pos.y;
} else {
obj = new mc_thundertowerenemy();
obj.x = (_pos.x + computerBaseMC.x);
obj.y = (_pos.y + computerBaseMC.y);
};
this.addChild(obj);
obj.init(_side, "thundertower");
break;
case 4:
myParent.gameData.addUnitCreated("emptower");
obj = new mc_emptower();
this.addChild(obj);
obj.x = _pos.x;
obj.y = _pos.y;
obj.init(_side, "emptower");
break;
case 5:
if (_side == "player"){
myParent.gameData.addUnitCreated("plasmatower");
obj = new mc_plasmatower();
obj.x = _pos.x;
obj.y = _pos.y;
} else {
obj = new mc_plasmatowerenemy();
obj.x = (_pos.x + computerBaseMC.x);
obj.y = (_pos.y + computerBaseMC.y);
};
this.addChild(obj);
obj.init(_side, "plasmatower");
break;
};
if (obj){
if (_side == "player"){
playerTowers.push(obj);
} else {
computerTowers.push(obj);
};
};
}
public function setCreateTowerProgress(){
var i:*;
i = 0;
i = 0;
while (i < playerCreateTowerType.length) {
var _local2 = playerCreateTowerTime;
var _local3 = i;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (playerCreateTowerTime[i] < playerCreateTowerMaxTime[i]){
playerCreateTowerProgress[i].gotoAndStop((Math.floor(((playerCreateTowerTime[i] / playerCreateTowerMaxTime[i]) * 100)) + 1));
playerCreateTowerProgress[i].x = playerCreateTowerPos[i].x;
playerCreateTowerProgress[i].y = playerCreateTowerPos[i].y;
} else {
addTower(playerCreateTowerType[i], "player", playerCreateTowerPos[i]);
playerCreateTowerType.splice(i, 1);
playerCreateTowerPos.splice(i, 1);
playerCreateTowerMaxTime.splice(i, 1);
playerCreateTowerTime.splice(i, 1);
};
i++;
};
while (i < playerCreateTowerProgress.length) {
playerCreateTowerProgress[i].gotoAndStop(102);
i++;
};
i = 0;
while (i < computerCreateTowerType.length) {
_local2 = computerCreateTowerTime;
_local3 = i;
_local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (computerCreateTowerTime[i] < computerCreateTowerMaxTime[i]){
computerCreateTowerProgress[i].gotoAndStop((Math.floor(((computerCreateTowerTime[i] / computerCreateTowerMaxTime[i]) * 100)) + 1));
computerCreateTowerProgress[i].x = (computerCreateTowerPos[i].x + computerBaseMC.x);
computerCreateTowerProgress[i].y = (computerCreateTowerPos[i].y + computerBaseMC.y);
} else {
addTower(computerCreateTowerType[i], "computer", computerCreateTowerPos[i]);
computerCreateTowerType.splice(i, 1);
computerCreateTowerPos.splice(i, 1);
computerCreateTowerMaxTime.splice(i, 1);
computerCreateTowerTime.splice(i, 1);
};
i++;
};
while (i < computerCreateTowerProgress.length) {
computerCreateTowerProgress[i].gotoAndStop(102);
i++;
};
}
}
}//package
Section 158
//sfx_bigship_explode (sfx_bigship_explode)
package {
public dynamic class sfx_bigship_explode extends BaseSound {
public function sfx_bigship_explode(){
super();
}
}
}//package
Section 159
//sfx_dropbomb_explode (sfx_dropbomb_explode)
package {
public dynamic class sfx_dropbomb_explode extends BaseSound {
public function sfx_dropbomb_explode(){
super();
}
}
}//package
Section 160
//sfx_emp_explode (sfx_emp_explode)
package {
public dynamic class sfx_emp_explode extends BaseSound {
public function sfx_emp_explode(){
super();
}
}
}//package
Section 161
//sfx_gun_shot (sfx_gun_shot)
package {
public dynamic class sfx_gun_shot extends BaseSound {
public function sfx_gun_shot(){
super();
}
}
}//package
Section 162
//sfx_missile_explode (sfx_missile_explode)
package {
public dynamic class sfx_missile_explode extends BaseSound {
public function sfx_missile_explode(){
super();
}
}
}//package
Section 163
//sfx_missile_shot (sfx_missile_shot)
package {
public dynamic class sfx_missile_shot extends BaseSound {
public function sfx_missile_shot(){
super();
}
}
}//package
Section 164
//sfx_plasma_explode (sfx_plasma_explode)
package {
public dynamic class sfx_plasma_explode extends BaseSound {
public function sfx_plasma_explode(){
super();
}
}
}//package
Section 165
//sfx_plasma_shot (sfx_plasma_shot)
package {
public dynamic class sfx_plasma_shot extends BaseSound {
public function sfx_plasma_shot(){
super();
}
}
}//package
Section 166
//sfx_smallship_explode (sfx_smallship_explode)
package {
public dynamic class sfx_smallship_explode extends BaseSound {
public function sfx_smallship_explode(){
super();
}
}
}//package
Section 167
//ShuttleObjectBase (ShuttleObjectBase)
package {
import flash.display.*;
public class ShuttleObjectBase extends MovieClip {
private var attackrange;// = 200
private var movetimer;// = 0
public var attack;
private var xmove;// = 0
public var health;
public var typed;
public var damage;
public var container;
public var target;
public var targetdistance;
public var unitstatus;// = "idle"
public var owned;
private var ymove;// = 0
public var thisparent;
private var parentrange;// = 70
public var gamemgr;
public var sided;
private var attacktimer;// = 0
public function ShuttleObjectBase(){
unitstatus = "idle";
xmove = 0;
ymove = 0;
movetimer = 0;
parentrange = 70;
attackrange = 200;
attacktimer = 0;
super();
}
public function init(_thisparent, _sided, _typed, _health, _attack){
container = MovieClip(parent);
thisparent = _thisparent;
gamemgr = thisparent.gamemgr;
sided = _sided;
typed = _typed;
owned = thisparent;
health = _health;
attack = _attack;
damage = _attack;
if (sided == "player"){
this.x = ((container.playerBaseMC.x + (Math.random() * 20)) - 10);
this.y = ((container.playerBaseMC.y + (Math.random() * 20)) - 10);
} else {
this.x = ((container.computerBaseMC.x + (Math.random() * 20)) - 10);
this.y = ((container.computerBaseMC.y + (Math.random() * 20)) - 10);
};
this.cacheAsBitmap = true;
}
private function getClosestEnemy():Object{
var dist:*;
var obj:*;
var dist2:*;
var obj2:*;
var i:*;
dist = 100;
obj = null;
if (sided == "player"){
obj = container.computerBaseMC;
dist = getDistance(this, obj);
i = 0;
while (i < container.computerUnits.length) {
obj2 = container.computerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
i = 0;
while (i < container.computerTowers.length) {
obj2 = container.computerTowers[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
} else {
obj = container.playerBaseMC;
dist = getDistance(this, obj);
i = 0;
while (i < container.playerUnits.length) {
obj2 = container.playerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
i = 0;
while (i < container.playerTowers.length) {
obj2 = container.playerTowers[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
};
if (obj){
target = obj;
targetdistance = dist;
};
return (obj);
}
public function deinit(){
this.gotoAndStop("p1");
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
private function moveIdle(){
var dist:*;
var ang:*;
movetimer++;
if (movetimer > 3){
movetimer = 0;
dist = getDistance(this, thisparent);
if (dist > parentrange){
ang = (180 - getAngle(this, thisparent));
xmove = ((3 * Math.cos(((ang * Math.PI) / 180))) - (Math.random() * 2));
ymove = ((3 * Math.sin(((ang * Math.PI) / 180))) - (Math.random() * 2));
} else {
if (dist < (parentrange / 2)){
ang = (180 - getAngle(this, thisparent));
xmove = ((-3 * Math.cos(((ang * Math.PI) / 180))) + (Math.random() * 2));
ymove = ((-3 * Math.sin(((ang * Math.PI) / 180))) + (Math.random() * 2));
};
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
private function moveReturn(){
var dist:*;
var ang:*;
movetimer++;
if (movetimer > 3){
movetimer = 0;
dist = getDistance(this, thisparent);
if (dist > parentrange){
ang = (180 - getAngle(this, thisparent));
xmove = ((10 * Math.cos(((ang * Math.PI) / 180))) - (Math.random() * 3));
ymove = ((10 * Math.sin(((ang * Math.PI) / 180))) - (Math.random() * 3));
} else {
if (dist < (parentrange / 2)){
ang = (180 - getAngle(this, thisparent));
xmove = ((-10 * Math.cos(((ang * Math.PI) / 180))) + (Math.random() * 3));
ymove = ((-10 * Math.sin(((ang * Math.PI) / 180))) + (Math.random() * 3));
unitstatus = "idle";
};
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
}
public function reinit(){
this.gotoAndPlay("p1");
}
private function moveAttack(){
var dist:*;
var ang:*;
movetimer++;
if (movetimer > 9){
movetimer = 0;
dist = getDistance(this, thisparent);
if (dist < attackrange){
ang = (180 - getAngle(this, target));
xmove = ((10 * Math.cos(((ang * Math.PI) / 180))) - (Math.random() * 3));
ymove = ((10 * Math.sin(((ang * Math.PI) / 180))) - (Math.random() * 3));
} else {
unitstatus = "return";
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
attacktimer++;
if (attacktimer > 10){
attacktimer = 0;
dist = getDistance(this, target);
if (dist < 20){
gamemgr.reduceHealth(target, this);
};
};
}
public function moveClip(){
if (((!((unitstatus == "destroyed"))) && (!((unitstatus == "return"))))){
if (!target){
target = null;
getClosestEnemy();
if (target){
if (targetdistance < attackrange){
unitstatus = "attack";
} else {
unitstatus = "idle";
target = null;
};
};
} else {
if (target.unitstatus == "destroyed"){
target = null;
getClosestEnemy();
if (target){
if (targetdistance < 300){
unitstatus = "attack";
} else {
unitstatus = "idle";
target = null;
};
};
} else {
targetdistance = getDistance(this, target);
};
};
} else {
target = null;
};
switch (unitstatus){
case "idle":
moveIdle();
break;
case "attack":
moveAttack();
break;
case "return":
moveReturn();
break;
};
}
}
}//package
Section 168
//SoundManager (SoundManager)
package {
public class SoundManager {
private var sfxmissileexplode;
public var bgmVolume:Number;// = 1
private var sfxsmallshipexplode;
private var sfxplasmashot;
private var sfxdropbombexplode;
private var bgmlow;
private var bgmambient;
private var sfxgunshot;
private var sfxempexplode;
private var sndFx;
private var sndBgm;// = null
private var sfxbigshipexplode;
private var bgmcover;
private var myParent;
private var bgmhigh;
private var sfxplasmaexplode;
private var sfxmissileshot;
public var sfxVolume:Number;// = 1
public function SoundManager(){
bgmVolume = 1;
sfxVolume = 1;
sfxbigshipexplode = new sfx_bigship_explode();
sfxsmallshipexplode = new sfx_smallship_explode();
sfxmissileexplode = new sfx_missile_explode();
sfxmissileshot = new sfx_missile_shot();
sfxplasmaexplode = new sfx_plasma_explode();
sfxplasmashot = new sfx_plasma_shot();
sfxempexplode = new sfx_emp_explode();
sfxdropbombexplode = new sfx_emp_explode();
sfxgunshot = new sfx_gun_shot();
bgmcover = new bgm_cover();
bgmambient = new bgm_ambient();
bgmlow = new bgm_lowtension();
bgmhigh = new bgm_hightension();
sndBgm = null;
sndFx = new Array();
super();
}
private function startSFX(_snd, _vol=1){
var i:*;
i = 0;
if (sndFx.length < 10){
_snd.playSound();
_snd.setVolume((_vol * sfxVolume));
sndFx.push(_snd);
} else {
i = (sndFx.length - 1);
while (i >= 0) {
if (!sndFx[i].sndPlaying){
sndFx[i].stopSound();
sndFx.splice(i, 1);
};
i--;
};
_snd.playSound();
_snd.setVolume((_vol * sfxVolume));
sndFx.push(_snd);
};
}
public function adjustBGM(_val=1){
bgmVolume = _val;
}
public function refreshVolume(){
if (sndBgm){
sndBgm.setVolume(bgmVolume);
};
}
public function playBGM(_param:String=""){
switch (_param){
case "cover":
if (sndBgm != bgmcover){
stopBGM();
sndBgm = bgmcover;
sndBgm.playSoundLoop();
sndBgm.setVolume((0.8 * bgmVolume));
} else {
sndBgm.setVolume((0.8 * bgmVolume));
};
break;
case "ambient":
if (sndBgm != bgmambient){
stopBGM();
sndBgm = bgmambient;
sndBgm.playSoundLoop();
sndBgm.setVolume((0.5 * bgmVolume));
} else {
sndBgm.setVolume((0.5 * bgmVolume));
};
break;
case "low":
if (sndBgm != bgmlow){
stopBGM();
sndBgm = bgmlow;
sndBgm.playSoundLoop();
sndBgm.setVolume((0.8 * bgmVolume));
} else {
sndBgm.setVolume((0.8 * bgmVolume));
};
break;
case "high":
if (sndBgm != bgmhigh){
stopBGM();
sndBgm = bgmhigh;
sndBgm.playSoundLoop();
sndBgm.setVolume((0.8 * bgmVolume));
} else {
sndBgm.setVolume((0.8 * bgmVolume));
};
break;
};
}
public function adjustSFX(_val=1){
sfxVolume = _val;
}
public function stopBGM(){
if (sndBgm){
sndBgm.stopSound();
sndBgm = null;
};
}
public function stopSFX(){
var i:*;
i = (sndFx.length - 1);
while (i >= 0) {
if (sndFx[i].sndPlaying){
sndFx[i].stopSound();
};
sndFx.splice(i, 1);
i--;
};
}
public function playSFX(_param:String=""){
var rand:*;
var played:*;
var i:*;
rand = Math.random();
played = false;
i = 0;
switch (_param){
case "sfxbigshipexplode":
startSFX(new sfx_bigship_explode(), 0.5);
break;
case "sfxsmallshipexplode":
startSFX(new sfx_smallship_explode(), 0.5);
break;
case "sfxmissileexplode":
startSFX(new sfx_missile_explode(), 0.5);
break;
case "sfxplasmaexplode":
startSFX(new sfx_plasma_explode(), 0.5);
break;
case "sfxempexplode":
startSFX(new sfx_emp_explode(), 0.2);
break;
case "sfxdropbombexplode":
startSFX(new sfx_dropbomb_explode(), 0.5);
break;
case "sfxmissileshot":
startSFX(new sfx_missile_shot(), 0.1);
break;
case "sfxplasmashot":
startSFX(new sfx_plasma_shot(), 0.1);
break;
case "sfxgunshot":
startSFX(new sfx_gun_shot(), 0.2);
break;
};
}
}
}//package
Section 169
//StagePanel (StagePanel)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class StagePanel extends MovieClip {
public var btoptions:SimpleButton;
public var btcreateunit2:MovieClip;
public var btcreateunit3:MovieClip;
public var btcreateunit4:MovieClip;
public var btcreateunit5:MovieClip;
public var btcreateunit1:MovieClip;
public var scrollup:MovieClip;
public var blinker1:MovieClip;
public var blinker2:MovieClip;
public var blinker3:MovieClip;
public var blinker4:MovieClip;
public var mcunitprogress:MovieClip;
public var note1;
public var note2;
public var unitsqueuer3:MovieClip;
public var unitsqueuer4:MovieClip;
public var unitsqueuer5:MovieClip;
public var unitsqueuer1:MovieClip;
public var unitsqueuer2:MovieClip;
public var notetimer;
public var note3;
public var note4;
public var btmoregames:SimpleButton;
public var notetxt1:TextField;
public var notetxt3:TextField;
public var notetxt2:TextField;
public var notetxt4:TextField;
public var btspecial2:MovieClip;
public var btspecial4:MovieClip;
public var scrolldown:MovieClip;
public var btspecial1:MovieClip;
public var btspecial3:MovieClip;
public var mcinfo:MovieClip;
public var mcgoldbar:MovieClip;
public var mccomputerbasehealthbar:MovieClip;
public var btcreatetower2:MovieClip;
public var btcreatetower3:MovieClip;
public var btcreatetower1:MovieClip;
public var btquit:SimpleButton;
public var minimap:MovieClip;
public var selectfiremode:MovieClip;
public var towercreatepanel:MovieClip;
public var btupgrade2:MovieClip;
public var btupgrade3:MovieClip;
public var btupgrade5:MovieClip;
public var btupgrade1:MovieClip;
public var mcplayerbasehealthbar:MovieClip;
public var btupgrade4:MovieClip;
public var panelnote:TextField;
public function StagePanel(){
super();
addFrameScript(0, frame1);
}
public function writeNotes(){
if (note4){
notetxt4.text = note4;
} else {
notetxt4.text = " ";
};
if (note3){
notetxt3.text = note3;
} else {
notetxt3.text = " ";
};
if (note2){
notetxt2.text = note2;
} else {
notetxt2.text = " ";
};
if (note1){
notetxt1.text = note1;
} else {
notetxt1.text = " ";
};
}
function frame1(){
stop();
towercreatepanel.init();
notetimer = 0;
note1 = " ";
note2 = " ";
note3 = " ";
note4 = " ";
this.addEventListener(Event.ENTER_FRAME, refreshNotes, false, 0, true);
}
public function refreshNotes(e=null){
notetimer++;
if (notetimer > 90){
notetimer = 0;
addNotes(" ");
};
}
public function addNotes(_str=" ", specialevent=false){
var normalformat:*;
var specialformat:*;
normalformat = new TextFormat();
specialformat = new TextFormat();
normalformat.font = "Neuropol";
normalformat.color = 0xFF00;
specialformat.font = "Neuropol";
specialformat.color = 0xFF0000;
note2 = notetxt1.text;
note3 = notetxt2.text;
note4 = notetxt3.text;
note1 = _str;
writeNotes();
if (specialevent){
notetxt1.setTextFormat(specialformat);
} else {
notetxt1.setTextFormat(normalformat);
};
}
}
}//package
Section 170
//stageTutorial (stageTutorial)
package {
import flash.display.*;
public dynamic class stageTutorial extends MovieClip {
public function stageTutorial(){
super();
addFrameScript(0, frame1, 1521, frame1522, 1523, frame1524);
}
public function showTutorial2(){
gotoAndPlay("tutorial2");
}
public function showTutorial1(){
gotoAndPlay("tutorial1");
}
function frame1522(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame1524(){
gotoAndStop(1);
}
}
}//package
Section 171
//TimeParser (TimeParser)
package {
import flash.utils.*;
public class TimeParser {
public var stime:String;
public var hour:uint;
public var smsecond:String;
public var ssecond:String;
public var time:uint;
public var msecond:uint;
public var second:uint;
public var minute:uint;
public var shour:String;
public var sminute:String;
public function TimeParser(_time=null){
super();
if (_time){
time = _time;
} else {
time = getTimer();
};
Parse(time);
}
public function Parse(_time:uint, _sep:String=":"):String{
time = _time;
hour = Math.floor((time / 3600000));
minute = (Math.floor((time / 60000)) % 60);
second = (Math.floor((time / 1000)) % 60);
msecond = (Math.floor((time / 10)) % 100);
shour = String(hour);
if (minute < 10){
sminute = ("0" + String(minute));
} else {
sminute = String(minute);
};
if (second < 10){
ssecond = ("0" + String(second));
} else {
ssecond = String(second);
};
if (msecond < 10){
smsecond = ("0" + String(msecond));
} else {
smsecond = String(msecond);
};
if (hour > 0){
stime = ((((shour + _sep) + sminute) + _sep) + ssecond);
} else {
stime = ((sminute + _sep) + ssecond);
};
return (stime);
}
}
}//package
Section 172
//TowerObjectBase (TowerObjectBase)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class TowerObjectBase extends MovieClip {
private var longestrange;// = 500
private var shortestrange;// = 250
public var healthbar:MovieClip;
private var timer;// = 0
public var attack;
public var health;
public var typed;// = "guntower"
public var gun:MovieClip;
public var unitstatus;// = "idle"
public var target;
public var targetdistance;
public var stopy;
private var createtime;
private var thisparent;
private var gamemgr;
public var sided;// = "player"
public var maxhealth;
public function TowerObjectBase(){
sided = "player";
typed = "guntower";
longestrange = 500;
shortestrange = 250;
unitstatus = "idle";
timer = 0;
super();
}
public function init(_sided, _typed){
sided = _sided;
typed = _typed;
thisparent = this.parent;
gamemgr = thisparent.myParent;
createtime = (getTimer() + (Math.random() * 9000));
stopy = this.y;
this.cacheAsBitmap = true;
this.addEventListener(MouseEvent.MOUSE_OVER, showData, false, 0, true);
switch (typed){
case "plasmatower":
shortestrange = 250;
longestrange = 500;
if (sided == "player"){
maxhealth = gamemgr.gameData.playertowerhealth[4];
health = gamemgr.gameData.playertowerhealth[4];
attack = gamemgr.gameData.playertowerattack[4];
} else {
maxhealth = gamemgr.gameData.computertowerhealth[3];
health = gamemgr.gameData.computertowerhealth[3];
attack = gamemgr.gameData.computertowerattack[3];
};
break;
case "emptower":
shortestrange = 200;
longestrange = 200;
if (sided == "player"){
maxhealth = gamemgr.gameData.playertowerhealth[3];
health = gamemgr.gameData.playertowerhealth[3];
attack = gamemgr.gameData.playertowerattack[3];
};
break;
case "thundertower":
shortestrange = 150;
longestrange = 300;
if (sided == "player"){
maxhealth = gamemgr.gameData.playertowerhealth[2];
health = gamemgr.gameData.playertowerhealth[2];
attack = gamemgr.gameData.playertowerattack[2];
} else {
maxhealth = gamemgr.gameData.computertowerhealth[2];
health = gamemgr.gameData.computertowerhealth[2];
attack = gamemgr.gameData.computertowerattack[2];
};
break;
case "missiletower":
shortestrange = 300;
longestrange = 500;
if (sided == "player"){
maxhealth = gamemgr.gameData.playertowerhealth[1];
health = gamemgr.gameData.playertowerhealth[1];
attack = gamemgr.gameData.playertowerattack[1];
} else {
maxhealth = gamemgr.gameData.computertowerhealth[1];
health = gamemgr.gameData.computertowerhealth[1];
attack = gamemgr.gameData.computertowerattack[1];
};
break;
case "guntower":
shortestrange = 250;
longestrange = 500;
if (sided == "player"){
maxhealth = gamemgr.gameData.playertowerhealth[0];
health = gamemgr.gameData.playertowerhealth[0];
attack = gamemgr.gameData.playertowerattack[0];
} else {
maxhealth = gamemgr.gameData.computertowerhealth[0];
health = gamemgr.gameData.computertowerhealth[0];
attack = gamemgr.gameData.computertowerattack[0];
};
break;
};
}
public function reduceHealth2(_dmg){
if (_dmg > health){
health = 0;
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
if (typed == "emptower"){
doAttackEMP();
};
} else {
health = (health - _dmg);
};
}
private function doAttackEMP(){
var dist:*;
var i:*;
timer++;
if (timer >= 90){
timer = 0;
gamemgr.stageParticle.createParticle("empbullet", this.x, this.y);
i = (gamemgr.stageScene.computerUnits.length - 1);
while (i >= 0) {
dist = getDistance(gamemgr.stageScene.computerUnits[i], this);
if (dist < longestrange){
gamemgr.stageScene.computerUnits[i].reduceHealth2(((attack * dist) / longestrange));
};
i--;
};
};
}
private function getClosestEnemy():Object{
var dist:*;
var obj:*;
var dist2:*;
var obj2:*;
var i:*;
dist = 100;
obj = null;
if (sided == "player"){
obj = thisparent.computerBaseMC;
dist = getDistance(this, obj);
i = 0;
while (i < thisparent.computerUnits.length) {
obj2 = thisparent.computerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
i = 0;
while (i < thisparent.computerTowers.length) {
obj2 = thisparent.computerTowers[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
} else {
obj = thisparent.playerBaseMC;
dist = getDistance(this, obj);
i = 0;
while (i < thisparent.playerUnits.length) {
obj2 = thisparent.playerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
i = 0;
while (i < thisparent.playerTowers.length) {
obj2 = thisparent.playerTowers[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
};
if (obj){
target = obj;
targetdistance = dist;
};
return (obj);
}
public function deinit(){
this.stop();
this.removeEventListener(MouseEvent.MOUSE_UP, showData);
}
private function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
private function showData(e=null){
gamemgr.setFocusObject(this);
}
private function doAttackMissile(){
if (((target) && ((targetdistance < shortestrange)))){
timer++;
if (timer >= 15){
timer = 0;
if (sided == "player"){
gamemgr.stageParticle.createPlayerBullet("missilebullet", attack, (this.x + gun.x), (this.y + gun.y), gun.rotation, this, target);
} else {
gamemgr.stageParticle.createComputerBullet("missilebullet", attack, (this.x + gun.x), (this.y + gun.y), gun.rotation, this, target);
};
};
};
}
public function reduceHealth(_obj){
if (_obj.owned){
target = _obj.owned;
targetdistance = getDistance(this, target);
};
if (_obj.damage > health){
health = 0;
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
if (typed == "emptower"){
doAttackEMP();
};
} else {
health = (health - _obj.damage);
gamemgr.stageParticle.createParticle(_obj.typed, _obj.x, _obj.y, _obj.rotation);
};
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
private function moveWeapon(){
var gunangle:*;
gunangle = -90;
target = getClosestEnemy();
if (((target) && ((targetdistance < longestrange)))){
gunangle = (180 - getAngle(new Point(((this.x + gun.x) - 240), (this.y + gun.y)), new Point((target.x - 240), target.y)));
};
gun.rotation = gunangle;
}
private function doAttackGun(){
if (((target) && ((targetdistance < shortestrange)))){
if (gun.mcgunfire.currentFrame == 2){
gun.mcgunfire.gotoAndPlay(3);
if (sided == "player"){
gamemgr.stageParticle.createPlayerBullet("gunbullet", attack, (this.x + gun.x), (this.y + gun.y), gun.rotation, this);
} else {
gamemgr.stageParticle.createComputerBullet("gunbullet", attack, (this.x + gun.x), (this.y + gun.y), gun.rotation, this);
};
};
};
}
private function doAttackThunder(){
if (((target) && ((targetdistance < shortestrange)))){
target.reduceHealth2((attack / 10));
gamemgr.stageParticle.createParticle("thunderbullet", this.x, this.y, gun.rotation, targetdistance);
};
}
public function moveClip(){
if (unitstatus == "idle"){
switch (typed){
case "emptower":
idleMove();
doAttackEMP();
break;
case "missiletower":
idleMove();
moveWeapon();
doAttackMissile();
break;
case "thundertower":
idleMove();
moveWeapon();
doAttackThunder();
break;
case "plasmatower":
idleMove();
moveWeapon();
doAttackPlasma();
break;
case "guntower":
default:
idleMove();
moveWeapon();
doAttackGun();
break;
};
healthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
};
}
public function reinit(){
this.play();
this.addEventListener(MouseEvent.MOUSE_UP, showData, false, 0, true);
}
private function idleMove(){
var t:*;
t = getTimer();
this.y = (stopy + (Math.sin((((t - createtime) / 3000) * Math.PI)) * 3));
}
private function doAttackPlasma(){
if (((target) && ((targetdistance < shortestrange)))){
timer++;
if (timer >= 10){
timer = 0;
if (sided == "player"){
gamemgr.stageParticle.createPlayerBullet("plasmabullet", attack, (this.x + gun.x), (this.y + gun.y), gun.rotation, this);
} else {
gamemgr.stageParticle.createComputerBullet("plasmabullet", attack, (this.x + gun.x), (this.y + gun.y), gun.rotation, this);
};
};
};
}
}
}//package
Section 173
//UnitObjectBase (UnitObjectBase)
package {
import flash.events.*;
import flash.display.*;
public class UnitObjectBase extends MovieClip {
public var attacktimer;// = 0
private var movetimer;// = 0
public var healthbar:MovieClip;
public var attack;
private var xmove;// = 0
public var health;
public var typed;// = "unit"
public var unitstatus;// = "idle"
public var gunfire1:MovieClip;
public var gunfire2:MovieClip;
public var gunfire5:MovieClip;
public var gunfire3:MovieClip;
public var target;
public var targetdistance;
private var yspeed;
private var weaponcount;// = 2
public var gunfire4:MovieClip;
public var shuttle;
private var ymove;// = 0
public var thisparent;
private var xspeed;
public var gamemgr;
public var sided;// = "player"
public var maxhealth;
public function UnitObjectBase(){
sided = "player";
typed = "unit";
attacktimer = 0;
unitstatus = "idle";
weaponcount = 2;
xmove = 0;
ymove = 0;
movetimer = 0;
shuttle = new Array();
super();
}
private function mediumUnitIdle(){
var prevy:*;
var rnd:*;
movetimer++;
if (movetimer > 4){
movetimer = 0;
prevy = this.y;
rnd = Math.random();
xmove = 0;
ymove = 0;
if (this.scaleX < 0){
xmove = (xmove + (xspeed / 4));
} else {
xmove = (xmove - (xspeed / 4));
};
if (sided == "player"){
ymove = (ymove + (yspeed * 8));
} else {
ymove = (ymove - (yspeed * 8));
};
if (this.y > 860){
ymove = (ymove - (yspeed * 8));
} else {
if (this.y < 100){
ymove = (ymove + (yspeed * 8));
};
};
if (ymove > 1){
this.gotoAndPlay("p1");
} else {
if (ymove < -1){
this.gotoAndPlay("p3");
} else {
this.gotoAndPlay("p2");
};
};
};
if (this.x < (230 - (rnd * 200))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 200))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
}
public function init(_sided, _typed){
var i:*;
var obj:*;
var ang:*;
thisparent = MovieClip(parent);
gamemgr = thisparent.myParent;
sided = _sided;
typed = _typed;
this.cacheAsBitmap = true;
this.addEventListener(MouseEvent.MOUSE_OVER, showData, false, 0, true);
switch (typed){
case "avenger":
xspeed = 3;
yspeed = 0.6;
weaponcount = 2;
health = gamemgr.gameData.playerunithealth[0];
attack = gamemgr.gameData.playerunitattack[0];
break;
case "thunderbolt":
xspeed = 5;
yspeed = 0.5;
weaponcount = 4;
health = gamemgr.gameData.playerunithealth[1];
attack = gamemgr.gameData.playerunitattack[1];
break;
case "defender":
xspeed = 7;
yspeed = 0.5;
weaponcount = 3;
health = gamemgr.gameData.playerunithealth[2];
attack = gamemgr.gameData.playerunitattack[2];
break;
case "battlecruiser":
xspeed = 6;
yspeed = 0.5;
weaponcount = 5;
health = gamemgr.gameData.playerunithealth[3];
attack = gamemgr.gameData.playerunitattack[3];
break;
case "valour":
xspeed = 0.1;
yspeed = 0.3;
weaponcount = 2;
health = gamemgr.gameData.playerunithealth[4];
attack = gamemgr.gameData.playerunitattack[4];
break;
case "secretstriker":
xspeed = 7;
yspeed = 0.5;
weaponcount = 2;
health = gamemgr.gameData.playerunithealth[5];
attack = gamemgr.gameData.playerunitattack[5];
break;
case "intrepid":
xspeed = 3;
yspeed = 0.6;
weaponcount = 2;
health = gamemgr.gameData.computerunithealth[0];
attack = gamemgr.gameData.computerunitattack[0];
break;
case "excelsior":
xspeed = 5;
yspeed = 0.5;
weaponcount = 2;
health = gamemgr.gameData.computerunithealth[1];
attack = gamemgr.gameData.computerunitattack[1];
break;
case "steamrunner":
xspeed = 6;
yspeed = 0.5;
weaponcount = 3;
health = gamemgr.gameData.computerunithealth[2];
attack = gamemgr.gameData.computerunitattack[2];
break;
case "ptolemy":
xspeed = 7;
yspeed = 0.5;
weaponcount = 4;
health = gamemgr.gameData.computerunithealth[3];
attack = gamemgr.gameData.computerunitattack[3];
break;
case "warhammer":
xspeed = 6;
yspeed = 0.5;
weaponcount = 4;
health = gamemgr.gameData.computerunithealth[4];
attack = gamemgr.gameData.computerunitattack[4];
break;
case "vanguard":
xspeed = 0.1;
yspeed = 0.3;
weaponcount = 4;
health = gamemgr.gameData.computerunithealth[5];
attack = gamemgr.gameData.computerunitattack[5];
break;
case "aircraftcarrier":
xspeed = 0.1;
yspeed = 0.3;
weaponcount = 2;
if (sided == "player"){
health = gamemgr.gameData.playerunithealth[6];
attack = gamemgr.gameData.playerunitattack[6];
i = 0;
while (i < 5) {
obj = new mc_special4_shuttle();
thisparent.addChild(obj);
shuttle.push(obj);
obj.init(this, "player", "shuttle", health, attack);
i++;
};
} else {
health = gamemgr.gameData.computerunithealth[6];
attack = gamemgr.gameData.computerunitattack[6];
i = 0;
while (i < 5) {
obj = new mc_enemy7_shuttle();
thisparent.addChild(obj);
shuttle.push(obj);
obj.init(this, "computer", "shuttle", health, attack);
i++;
};
};
break;
};
this.gotoAndPlay("p2");
if (Math.random() < 0.5){
this.scaleX = -1;
};
maxhealth = health;
}
public function reduceHealth2(_dmg){
if (_dmg > health){
health = 0;
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
} else {
health = (health - _dmg);
};
}
private function getClosestEnemy():Object{
var dist:*;
var obj:*;
var dist2:*;
var obj2:*;
var i:*;
dist = 100;
obj = null;
if (sided == "player"){
obj = thisparent.computerBaseMC;
dist = getDistance(this, obj);
i = 0;
while (i < thisparent.computerUnits.length) {
obj2 = thisparent.computerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
i = 0;
while (i < thisparent.computerTowers.length) {
obj2 = thisparent.computerTowers[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
} else {
obj = thisparent.playerBaseMC;
dist = getDistance(this, obj);
i = 0;
while (i < thisparent.playerUnits.length) {
obj2 = thisparent.playerUnits[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
i = 0;
while (i < thisparent.playerTowers.length) {
obj2 = thisparent.playerTowers[i];
dist2 = getDistance(this, obj2);
if (dist > dist2){
dist = dist2;
obj = obj2;
};
i++;
};
};
if (obj){
target = obj;
targetdistance = dist;
};
return (obj);
}
public function getAngle(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (((Math.atan2(dy, dx) * 180) / Math.PI));
}
private function fastUnitIdle(){
var prevy:*;
var rnd:*;
if ((((this.x < (230 - (rnd * 200)))) || ((this.x > (730 + (rnd * 200)))))){
movetimer = 10;
};
movetimer++;
if (movetimer > 4){
movetimer = 0;
prevy = this.y;
rnd = Math.random();
xmove = 0;
ymove = 0;
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.scaleX < 0){
xmove = (xmove + (((xspeed * 1.5) + ((rnd * xspeed) * 0.5)) - (xspeed * 0.25)));
} else {
xmove = (xmove - (((xspeed * 1.5) + ((rnd * xspeed) * 0.5)) - (xspeed * 0.25)));
};
if (sided == "player"){
ymove = (ymove + (yspeed * 4));
} else {
ymove = (ymove - (yspeed * 4));
};
if (this.y > 860){
ymove = (ymove - (yspeed * 8));
} else {
if (this.y < 100){
ymove = (ymove + (yspeed * 8));
};
};
if (ymove > 1){
this.gotoAndPlay("p1");
} else {
if (ymove < -1){
this.gotoAndPlay("p3");
} else {
this.gotoAndPlay("p2");
};
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
}
public function deinit(){
var i:*;
if (typed == "aircraftcarrier"){
i = 0;
while (i < shuttle.length) {
shuttle[i].deinit();
i++;
};
};
if (this.currentLabel == "p1"){
this.gotoAndStop("p1");
} else {
if (this.currentLabel == "p3"){
this.gotoAndStop("p3");
} else {
this.gotoAndStop("p2");
};
};
this.removeEventListener(MouseEvent.MOUSE_UP, showData);
}
public function destroyShuttle(){
var i:*;
if (typed == "aircraftcarrier"){
i = (shuttle.length - 1);
while (i >= 0) {
thisparent.removeChild(shuttle[i]);
i--;
};
};
}
private function showData(e=null){
gamemgr.setFocusObject(this);
}
private function getDistance(_obj1, _obj2):Number{
var dx:*;
var dy:*;
dx = (_obj1.x - _obj2.x);
dy = (_obj2.y - _obj1.y);
return (Math.sqrt(((dx * dx) + (dy * dy))));
}
public function reduceHealth(_obj){
if (_obj.owned){
target = _obj.owned;
targetdistance = getDistance(this, target);
};
if (_obj.damage > health){
health = 0;
gamemgr.stageParticle.createParticle(typed, this.x, this.y, this.rotation, this.width);
unitstatus = "destroyed";
if (this.currentLabel != "destroyed"){
this.gotoAndStop("destroyed");
};
} else {
health = (health - _obj.damage);
gamemgr.stageParticle.createParticle(_obj.typed, _obj.x, _obj.y, _obj.rotation);
};
}
private function fastUnitAttack(){
var prevy:*;
var rnd:*;
if (target){
movetimer++;
if (movetimer > 4){
movetimer = 0;
prevy = this.y;
rnd = Math.random();
xmove = 0;
ymove = 0;
if (targetdistance > (200 + (Math.random() * 200))){
if (this.x < target.x){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > target.x){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
};
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.scaleX < 0){
xmove = (xmove + (((xspeed * 1.5) + ((rnd * xspeed) * 0.5)) - (xspeed * 0.25)));
} else {
xmove = (xmove - (((xspeed * 1.5) + ((rnd * xspeed) * 0.5)) - (xspeed * 0.25)));
};
if ((((targetdistance < 100)) && ((Math.abs((this.y - target.y)) < 50)))){
if (target.x < this.x){
if (this.scaleX < 0){
xmove = (xmove + (((rnd * xspeed) * 0.5) - (xspeed * 0.25)));
};
} else {
if (this.scaleX > 0){
xmove = (xmove - (((rnd * xspeed) * 0.5) - (xspeed * 0.25)));
};
};
};
if (Math.abs((target.y - this.y)) < 5){
if (target.y < this.y){
ymove = (ymove + ((yspeed * 4) + ((rnd * yspeed) * 10)));
} else {
ymove = (ymove - ((yspeed * 4) + ((rnd * yspeed) * 10)));
};
} else {
if (target.y < this.y){
ymove = (ymove - (yspeed + ((rnd * yspeed) * 4)));
} else {
ymove = (ymove + (yspeed + ((rnd * yspeed) * 4)));
};
};
if (this.y > 860){
ymove = (ymove - (yspeed * 8));
} else {
if (this.y < 100){
ymove = (ymove + (yspeed * 8));
};
};
if (ymove > 1){
this.gotoAndPlay("p1");
} else {
if (ymove < -1){
this.gotoAndPlay("p3");
} else {
this.gotoAndPlay("p2");
};
};
};
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
if (this.scaleX < 0){
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x > this.x)))){
doAttack();
};
} else {
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x < this.x)))){
doAttack();
};
};
} else {
unitstatus = "idle";
};
}
private function slowUnitIdle(){
var prevy:*;
var rnd:*;
movetimer++;
if (movetimer > 4){
movetimer = 0;
prevy = this.y;
rnd = Math.random();
xmove = 0;
ymove = 0;
if (this.scaleX < 0){
xmove = (xmove + ((xspeed * 1.5) - ((rnd * xspeed) * 0.5)));
} else {
xmove = (xmove - ((xspeed * 1.5) - ((rnd * xspeed) * 0.5)));
};
if (sided == "player"){
ymove = (ymove + yspeed);
} else {
ymove = (ymove - yspeed);
};
if (this.y > 860){
ymove = (ymove - (yspeed * 8));
} else {
if (this.y < 100){
ymove = (ymove + (yspeed * 8));
};
};
};
if (this.x < (340 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (620 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
}
private function doAttack(){
var targetonpos:*;
var ang:*;
var startx:*;
var starty:*;
targetonpos = false;
ang = (180 - getAngle(this, target));
switch (typed){
case "aircraftcarrier":
break;
case "avenger":
case "thunderbolt":
case "defender":
case "battlecruiser":
case "secretstriker":
case "intrepid":
case "excelsior":
case "steamrunner":
case "ptolemy":
case "warhammer":
default:
if (this.scaleX < 0){
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x > this.x)))){
targetonpos = true;
};
} else {
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x < this.x)))){
targetonpos = true;
};
};
if (((targetonpos) && ((gunfire1.currentFrame == 2)))){
if (this.scaleX < 0){
if (ang < 0){
if (ang < -5){
ang = -5;
};
} else {
if (ang > 5){
ang = 5;
};
};
} else {
if (ang < 0){
if (ang > -175){
ang = -175;
};
} else {
if (ang < 175){
ang = 175;
};
};
};
startx = this.x;
starty = this.y;
gunfire1.gotoAndPlay(3);
gunfire2.gotoAndPlay(3);
if (sided == "player"){
gamemgr.stageParticle.createPlayerBullet("shipgunbullet", attack, startx, starty, ang, this);
} else {
gamemgr.stageParticle.createComputerBullet("shipgunbullet", attack, startx, starty, ang, this);
};
};
break;
case "valour":
if (target != thisparent.computerBaseMC){
if (this.scaleX < 0){
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x > this.x)))){
targetonpos = true;
};
} else {
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x < this.x)))){
targetonpos = true;
};
};
if (((targetonpos) && ((gunfire1.currentFrame == 2)))){
if (this.scaleX < 0){
if (ang < 0){
if (ang < -5){
ang = -5;
};
} else {
if (ang > 5){
ang = 5;
};
};
} else {
if (ang < 0){
if (ang > -175){
ang = -175;
};
} else {
if (ang < 175){
ang = 175;
};
};
};
starty = (this.y - 20);
if (scaleX < 0){
startx = (this.x + 30);
} else {
startx = (this.x - 30);
};
gunfire1.gotoAndPlay(3);
gunfire2.gotoAndPlay(3);
gamemgr.stageParticle.createPlayerBullet("shipgunbullet", (attack / 2), startx, starty, ang, this);
};
} else {
attacktimer++;
if (attacktimer > 24){
attacktimer = 0;
if (this.scaleX > 0){
ang = 180;
} else {
ang = 0;
};
startx = this.x;
starty = this.y;
gamemgr.stageParticle.createPlayerBullet("dropbombbullet", (attack * 2), startx, starty, ang, this, target);
};
};
break;
case "vanguard":
attacktimer++;
if (attacktimer > 14){
attacktimer = 0;
if (this.scaleX > 0){
ang = 180;
} else {
ang = 0;
};
startx = this.x;
starty = this.y;
gamemgr.stageParticle.createComputerBullet("missilebullet", attack, startx, starty, ang, this, target);
};
break;
};
}
public function reinit(){
var i:*;
if (typed == "aircraftcarrier"){
i = 0;
while (i < shuttle.length) {
shuttle[i].reinit();
i++;
};
};
this.play();
this.addEventListener(MouseEvent.MOUSE_UP, showData, false, 0, true);
}
private function mediumUnitAttack(){
var prevy:*;
var rnd:*;
if (target){
movetimer++;
if (movetimer > 4){
movetimer = 0;
prevy = this.y;
rnd = Math.random();
xmove = 0;
ymove = 0;
if (this.scaleX < 0){
xmove = (xmove + ((xspeed * 1.25) + ((rnd * xspeed) * 0.5)));
} else {
xmove = (xmove - ((xspeed * 1.25) + ((rnd * xspeed) * 0.5)));
};
if ((((targetdistance < 100)) && ((Math.abs((this.y - target.y)) < 50)))){
if (target.x < this.x){
if (this.scaleX < 0){
xmove = (xmove + (((rnd * xspeed) * 0.5) - (xspeed * 0.25)));
};
} else {
if (this.scaleX > 0){
xmove = (xmove - (((rnd * xspeed) * 0.5) - (xspeed * 0.25)));
};
};
};
if (target.y < this.y){
ymove = (ymove - (yspeed + ((rnd * yspeed) * 4)));
} else {
ymove = (ymove + (yspeed + ((rnd * yspeed) * 4)));
};
if (targetdistance > (200 + (Math.random() * 400))){
if (this.x < target.x){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > target.x){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
};
if (this.y > 860){
ymove = (ymove - (yspeed * 8));
} else {
if (this.y < 100){
ymove = (ymove + (yspeed * 8));
};
};
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
if (typed != "aircraftcarrier"){
if (ymove > 1){
this.gotoAndPlay("p1");
} else {
if (ymove < -1){
this.gotoAndPlay("p3");
} else {
this.gotoAndPlay("p2");
};
};
};
};
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
if (this.scaleX < 0){
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x > this.x)))){
doAttack();
};
} else {
if ((((Math.abs((target.y - this.y)) < 50)) && ((target.x < this.x)))){
doAttack();
};
};
} else {
unitstatus = "idle";
};
}
private function slowUnitAttack(){
var prevy:*;
var rnd:*;
if (target){
movetimer++;
if (movetimer > 4){
movetimer = 0;
prevy = this.y;
rnd = Math.random();
xmove = 0;
ymove = 0;
if (this.scaleX < 0){
xmove = (xmove + ((xspeed * 1.5) - ((rnd * xspeed) * 0.5)));
} else {
xmove = (xmove - ((xspeed * 1.5) - ((rnd * xspeed) * 0.5)));
};
if (target.y < this.y){
ymove = (ymove - (yspeed + ((rnd * yspeed) * 4)));
} else {
ymove = (ymove + (yspeed + ((rnd * yspeed) * 4)));
};
if (targetdistance > 150){
if (this.x < target.x){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > target.x){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
};
if (this.y > 860){
ymove = (ymove - (yspeed * 8));
} else {
if (this.y < 100){
ymove = (ymove + (yspeed * 8));
};
};
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
if (targetdistance < 200){
if (((!((typed == "valour"))) || ((target == thisparent.computerBaseMC)))){
ymove = 0;
};
if (Math.abs((this.x - target.x)) < 50){
xmove = 0;
};
};
};
if (this.x < (230 - (rnd * 100))){
if (this.scaleX > 0){
this.scaleX = (this.scaleX * -1);
};
};
if (this.x > (730 + (rnd * 100))){
if (this.scaleX < 0){
this.scaleX = (this.scaleX * -1);
};
};
this.x = (this.x + xmove);
this.y = (this.y + ymove);
doAttack();
} else {
unitstatus = "idle";
};
}
public function moveClip(){
var i:*;
if (unitstatus != "destroyed"){
if (!target){
target = null;
getClosestEnemy();
if (target){
if (targetdistance < 300){
unitstatus = "attack";
} else {
unitstatus = "idle";
target = null;
};
};
} else {
if (target.unitstatus == "destroyed"){
target = null;
getClosestEnemy();
if (target){
if (targetdistance < 300){
unitstatus = "attack";
} else {
unitstatus = "idle";
target = null;
};
};
} else {
targetdistance = getDistance(this, target);
};
};
} else {
target = null;
};
switch (typed){
case "avenger":
case "intrepid":
default:
switch (unitstatus){
case "idle":
mediumUnitIdle();
break;
case "attack":
mediumUnitAttack();
break;
};
break;
case "thunderbolt":
case "defender":
case "battlecruiser":
case "secretstriker":
case "excelsior":
case "steamrunner":
case "ptolemy":
case "warhammer":
switch (unitstatus){
case "idle":
fastUnitIdle();
break;
case "attack":
fastUnitAttack();
break;
};
break;
case "valour":
if (getDistance(this, thisparent.computerBaseMC) < 300){
target = thisparent.computerBaseMC;
if (unitstatus != "destroyed"){
unitstatus = "attack";
};
};
case "vanguard":
case "aircraftcarrier":
switch (unitstatus){
case "idle":
slowUnitIdle();
break;
case "attack":
slowUnitAttack();
break;
};
if (typed == "aircraftcarrier"){
i = 0;
while (i < shuttle.length) {
shuttle[i].moveClip();
i++;
};
};
break;
};
healthbar.gotoAndStop((Math.floor(((health / maxhealth) * 100)) + 1));
}
}
}//package