Section 1
//explosion_38 (Commodore_fla.explosion_38)
package Commodore_fla {
import flash.display.*;
public dynamic class explosion_38 extends MovieClip {
public function explosion_38(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package Commodore_fla
Section 2
//PauseUnpause_28 (Commodore_fla.PauseUnpause_28)
package Commodore_fla {
import flash.events.*;
import flash.display.*;
public dynamic class PauseUnpause_28 extends MovieClip {
public var unpauseButton:SimpleButton;
public var pauseButton:SimpleButton;
public function PauseUnpause_28(){
addFrameScript(0, frame1, 1, frame2);
}
public function pauseClick(_arg1:MouseEvent):void{
game.gameState = game.FSM_PAUSED;
gotoAndStop(2);
}
function frame1(){
stop();
switch (game.gameState){
case game.FSM_PAUSED:
gotoAndStop(2);
break;
case game.FSM_GAMEOVER:
gotoAndStop(3);
break;
};
pauseButton.addEventListener(MouseEvent.CLICK, pauseClick, false, 0, true);
}
function frame2(){
stop();
unpauseButton.addEventListener(MouseEvent.CLICK, unpauseClick, false, 0, true);
}
public function unpauseClick(_arg1:MouseEvent):void{
game.gameState = game.FSM_RUNNING;
gotoAndStop(1);
}
}
}//package Commodore_fla
Section 3
//Slider_25 (Commodore_fla.Slider_25)
package Commodore_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.geom.*;
public dynamic class Slider_25 extends MovieClip {
public var val:Number;
public var sliderLine:MovieClip;
public var sliderBar:MovieClip;
public function Slider_25(){
addFrameScript(0, frame1);
}
public function sliderDown(_arg1:MouseEvent):void{
sliderBar.startDrag(false, new Rectangle(sliderLine.x, sliderLine.y, sliderLine.width, 0));
stage.addEventListener(MouseEvent.MOUSE_UP, sliderUp, false, 0, true);
addEventListener(Event.ENTER_FRAME, updateVal, false, 0, true);
}
public function sliderUp(_arg1:MouseEvent):void{
sliderBar.stopDrag();
stage.removeEventListener(MouseEvent.MOUSE_UP, sliderUp, false);
removeEventListener(Event.ENTER_FRAME, updateVal, false);
}
function frame1(){
val = SoundMixer.soundTransform.volume;
sliderBar.x = (val * sliderLine.width);
sliderBar.addEventListener(MouseEvent.MOUSE_DOWN, sliderDown, false, 0, true);
}
public function updateVal(_arg1:Event):void{
var _local2:SoundTransform;
if (Math.abs((val - (sliderBar.x / sliderLine.width))) > 0.1){
val = (sliderBar.x / sliderLine.width);
_local2 = SoundMixer.soundTransform;
_local2.volume = val;
SoundMixer.soundTransform = _local2;
};
}
}
}//package Commodore_fla
Section 4
//TimeGamesIntro_2 (Commodore_fla.TimeGamesIntro_2)
package Commodore_fla {
import flash.display.*;
public dynamic class TimeGamesIntro_2 extends MovieClip {
public function TimeGamesIntro_2(){
addFrameScript(159, frame160);
}
function frame160(){
MovieClip(parent).gotoAndPlay("PreMainMenu");
}
}
}//package Commodore_fla
Section 5
//fpsBox (fps.fpsBox)
package fps {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
public class fpsBox extends TextField {
protected var format:TextFormat;
protected var averageArray:Array;
protected var targetFPS:int;// = 0
protected var frames:uint;// = 0
public function fpsBox(... _args){
var _local2:Timer;
frames = 0;
format = new TextFormat();
averageArray = new Array();
targetFPS = 0;
super();
_local2 = new Timer(1000);
format.font = "Verdana";
format.color = 0;
format.size = 10;
this.autoSize = TextFieldAutoSize.LEFT;
this.defaultTextFormat = format;
this.text = "-- FPS ---- AV";
_local2.addEventListener(TimerEvent.TIMER, tick);
if ((_args[0] is Stage)){
_args[0].addEventListener(Event.ENTER_FRAME, everyFrame, false, 0, true);
targetFPS = _args[0].frameRate;
} else {
this.addEventListener(Event.ENTER_FRAME, everyFrame, false, 0, true);
};
_local2.start();
}
public function everyFrame(_arg1:Event):void{
frames++;
}
protected function tick(_arg1:TimerEvent):void{
var _local2:int;
averageArray.push(frames);
if (averageArray.length == 4){
_local2 = 1;
while (_local2 < averageArray.length) {
averageArray[0] = (averageArray[0] + averageArray[_local2]);
_local2++;
};
averageArray.splice(1, (averageArray.length - 1));
averageArray[0] = (averageArray[0] / 4);
};
this.text = (((frames + " FPS ") + Math.round(averageArray[0])) + " AV");
if (targetFPS != 0){
this.appendText((" /" + targetFPS));
};
frames = 0;
}
}
}//package fps
Section 6
//BaseGun (gun_pack.BaseGun)
package gun_pack {
import flash.display.*;
import unit_package.*;
import projectiles.*;
public class BaseGun extends MovieClip {
public const FSM_LOADED = 1;
public const FSM_IDLE = 0;
public const FSM_LOADING = 2;
protected var clips:Number;
private var gunState:Number;
protected var loadDelay:Number;
protected var shotType:Number;
protected var reloadDelay:Number;
protected var clipSize:Number;
protected var wait:Number;
protected var ammo:Number;
public function BaseGun(){
gunState = FSM_LOADED;
}
public function getWait():Number{
return (wait);
}
public function getAmmo():Number{
return (ammo);
}
public function Process():void{
if (gunState == FSM_LOADING){
wait--;
if (wait <= 0){
if (ammo == 0){
ammo = clipSize;
};
gunState = FSM_LOADED;
};
};
}
public function set angle(_arg1:Number):void{
rotation = (_arg1 + 90);
}
public function getGunState():Number{
return (gunState);
}
public function get angle():Number{
return ((rotation - 90));
}
public function Shoot(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BaseUnit):void{
var _local6:Projectile;
if (gunState != FSM_LOADED){
return;
};
_local6 = game.curLevel.addShot(shotType, _arg1, _arg2, _arg3, this.angle);
_local6.tUnit = _arg5;
ammo--;
if (ammo <= 0){
if (clips != 0){
clips--;
if (_arg1 == 0){
wait = Math.round((reloadDelay / (game.curLevel.rateMod / 100)));
} else {
wait = reloadDelay;
};
gunState = FSM_LOADING;
} else {
gunState = FSM_IDLE;
};
} else {
if (_arg1 == 0){
wait = Math.round((loadDelay / (game.curLevel.rateMod / 100)));
} else {
wait = loadDelay;
};
gunState = FSM_LOADING;
};
}
}
}//package gun_pack
Section 7
//Gun_Cannon (gun_pack.Gun_Cannon)
package gun_pack {
public class Gun_Cannon extends BaseGun {
public function Gun_Cannon(){
addFrameScript(0, frame1);
super();
shotType = DATA.GUN_CANNON_STYPE;
clipSize = DATA.GUN_CANNON_CLSIZ;
clips = DATA.GUN_CANNON_CLIPS;
loadDelay = DATA.GUN_CANNON_LDELY;
reloadDelay = DATA.GUN_CANNON_RDELY;
ammo = clipSize;
}
function frame1(){
stop();
}
}
}//package gun_pack
Section 8
//Gun_Machin (gun_pack.Gun_Machin)
package gun_pack {
import unit_package.*;
public class Gun_Machin extends BaseGun {
private var Switch:Boolean;// = false
public function Gun_Machin(){
Switch = false;
super();
shotType = DATA.GUN_MACHIN_STYPE;
clipSize = DATA.GUN_MACHIN_CLSIZ;
clips = DATA.GUN_MACHIN_CLIPS;
loadDelay = DATA.GUN_MACHIN_LDELY;
reloadDelay = DATA.GUN_MACHIN_RDELY;
ammo = clipSize;
}
override public function Shoot(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BaseUnit):void{
var _local6:Number;
if (Switch){
_local6 = 8;
} else {
_local6 = -8;
};
Switch = !(Switch);
super.Shoot(_arg1, (_arg2 + _local6), _arg3, _arg4, _arg5);
}
}
}//package gun_pack
Section 9
//Gun_Mortar (gun_pack.Gun_Mortar)
package gun_pack {
public class Gun_Mortar extends BaseGun {
public function Gun_Mortar(){
shotType = DATA.GUN_MORTAR_STYPE;
clipSize = DATA.GUN_MORTAR_CLSIZ;
clips = DATA.GUN_MORTAR_CLIPS;
loadDelay = DATA.GUN_MORTAR_LDELY;
reloadDelay = DATA.GUN_MORTAR_RDELY;
ammo = clipSize;
}
}
}//package gun_pack
Section 10
//Gun_Rocket (gun_pack.Gun_Rocket)
package gun_pack {
import flash.display.*;
import flash.geom.*;
import unit_package.*;
public class Gun_Rocket extends BaseGun {
public var boom:MovieClip;
private var Shot:int;// = 1
public function Gun_Rocket(){
Shot = 1;
addFrameScript(0, frame1, 5, frame6, 10, frame11, 15, frame16, 20, frame21, 25, frame26, 30, frame31, 35, frame36, 40, frame41);
super();
shotType = DATA.GUN_ROCKET_STYPE;
clipSize = DATA.GUN_ROCKET_CLSIZ;
clips = DATA.GUN_ROCKET_CLIPS;
loadDelay = DATA.GUN_ROCKET_LDELY;
reloadDelay = DATA.GUN_ROCKET_RDELY;
ammo = clipSize;
}
function frame6(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame11(){
gotoAndStop(1);
}
function frame21(){
gotoAndStop(1);
}
function frame16(){
gotoAndStop(1);
}
function frame36(){
gotoAndStop(1);
}
function frame31(){
gotoAndStop(1);
}
function frame26(){
gotoAndStop(1);
}
function frame41(){
gotoAndStop(1);
}
override public function Shoot(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:BaseUnit):void{
var _local6:int;
var _local7:Point;
_local6 = (-12.6 + (8 * ((Shot - 1) % 4)));
gotoAndPlay(("Shoot" + Shot));
_local7 = game.curLevel.localizePoint(localToGlobal(new Point(_local6, 0)));
Shot++;
if (Shot > 8){
Shot = 1;
};
super.Shoot(_arg1, _local7.x, _local7.y, _arg4, _arg5);
}
}
}//package gun_pack
Section 11
//KeyObject (keyObject.KeyObject)
package keyObject {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.ui.*;
public dynamic class KeyObject extends Proxy {
private static var keysDown:Object;
private static var stage:Stage;
public function KeyObject(_arg1:Stage){
construct(_arg1);
}
private function keyPressed(_arg1:KeyboardEvent):void{
keysDown[_arg1.keyCode] = true;
}
public function construct(_arg1:Stage):void{
KeyObject.stage = _arg1;
keysDown = new Object();
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
_arg1.addEventListener(KeyboardEvent.KEY_UP, keyReleased);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (((_arg1 in Keyboard)) ? Keyboard[_arg1] : -1);
}
public function isDown(_arg1:uint):Boolean{
return (Boolean((_arg1 in keysDown)));
}
private function keyReleased(_arg1:KeyboardEvent):void{
delete keysDown[_arg1.keyCode];
}
public function deconstruct():void{
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyReleased);
keysDown = new Object();
KeyObject.stage = null;
}
}
}//package keyObject
Section 12
//MochiBot (mochibot.MochiBot)
package mochibot {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package mochibot
Section 13
//Bullet (projectiles.Bullet)
package projectiles {
public class Bullet extends Projectile {
public function Bullet(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
speed = DATA.PRO_BULLET_SPEED;
damage = DATA.PRO_BULLET_DAMAG;
life = DATA.PRO_BULLET_LIFEX;
Build();
}
override public function paint(){
graphics.clear();
graphics.lineStyle(1, 0, 1);
graphics.beginFill(0, 1);
graphics.moveTo(-10, 0);
graphics.lineTo(20, 0);
rotation = angle;
}
}
}//package projectiles
Section 14
//CannonBall (projectiles.CannonBall)
package projectiles {
public class CannonBall extends Projectile {
public function CannonBall(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
x = _arg3;
y = _arg4;
speed = DATA.PRO_CANNON_SPEED;
damage = DATA.PRO_CANNON_DAMAG;
life = DATA.PRO_CANNON_LIFEX;
Build();
}
override public function paint(){
graphics.clear();
graphics.lineStyle(1, 0, 1);
graphics.beginFill(0, 1);
graphics.drawCircle(-1.5, -1.5, 3);
}
}
}//package projectiles
Section 15
//MortarShell (projectiles.MortarShell)
package projectiles {
public class MortarShell extends Projectile {
public function MortarShell(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
speed = DATA.PRO_MORTAR_SPEED;
damage = DATA.PRO_MORTAR_DAMAG;
life = DATA.PRO_MORTAR_LIFEX;
Build();
}
override public function paint(){
graphics.clear();
graphics.lineStyle(1, 0, 1);
graphics.beginFill(0, 1);
graphics.drawCircle(-2.5, -2.5, 5);
}
}
}//package projectiles
Section 16
//Projectile (projectiles.Projectile)
package projectiles {
import flash.display.*;
import flash.geom.*;
import unit_package.*;
public class Projectile extends Sprite {
public var life:Number;
public var tUnit:BaseUnit;
public var speed:Number;
public var damage:Number;
public var Vel:Point;
public var angle:Number;
public var force:Number;
public function Projectile(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
Vel = new Point();
super();
angle = _arg1;
force = _arg2;
x = _arg3;
y = _arg4;
mouseEnabled = false;
}
protected function Rad(_arg1:Number):Number{
return ((_arg1 * (Math.PI / 180)));
}
public function Build():void{
Vel.x = (speed * Math.cos(Rad(angle)));
Vel.y = (speed * Math.sin(Rad(angle)));
paint();
}
public function Process(){
if (life <= 0){
trace("ghost!");
};
Think();
Act();
life--;
if (life <= 0){
Destroy();
};
}
public function paint(){
graphics.clear();
graphics.lineStyle(1, 0, 1);
graphics.beginFill(0, 1);
graphics.drawCircle(-1, -1, 2);
}
public function Act(){
x = (x + Vel.x);
y = (y + Vel.y);
if (tUnit != null){
if (((tUnit.isAlive) && ((game.Distance(tUnit, this) < tUnit.size)))){
if (force == 0){
tUnit.takeDamage(((this.damage * game.curLevel.damageMod) / 100));
} else {
tUnit.takeDamage(this.damage);
};
Destroy();
};
};
}
public function Think(){
}
public function Destroy():void{
Vel = null;
tUnit = null;
game.curLevel.removeShot(this);
}
protected function Deg(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
}
}//package projectiles
Section 17
//Rocket (projectiles.Rocket)
package projectiles {
import flash.display.*;
import flash.geom.*;
import unit_package.*;
public class Rocket extends Projectile {
private var level:MovieClip;
public function Rocket(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number){
level = game.curLevel;
super(_arg1, _arg2, _arg3, _arg4);
speed = DATA.PRO_ROCKET_SPEED;
damage = DATA.PRO_ROCKET_DAMAG;
life = DATA.PRO_ROCKET_LIFEX;
Build();
}
protected function Distance(_arg1):Number{
return (Math.sqrt((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y)))));
}
private function AcquireClosestTarget():BaseUnit{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = 1000;
_local2 = -1;
_local3 = 0;
_local4 = 0;
while (_local4 < level.liveUnits.length) {
if (level.liveUnits[_local4].force != force){
_local3 = Distance(level.liveUnits[_local4]);
if (_local3 < _local1){
_local1 = _local3;
_local2 = _local4;
};
};
_local4++;
};
return (level.liveUnits[_local2]);
}
override public function paint(){
graphics.clear();
graphics.lineStyle(1, 0, 1);
graphics.moveTo(-12, -3);
graphics.beginFill(0, 1);
graphics.lineTo(-12, 3);
graphics.lineTo(10, 0);
rotation = angle;
}
private function AngleTo(_arg1):Number{
return (Deg(Math.atan2((_arg1.y - y), (_arg1.x - x))));
}
override public function Think(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
if (tUnit == null){
tUnit = AcquireClosestTarget();
} else {
if (!tUnit.isAlive){
tUnit = AcquireClosestTarget();
};
};
if (tUnit != null){
_local1 = AngleTo(tUnit);
_local2 = (_local1 - angle);
_local3 = (_local1 - (angle + 360));
if ((((_local2 == 0)) || ((_local3 == 0)))){
angle = angle;
} else {
if (Math.abs(_local2) < Math.abs(_local3)){
angle = (angle + ((_local2 / Math.abs(_local2)) * 5));
} else {
angle = (angle + ((_local3 / Math.abs(_local3)) * 5));
};
};
Vel.x = (speed * Math.cos(Rad(angle)));
Vel.y = (speed * Math.sin(Rad(angle)));
rotation = angle;
};
}
}
}//package projectiles
Section 18
//Tab1 (tab_menu.Tab1)
package tab_menu {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import unit_package.*;
public class Tab1 extends MovieClip {
const WORST_RATE = 200;
const IDEAL_RANGE = 1000;
const IDEAL_DAMAGE = 100;
public var rateBar:MovieClip;
public var txtName:TextField;
public var selectedUnit_mc:MovieClip;
public var damageBar:MovieClip;
private var range:Number;
public var txtCost:TextField;
public var tabbar:tab_bar;
private var units:Array;
private var dispUnit:MovieClip;
private var damage:Number;
public var rangeBar:MovieClip;
private var uName:String;
private var cost:Number;
private var selectedUnit:Number;// = 0
private var rate:Number;
public function Tab1(){
var _local1:MovieClip;
units = new Array();
selectedUnit = 0;
super();
_local1 = new unit_btn(DATA.TUR_CANNON);
_local1.x = (25 / 2);
_local1.y = (25 / 2);
_local1.x = (_local1.x + 62.5);
_local1.y = (_local1.y + 5);
tabbar.display.addChild(_local1);
units[0] = _local1;
_local1 = new unit_btn(DATA.TUR_MORTAR);
_local1.x = (25 / 2);
_local1.y = (25 / 2);
_local1.x = (_local1.x + 92.5);
_local1.y = (_local1.y + 5);
tabbar.display.addChild(_local1);
units[1] = _local1;
_local1 = new unit_btn(DATA.TUR_ROCKET);
_local1.x = (25 / 2);
_local1.y = (25 / 2);
_local1.x = (_local1.x + 122.5);
_local1.y = (_local1.y + 5);
tabbar.display.addChild(_local1);
units[2] = _local1;
_local1 = new unit_btn(DATA.TUR_MACHIN);
_local1.x = (25 / 2);
_local1.y = (25 / 2);
_local1.x = (_local1.x + 152.5);
_local1.y = (_local1.y + 5);
tabbar.display.addChild(_local1);
units[3] = _local1;
dispUnit = new unit_btn(units[selectedUnit].type);
selectedUnit_mc.addChild(dispUnit);
selectedUnit_mc.addEventListener(MouseEvent.MOUSE_DOWN, downHandler);
selectedUnit_mc.buttonMode = true;
tabbar.leftarrow.addEventListener(MouseEvent.CLICK, leftClick);
tabbar.rightarrow.addEventListener(MouseEvent.CLICK, rightClick);
tabbar.rightarrow.buttonMode = true;
tabbar.leftarrow.buttonMode = true;
changeUnit();
}
private function downHandler(_arg1:MouseEvent):void{
game.curLevel.setBuildState(units[selectedUnit].type, cost, range);
_arg1.stopPropagation();
}
private function changeUnit():void{
switch (units[selectedUnit].type){
case DATA.TUR_CANNON:
uName = DATA.TUR_CANNON_NAMEX;
cost = DATA.TUR_CANNON_PRICE;
range = DATA.GUN_CANNON_RANGE;
damage = DATA.PRO_CANNON_DAMAG;
rate = DATA.GUN_CANNON_DELAY;
break;
case DATA.TUR_MORTAR:
uName = DATA.TUR_MORTAR_NAMEX;
cost = DATA.TUR_MORTAR_PRICE;
range = DATA.GUN_MORTAR_RANGE;
damage = DATA.PRO_MORTAR_DAMAG;
rate = DATA.GUN_MORTAR_DELAY;
break;
case DATA.TUR_ROCKET:
uName = DATA.TUR_ROCKET_NAMEX;
cost = DATA.TUR_ROCKET_PRICE;
range = DATA.GUN_ROCKET_RANGE;
damage = DATA.PRO_ROCKET_DAMAG;
rate = DATA.GUN_ROCKET_DELAY;
break;
case DATA.TUR_MACHIN:
uName = DATA.TUR_MACHIN_NAMEX;
cost = DATA.TUR_MACHIN_PRICE;
range = DATA.GUN_MACHIN_RANGE;
damage = DATA.PRO_BULLET_DAMAG;
rate = DATA.GUN_MACHIN_DELAY;
break;
};
rangeBar.scaleX = (range / IDEAL_RANGE);
damageBar.scaleX = (damage / IDEAL_DAMAGE);
rateBar.scaleX = ((WORST_RATE - rate) / WORST_RATE);
txtCost.text = (cost + "");
txtName.text = uName;
selectedUnit_mc.removeChild(dispUnit);
dispUnit = new unit_btn(units[selectedUnit].type);
selectedUnit_mc.addChild(dispUnit);
}
private function leftClick(_arg1:MouseEvent):void{
var _local2:*;
if (selectedUnit > 0){
_local2 = 0;
while (_local2 < units.length) {
units[_local2].x = (units[_local2].x + 30);
_local2++;
};
selectedUnit--;
};
changeUnit();
}
private function rightClick(_arg1:MouseEvent):void{
var _local2:*;
if (selectedUnit < (units.length - 1)){
_local2 = 0;
while (_local2 < units.length) {
units[_local2].x = (units[_local2].x - 30);
_local2++;
};
selectedUnit++;
};
changeUnit();
}
}
}//package tab_menu
Section 19
//Tab2 (tab_menu.Tab2)
package tab_menu {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import unit_package.*;
public class Tab2 extends MovieClip {
public var range_up_btn:upgrade_button;
public var rate_up_btn:upgrade_button;
private var rateVal:int;// = 100
private var damageVal:int;// = 100
public var damage_up_bar:MovieClip;
private var armorVal:int;// = 1
public var armor_up_bar:MovieClip;
public var damage_up_btn:upgrade_button;
public var range_up_bar:MovieClip;
private var rangeVal:int;// = 100
public var rate_up_bar:MovieClip;
public var armor_up_btn:upgrade_button;
public function Tab2(){
rangeVal = DATA.RANGE_INIT_VAL;
rateVal = DATA.RATE_INIT_VAL;
damageVal = DATA.DAMAGE_INIT_VAL;
armorVal = DATA.ARMOR_INIT_VAL;
super();
range_up_btn.addEventListener(MouseEvent.CLICK, rangeUpClick);
rate_up_btn.addEventListener(MouseEvent.CLICK, rateUpClick);
damage_up_btn.addEventListener(MouseEvent.CLICK, damageUpClick);
armor_up_btn.addEventListener(MouseEvent.CLICK, armorUpClick);
Update();
}
private function damageUpClick(_arg1:MouseEvent){
if (game.curLevel.money >= DATA.DAMAGE_UP_PRICE(damageVal)){
if (damageVal < DATA.DAMAGE_MAX_VAL){
game.curLevel.money = (game.curLevel.money - DATA.DAMAGE_UP_PRICE(damageVal));
damageVal = (damageVal + DATA.DAMAGE_STEP_VAL);
Update();
} else {
Console.out("You're maxed out!", true);
};
} else {
Console.out("You can't afford it!", true);
};
}
private function armorUpClick(_arg1:MouseEvent){
if (game.curLevel.money >= DATA.ARMOR_UP_PRICE(armorVal)){
if (armorVal < DATA.ARMOR_MAX_VAL){
game.curLevel.money = (game.curLevel.money - DATA.ARMOR_UP_PRICE(armorVal));
armorVal = (armorVal + DATA.ARMOR_STEP_VAL);
Update();
} else {
Console.out("You're maxed out!", true);
};
} else {
Console.out("You can't afford it!", true);
};
}
private function rateUpClick(_arg1:MouseEvent){
if (game.curLevel.money >= DATA.RATE_UP_PRICE(rateVal)){
if (rateVal < DATA.RATE_MAX_VAL){
game.curLevel.money = (game.curLevel.money - DATA.RATE_UP_PRICE(rateVal));
rateVal = (rateVal + DATA.RATE_STEP_VAL);
Update();
} else {
Console.out("You're maxed out!", true);
};
} else {
Console.out("You can't afford it!", true);
};
}
private function rangeUpClick(_arg1:MouseEvent){
var _local2:int;
if (game.curLevel.money >= DATA.RANGE_UP_PRICE(rangeVal)){
if (rangeVal < DATA.RANGE_MAX_VAL){
game.curLevel.money = (game.curLevel.money - DATA.RANGE_UP_PRICE(rangeVal));
rangeVal = (rangeVal + DATA.RANGE_STEP_VAL);
Update();
_local2 = 0;
while (_local2 < game.curLevel.selectedUnits.length) {
game.curLevel.selectedUnits[_local2].isSelected = game.curLevel.selectedUnits[_local2].isSelected;
_local2++;
};
} else {
Console.out("You're maxed out!", true);
};
} else {
Console.out("You can't afford it!", true);
};
}
private function Update(){
range_up_bar.scaleX = (rangeVal / DATA.RANGE_MAX_VAL);
rate_up_bar.scaleX = (rateVal / DATA.RATE_MAX_VAL);
damage_up_bar.scaleX = (damageVal / DATA.DAMAGE_MAX_VAL);
armor_up_bar.scaleX = (armorVal / DATA.ARMOR_MAX_VAL);
if (rangeVal < DATA.RANGE_MAX_VAL){
range_up_btn.dtext.text = ("$" + DATA.RANGE_UP_PRICE(rangeVal));
} else {
range_up_btn.dtext.text = "max";
};
if (rateVal < DATA.RATE_MAX_VAL){
rate_up_btn.dtext.text = ("$" + DATA.RATE_UP_PRICE(rateVal));
} else {
rate_up_btn.dtext.text = "max";
};
if (damageVal < DATA.DAMAGE_MAX_VAL){
damage_up_btn.dtext.text = ("$" + DATA.DAMAGE_UP_PRICE(damageVal));
} else {
damage_up_btn.dtext.text = "max";
};
if (armorVal < DATA.ARMOR_MAX_VAL){
armor_up_btn.dtext.text = ("$" + DATA.ARMOR_UP_PRICE(armorVal));
} else {
armor_up_btn.dtext.text = "max";
};
try {
game.curLevel.rangeMod = rangeVal;
game.curLevel.rateMod = rateVal;
game.curLevel.damageMod = damageVal;
game.curLevel.armorMod = armorVal;
} catch(e:Error) {
};
}
}
}//package tab_menu
Section 20
//Tab3 (tab_menu.Tab3)
package tab_menu {
import flash.display.*;
public dynamic class Tab3 extends MovieClip {
}
}//package tab_menu
Section 21
//TabMenu (tab_menu.TabMenu)
package tab_menu {
import flash.display.*;
import flash.events.*;
public class TabMenu extends MovieClip {
var topTab:Number;
var tabs:Array;
public function TabMenu(){
tabs = new Array();
super();
tabs[0] = new Tab3();
addChild(tabs[0]);
tabs[1] = new Tab2();
addChild(tabs[1]);
tabs[2] = new Tab1();
addChild(tabs[2]);
topTab = 2;
tabs[0].addEventListener(MouseEvent.CLICK, clickHandler0);
tabs[1].addEventListener(MouseEvent.CLICK, clickHandler1);
tabs[2].addEventListener(MouseEvent.CLICK, clickHandler2);
}
private function clickHandler0(_arg1:MouseEvent):void{
swapChildren(tabs[0], tabs[topTab]);
topTab = 0;
}
private function clickHandler1(_arg1:MouseEvent):void{
swapChildren(tabs[1], tabs[topTab]);
topTab = 1;
}
private function clickHandler2(_arg1:MouseEvent):void{
swapChildren(tabs[2], tabs[topTab]);
topTab = 2;
}
public function Destroy():void{
removeChild(tabs[0]);
removeChild(tabs[1]);
removeChild(tabs[2]);
tabs[0].removeEventListener(MouseEvent.CLICK, clickHandler0);
tabs[1].removeEventListener(MouseEvent.CLICK, clickHandler1);
tabs[2].removeEventListener(MouseEvent.CLICK, clickHandler2);
tabs.length = 0;
tabs = null;
}
}
}//package tab_menu
Section 22
//upgrade_button (tab_menu.upgrade_button)
package tab_menu {
import flash.display.*;
import flash.text.*;
public class upgrade_button extends MovieClip {
public var dtext:TextField;
public function upgrade_button(){
dtext.mouseEnabled = false;
}
}
}//package tab_menu
Section 23
//Armory (unit_package.Armory)
package unit_package {
import flash.display.*;
public class Armory extends Building {
private var ilife:Number;
public function Armory(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
base_mc = new Armory_mc();
gun_mc = new MovieClip();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
size = 100;
Build();
}
override public function get isBuilding():Boolean{
return (true);
}
}
}//package unit_package
Section 24
//BaseUnit (unit_package.BaseUnit)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
public class BaseUnit extends MovieClip {
public const ACT_NONE:Number = 0;
public const ACT_WAIT:Number = 3;
public const ACT_WALK:Number = 1;
public const ACT_SHOOT:Number = 2;
public var size:Number;// = 50
private var ialive:Boolean;// = false
private var iselected:Boolean;// = false
protected var meta_mc:MovieClip;
private var iforce:Number;
private var irange:Number;
private var iarmor:Number;
protected var gun_mc:MovieClip;
private var ilife:Number;
public var mValue:Number;// = 0
private var ix:Number;
private var iy:Number;
private var ia:Number;
private var iwait:Number;
protected var level:MovieClip;
protected var hbar_mc:MovieClip;
protected var base_mc:MovieClip;
private var imaxlife:Number;
protected var range_mc:unit_range_indicator;
public function BaseUnit(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
ialive = false;
iselected = false;
size = 50;
mValue = 0;
super();
maxlife = 100;
armor = 0;
level = _arg1;
iforce = _arg2;
x = _arg3;
y = _arg4;
ilife = 100;
ialive = true;
iwait = 0;
}
protected function Distance(_arg1):Number{
return (Math.sqrt((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y)))));
}
protected function AcquireClosestTarget():BaseUnit{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:*;
_local1 = 10000;
_local2 = -1;
_local3 = 0;
_local4 = 0;
while (_local4 < level.liveUnits.length) {
if (level.liveUnits[_local4].force != force){
_local3 = Distance(level.liveUnits[_local4]);
if (_local3 < _local1){
_local1 = _local3;
_local2 = _local4;
};
};
_local4++;
};
return (level.liveUnits[_local2]);
}
public function Build(){
if (base_mc != null){
level.units_base.addChild(base_mc);
base_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
};
if (gun_mc != null){
level.units_gun.addChild(gun_mc);
gun_mc.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
};
if (hbar_mc != null){
level.hp_bar.addChild(hbar_mc);
};
if (meta_mc != null){
level.meta.addChild(meta_mc);
range_mc = new unit_range_indicator(range, !((force == 0)));
meta_mc.addChild(range_mc);
};
cacheAsBitmap = true;
isSelected = false;
x = ix;
y = iy;
angle = 0;
}
private function mouseDownHandler(_arg1:MouseEvent){
if (level.fsmState != Level.FSM_BUILD_STATE){
level.setSelectState(new Array(this));
};
_arg1.stopPropagation();
}
public function Process(){
try {
wait--;
if (wait <= 0){
Think();
Act();
};
if (gun_mc != null){
gun_mc.Process();
};
} catch(e:Error) {
};
}
public function get maxlife():Number{
return (imaxlife);
}
public function get isInfantry():Boolean{
return (false);
}
override public function get x():Number{
return (ix);
}
override public function get y():Number{
return (iy);
}
public function set armor(_arg1:Number):void{
iarmor = _arg1;
}
public function Act(){
}
protected function AngleTo(_arg1):Number{
return (Deg(Math.atan2((_arg1.y - y), (_arg1.x - x))));
}
public function set range(_arg1:Number):void{
irange = _arg1;
}
public function get isTurret():Boolean{
return (false);
}
public function set maxlife(_arg1:Number):void{
imaxlife = _arg1;
}
public function Think(){
}
public function get angle():Number{
return (ia);
}
public function takeDamage(_arg1:Number):void{
var _local2:Number;
_local2 = (_arg1 - (armor * 2));
if (_local2 < 1){
_local2 = 1;
};
life = (life - _local2);
}
public function set wait(_arg1:Number):void{
iwait = _arg1;
}
public function get force():Number{
return (iforce);
}
override public function set x(_arg1:Number):void{
ix = _arg1;
if (base_mc != null){
base_mc.x = ix;
};
if (gun_mc != null){
gun_mc.x = ix;
};
if (hbar_mc != null){
hbar_mc.x = ix;
};
if (meta_mc != null){
meta_mc.x = ix;
};
}
override public function set y(_arg1:Number):void{
iy = _arg1;
if (base_mc != null){
base_mc.y = iy;
};
if (gun_mc != null){
gun_mc.y = iy;
};
if (hbar_mc != null){
hbar_mc.y = iy;
};
if (meta_mc != null){
meta_mc.y = iy;
};
}
public function get life():Number{
return (ilife);
}
public function get range():Number{
if (force == 0){
return (((irange * level.rangeMod) / 100));
};
return (irange);
}
public function get armor():Number{
if (force == 0){
return ((iarmor + level.armorMod));
};
return (iarmor);
}
public function get wait():Number{
return (iwait);
}
public function set angle(_arg1:Number):void{
ia = _arg1;
rotation = (_arg1 + 90);
if (ia < -180){
ia = (ia + 360);
};
if (ia > 180){
ia = (ia - 360);
};
}
public function get isAlive():Boolean{
return (ialive);
}
public function set isSelected(_arg1:Boolean):void{
iselected = _arg1;
range_mc.Update(range);
if (hbar_mc != null){
hbar_mc.visible = _arg1;
};
if (meta_mc != null){
meta_mc.visible = _arg1;
};
}
public function Destroy(_arg1:Boolean=false){
ialive = false;
if (base_mc != null){
level.units_base.removeChild(base_mc);
base_mc.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
base_mc = null;
};
if (gun_mc != null){
level.units_gun.removeChild(gun_mc);
gun_mc.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
gun_mc = null;
};
if (hbar_mc != null){
level.hp_bar.removeChild(hbar_mc);
hbar_mc = null;
};
if (meta_mc != null){
level.meta.removeChild(meta_mc);
meta_mc = null;
};
if (((!((mValue == 0))) && (!(_arg1)))){
level.kills++;
level.money = (level.money + (maxlife * mValue));
};
level.removeUnit(this);
level = null;
}
public function get isSelected():Boolean{
return (iselected);
}
protected function Deg(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
protected function Rad(_arg1:Number):Number{
return (((_arg1 * Math.PI) / 180));
}
public function set life(_arg1:Number):void{
ilife = _arg1;
hbar_mc.life(((ilife / maxlife) * 100));
if (life <= 0){
Destroy();
};
}
public function get isBuilding():Boolean{
return (false);
}
protected function TurnTo(_arg1):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = AngleTo(_arg1);
_local3 = (_local2 - this.angle);
_local4 = 0;
if (Math.abs(_local3) > 3){
if ((((((_local3 > 0)) && ((_local3 < 180)))) || ((_local3 < -180)))){
_local4 = 3;
} else {
_local4 = -3;
};
};
return ((this.angle + _local4));
}
}
}//package unit_package
Section 25
//Building (unit_package.Building)
package unit_package {
import flash.display.*;
public class Building extends BaseUnit {
public function Building(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
}
override public function get isBuilding():Boolean{
return (true);
}
}
}//package unit_package
Section 26
//Cannon (unit_package.Cannon)
package unit_package {
import flash.display.*;
import flash.events.*;
import projectiles.*;
import gun_pack.*;
public final class Cannon extends Turret {
public function Cannon(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
armor = DATA.TUR_CANNON_ARMOR;
range = DATA.GUN_CANNON_RANGE;
base_mc = new Tur_Base();
gun_mc = new Gun_Cannon();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
}
override public function Act(){
switch (option){
case ACT_WALK:
break;
case ACT_SHOOT:
Shoot();
wait = gun_mc.getWait();
break;
case ACT_WAIT:
wait = 18;
break;
};
option = ACT_NONE;
}
override public function Think(){
super.Think();
}
override protected function Shoot():void{
gun_mc.Shoot(force, x, y, angle, tUnit);
gun_mc.gotoAndPlay("Shoot");
}
}
}//package unit_package
Section 27
//CC (unit_package.CC)
package unit_package {
import flash.display.*;
public class CC extends Building {
public function CC(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
base_mc = new CommandCenter();
gun_mc = null;
hbar_mc = null;
meta_mc = new MovieClip();
Build();
}
override public function set isSelected(_arg1:Boolean):void{
}
override public function takeDamage(_arg1:Number):void{
level.cchealth = (level.cchealth - 1);
}
}
}//package unit_package
Section 28
//Infantry (unit_package.Infantry)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import projectiles.*;
public class Infantry extends BaseUnit {
protected var tUnit:BaseUnit;
protected var speed:Number;// = 3
public var command:Array;
protected var option:Number;// = 0
public function Infantry(_arg1:Level, _arg2:Number, _arg3:Number, _arg4:Number){
command = new Array();
speed = 3;
option = 0;
super(_arg1, _arg2, _arg3, _arg4);
command[0] = new Array();
command[0][0] = 0;
mValue = 0.1;
}
override public function set rotation(_arg1:Number):void{
if (base_mc != null){
base_mc.rotation = _arg1;
};
if (gun_mc != null){
gun_mc.rotation = _arg1;
};
}
protected function Shoot():void{
var _local1:Projectile;
_local1 = level.addShot(DATA.PRO_BULLET, force, x, y, angle);
_local1.tUnit = this.tUnit;
}
override public function get isInfantry():Boolean{
return (true);
}
override public function get rotation():Number{
return (base_mc.rotation);
}
protected function RunCommand():Boolean{
var _local1:Boolean;
var _local2:Point;
_local1 = false;
if (command[0] != undefined){
_local1 = true;
switch (command[0][0]){
case DATA.CMD_MOVE:
_local2 = new Point(command[0][1], command[0][2]);
if (Distance(_local2) <= (speed * 10)){
command.splice(0, 1);
} else {
angle = TurnTo(_local2);
option = ACT_WALK;
};
break;
case DATA.CMD_ATTK:
_local2 = new Point(command[0][1], command[0][2]);
if (Distance(_local2) <= (speed * 10)){
command.splice(0, 1);
} else {
angle = TurnTo(_local2);
option = ACT_WALK;
};
_local1 = false;
break;
default:
_local1 = false;
};
};
return (_local1);
}
protected function Walk():void{
x = (x + (speed * Math.cos(Rad(angle))));
y = (y + (speed * Math.sin(Rad(angle))));
}
}
}//package unit_package
Section 29
//Machine (unit_package.Machine)
package unit_package {
import flash.display.*;
import flash.events.*;
import projectiles.*;
import gun_pack.*;
public final class Machine extends Turret {
private var Switch:Boolean;// = false
public function Machine(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
Switch = false;
super(_arg1, _arg2, _arg3, _arg4);
armor = DATA.TUR_MACHIN_ARMOR;
range = DATA.GUN_MACHIN_RANGE;
base_mc = new Tur_Base();
gun_mc = new Gun_Machin();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
}
override public function Act(){
switch (option){
case ACT_WALK:
break;
case ACT_SHOOT:
Shoot();
wait = gun_mc.getWait();
break;
case ACT_WAIT:
wait = 18;
break;
};
option = ACT_NONE;
}
override public function Think(){
super.Think();
}
}
}//package unit_package
Section 30
//Mortar (unit_package.Mortar)
package unit_package {
import flash.display.*;
import flash.events.*;
import projectiles.*;
import gun_pack.*;
public final class Mortar extends Turret {
public function Mortar(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
armor = DATA.TUR_MORTAR_ARMOR;
range = DATA.GUN_MORTAR_RANGE;
base_mc = new Tur_Base();
gun_mc = new Gun_Mortar();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
}
override public function Act(){
switch (option){
case ACT_WALK:
break;
case ACT_SHOOT:
Shoot();
wait = gun_mc.getWait();
break;
case ACT_WAIT:
wait = 18;
break;
};
option = ACT_NONE;
}
override public function Think(){
super.Think();
}
override protected function Shoot():void{
gun_mc.Shoot(force, x, y, angle, tUnit);
}
}
}//package unit_package
Section 31
//Rockets (unit_package.Rockets)
package unit_package {
import flash.display.*;
import flash.events.*;
import projectiles.*;
import gun_pack.*;
public final class Rockets extends Turret {
public function Rockets(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
armor = DATA.TUR_ROCKET_ARMOR;
range = DATA.GUN_ROCKET_RANGE;
base_mc = new Tur_Base();
gun_mc = new Gun_Rocket();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
}
override public function Act(){
switch (option){
case ACT_SHOOT:
Shoot();
wait = gun_mc.getWait();
break;
case ACT_WAIT:
wait = 18;
break;
};
option = ACT_NONE;
}
override public function Think(){
super.Think();
}
override protected function Shoot():void{
gun_mc.Shoot(force, x, y, angle, tUnit);
}
}
}//package unit_package
Section 32
//Soldier (unit_package.Soldier)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public final class Soldier extends Infantry {
public function Soldier(_arg1:Level, _arg2:Number, _arg3:Number, _arg4:Number){
super(_arg1, _arg2, _arg3, _arg4);
range = 500;
size = 35;
base_mc = new unit_soldier();
gun_mc = new unit_gun();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
base_mc.scaleX = 0.5;
base_mc.scaleY = 0.5;
gun_mc.scaleX = 0.5;
gun_mc.scaleY = 0.5;
hbar_mc.scaleX = 0.5;
hbar_mc.scaleY = 0.5;
}
override public function Act(){
switch (option){
case ACT_WALK:
Walk();
wait = 0;
break;
case ACT_SHOOT:
Shoot();
wait = (36 + int((Math.random() * 8)));
break;
};
option = ACT_NONE;
}
override public function Think(){
var _local1:*;
if (!RunCommand()){
if (tUnit == null){
tUnit = AcquireClosestTarget();
} else {
if (((!(tUnit.isAlive)) || ((Distance(tUnit) > range)))){
tUnit = AcquireClosestTarget();
};
};
if (tUnit != null){
if (Distance(tUnit) < range){
option = ACT_SHOOT;
} else {
if (Distance(tUnit) < (2 * range)){
option = ACT_WALK;
};
};
angle = AngleTo(tUnit);
};
for each (_local1 in level.liveUnits) {
if ((((Distance(_local1) < size)) && (!((_local1 == this))))){
angle = (AngleTo(_local1) + 180);
option = ACT_WALK;
};
};
};
if (option == ACT_NONE){
angle = AngleTo(new Point(0, 0));
option = ACT_WALK;
};
}
}
}//package unit_package
Section 33
//Truck (unit_package.Truck)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import gun_pack.*;
public final class Truck extends Infantry {
private const GUN_OFFSET:Point;
public function Truck(_arg1:Level, _arg2:Number, _arg3:Number, _arg4:Number){
GUN_OFFSET = new Point(0, 0);
super(_arg1, _arg2, _arg3, _arg4);
range = 0;
base_mc = new Truck1();
gun_mc = null;
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
isSelected = false;
size = 100;
speed = 6;
mValue = 0.1;
}
override public function Act(){
switch (option){
case ACT_WALK:
Walk();
wait = 0;
break;
};
option = ACT_NONE;
}
public function QuickBuild(){
angle = AngleTo(new Point(command[1][1], command[1][2]));
}
override public function set isSelected(_arg1:Boolean):void{
super.isSelected = _arg1;
hbar_mc.visible = true;
}
override public function Think(){
if (!RunCommand()){
level.cchealth = (level.cchealth - 10);
mValue = 0;
takeDamage(maxlife);
};
}
}
}//package unit_package
Section 34
//TruckGunner (unit_package.TruckGunner)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import gun_pack.*;
public final class TruckGunner extends Infantry {
private const GUN_OFFSET:Point;
public function TruckGunner(_arg1:Level, _arg2:Number, _arg3:Number, _arg4:Number){
GUN_OFFSET = new Point(0, 0);
super(_arg1, _arg2, _arg3, _arg4);
range = 700;
base_mc = new Truck2();
gun_mc = new Gun_Cannon();
hbar_mc = new unit_health_bar();
meta_mc = new MovieClip();
Build();
isSelected = false;
size = 100;
speed = 6;
mValue = 0.1;
}
override public function set rotation(_arg1:Number):void{
if (base_mc != null){
base_mc.rotation = _arg1;
};
}
override public function set y(_arg1:Number):void{
var _local2:Point;
super.y = _arg1;
if (gun_mc){
_local2 = base_mc.localToGlobal(GUN_OFFSET);
_local2 = level.localizePoint(_local2);
gun_mc.y = _local2.y;
};
}
override public function Act(){
switch (option){
case ACT_WALK:
Walk();
wait = 0;
break;
};
option = ACT_NONE;
}
public function QuickBuild(){
angle = AngleTo(new Point(command[1][1], command[1][2]));
}
override public function set isSelected(_arg1:Boolean):void{
super.isSelected = _arg1;
hbar_mc.visible = true;
}
override public function Think(){
if (!RunCommand()){
level.cchealth = (level.cchealth - 10);
mValue = 0;
takeDamage(maxlife);
};
tUnit = AcquireClosestTarget();
if (tUnit != null){
if (Distance(tUnit) < range){
if (gun_mc.getGunState() == gun_mc.FSM_LOADED){
gun_mc.angle = AngleTo(tUnit);
Shoot();
} else {
gun_mc.Process();
};
} else {
gun_mc.rotation = base_mc.rotation;
};
} else {
gun_mc.rotation = base_mc.rotation;
};
}
override public function set x(_arg1:Number):void{
var _local2:Point;
super.x = _arg1;
if (gun_mc){
_local2 = base_mc.localToGlobal(GUN_OFFSET);
_local2 = level.localizePoint(_local2);
gun_mc.x = _local2.x;
};
}
override protected function Shoot():void{
gun_mc.Shoot(force, x, y, angle, tUnit);
}
}
}//package unit_package
Section 35
//Turret (unit_package.Turret)
package unit_package {
import flash.display.*;
import flash.events.*;
import projectiles.*;
public class Turret extends BaseUnit {
protected var tUnit:BaseUnit;
public var command:Number;// = 0
protected var option:Number;// = 0
public function Turret(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number){
command = 0;
option = 0;
super(_arg1, _arg2, _arg3, _arg4);
}
override public function set rotation(_arg1:Number):void{
gun_mc.rotation = _arg1;
}
protected function Shoot():void{
gun_mc.Shoot(force, x, y, angle, tUnit);
}
override public function get rotation():Number{
return (gun_mc.rotation);
}
override public function get isTurret():Boolean{
return (true);
}
override public function Think(){
if (tUnit == null){
tUnit = AcquireClosestTarget();
} else {
if (((!(tUnit.isAlive)) || ((Distance(tUnit) > range)))){
tUnit = AcquireClosestTarget();
};
};
if (tUnit != null){
if (gun_mc.getGunState() == gun_mc.FSM_LOADED){
if (Distance(tUnit) < range){
option = ACT_SHOOT;
angle = AngleTo(tUnit);
};
};
} else {
option = ACT_WAIT;
};
}
}
}//package unit_package
Section 36
//unit_btn (unit_package.unit_btn)
package unit_package {
import flash.display.*;
import gun_pack.*;
public class unit_btn extends MovieClip {
private var level:MovieClip;
public var type:int;
public function unit_btn(_arg1:int){
type = _arg1;
level = game.curLevel;
switch (type){
case DATA.INF_SOLDIE:
addChild(new unit_soldier());
addChild(new unit_gun());
break;
case DATA.TUR_CANNON:
addChild(new Tur_Base());
addChild(new Gun_Cannon());
break;
case DATA.TUR_ROCKET:
addChild(new Tur_Base());
addChild(new Gun_Rocket());
break;
case DATA.TUR_MORTAR:
addChild(new Tur_Base());
addChild(new Gun_Mortar());
break;
case DATA.TUR_MACHIN:
addChild(new Tur_Base());
addChild(new Gun_Machin());
break;
case DATA.BLD_ARMORY:
addChild(new Armory_mc());
break;
default:
trace(("Error in unit_btn - UnitID does not exist: " + type));
};
scaleX = 0.5;
scaleY = 0.5;
}
}
}//package unit_package
Section 37
//unit_health_bar (unit_package.unit_health_bar)
package unit_package {
import flash.display.*;
public class unit_health_bar extends MovieClip {
private var bar:health_bar;
public function unit_health_bar(){
bar = new health_bar();
bar.x = -25;
bar.y = -39;
addChild(bar);
}
public function life(_arg1:Number):void{
bar.width = int((_arg1 / 2));
}
}
}//package unit_package
Section 38
//unit_range_indicator (unit_package.unit_range_indicator)
package unit_package {
import flash.display.*;
public class unit_range_indicator extends Sprite {
private const LINE_ALPHA:Number = 1;
private const GOOD_LINE:Number = 5614131;
private const EVIL_FILL:Number = 13382485;
private const FILL_ALPHA:Number = 0.05;
private const GOOD_FILL:Number = 7851093;
private const EVIL_LINE:Number = 11162931;
private var range:Number;// = 0
private var fillColor:Number;
private var lineColor:Number;
public function unit_range_indicator(_arg1:int, _arg2:Boolean=false){
range = 0;
super();
if (_arg2){
lineColor = EVIL_LINE;
fillColor = EVIL_LINE;
} else {
lineColor = GOOD_LINE;
fillColor = GOOD_LINE;
};
Update(_arg1);
cacheAsBitmap = true;
}
public function Update(_arg1:Number){
var range = _arg1;
try {
if (this.range != range){
this.range = range;
graphics.clear();
graphics.lineStyle(3, lineColor, LINE_ALPHA);
graphics.beginFill(fillColor, FILL_ALPHA);
graphics.drawCircle(0, 0, range);
};
} catch(e:Error) {
trace(("Error: " + range));
};
}
}
}//package unit_package
Section 39
//Unit_Spawn_Area (unit_package.Unit_Spawn_Area)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
public class Unit_Spawn_Area {
private var level:Level;
private var spawnArea:Rectangle;
private var force:Number;
private var target:Point;
private var type:Number;
public function Unit_Spawn_Area(_arg1:Level, _arg2:Number, _arg3:Number){
level = _arg1;
type = _arg2;
force = _arg3;
}
public function Destroy():void{
level = null;
spawnArea = null;
target = null;
}
public function setTarget(_arg1:Point){
target = _arg1;
}
public function setSpawn(_arg1:Rectangle){
spawnArea = _arg1;
}
public function spawnUnits(_arg1:Number, _arg2:Number):void{
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:*;
_local3 = new Array();
_local6 = 0;
while (_local6 < _arg1) {
_local4 = (Math.floor((Math.random() * spawnArea.width)) + spawnArea.x);
_local5 = (Math.floor((Math.random() * spawnArea.height)) + spawnArea.y);
_local3[_local6] = level.addUnit(type, force, _local4, _local5);
_local3[_local6].command = new Array(new Array(DATA.CMD_ATTK, target.x, target.y));
_local3[_local6].maxlife = _arg2;
_local3[_local6].life = _arg2;
_local6++;
};
_local3.length = 0;
_local3 = null;
}
}
}//package unit_package
Section 40
//Unit_Spawner (unit_package.Unit_Spawner)
package unit_package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Unit_Spawner {
private const VALUE_MOD_PER_ROUND_DECAY = 0.99;
private const IPS:Number = 12;
private const FSM_IDLE = 0;
private const FSM_SPAWNING = 1;
private var level:Level;
private var spawnWait:Number;
private var state:Number;// = 0
private var VALUE_MOD_PER_ROUND;// = 0.5
private var type:Number;// = -1
private var idleTime:Number;// = 180
private var timer:Timer;
private var switchWait:Number;
private var command:Array;
private var UNIT_START_VALUE;// = 0.15
private var curLife:Number;// = 100
private var lifeMod:Number;// = 1.5
private var spawnTime:Number;// = 36
private var force:Number;// = -1
private var roundTime:Number;// = 360
private var uValue;
public function Unit_Spawner(_arg1:Level){
var ilevel = _arg1;
UNIT_START_VALUE = 0.15;
VALUE_MOD_PER_ROUND = 0.5;
type = -1;
force = -1;
command = [[-1, -1, -1]];
spawnTime = (36 * 1);
roundTime = (36 * 10);
idleTime = (36 * 5);
spawnWait = spawnTime;
switchWait = roundTime;
state = FSM_IDLE;
curLife = 100;
lifeMod = 1.5;
uValue = UNIT_START_VALUE;
timer = new Timer((1000 / IPS));
super();
level = ilevel;
Array.prototype.copy = function (){
var _local1:*;
var _local2:*;
_local1 = new Array();
if (this.length == 0){
for (_local2 in this) {
_local1[_local2] = this[_local2];
};
};
_local2 = 0;
while (_local2 < this.length) {
_local1[_local2] = this[_local2];
_local2++;
};
return (_local1);
};
timer.addEventListener(TimerEvent.TIMER, mainLoop, false, 0, true);
timer.start();
}
public function setTimer(_arg1:Number){
spawnTime = Math.round((_arg1 * IPS));
}
public function setCommand(_arg1:Array){
command = _arg1;
}
public function setForce(_arg1:Number){
force = _arg1;
}
public function setValue(_arg1:Number){
UNIT_START_VALUE = _arg1;
uValue = _arg1;
}
public function sendNextWave(){
if (state == FSM_IDLE){
switchWait = 0;
};
}
public function setType(_arg1:Number){
type = _arg1;
}
private function activated():Boolean{
return (((((((!((type == -1))) && (!((force == -1))))) && (!((level == null))))) && ((game.gameState == game.FSM_RUNNING))));
}
public function setRound(_arg1:Number){
roundTime = Math.round((_arg1 * IPS));
}
public function Destroy():void{
timer.removeEventListener(TimerEvent.TIMER, mainLoop, false);
timer.stop();
timer = null;
command.length = 0;
command = null;
level = null;
}
public function setIdle(_arg1:Number){
idleTime = Math.round((_arg1 * IPS));
}
private function mainLoop(_arg1:TimerEvent):void{
var _local2:MovieClip;
var _local3:int;
if (activated()){
if (switchWait > 0){
switchWait--;
};
switch (state){
case FSM_SPAWNING:
if (spawnWait > 0){
spawnWait--;
} else {
_local3 = int((Math.random() * 750));
if (_local3 > game.curLevel.kills){
_local2 = level.addUnit(type, force, command[0][1], command[0][2]);
} else {
_local2 = level.addUnit((type + 1), force, command[0][1], command[0][2]);
};
_local2.command = command.copy();
_local2.QuickBuild();
_local2.maxlife = curLife;
_local2.life = curLife;
_local2.mValue = uValue;
lifeMod = (lifeMod * 1.01);
curLife = (curLife + lifeMod);
spawnWait = spawnTime;
};
if (switchWait <= 0){
state = FSM_IDLE;
switchWait = idleTime;
trace("Switch to Idle:");
};
break;
case FSM_IDLE:
if (switchWait <= 0){
state = FSM_SPAWNING;
switchWait = roundTime;
spawnWait = 0;
Console.out("New wave of enemies detected!");
trace("Switch to Spawning");
uValue = (uValue * (VALUE_MOD_PER_ROUND + 0.5));
VALUE_MOD_PER_ROUND = (VALUE_MOD_PER_ROUND * VALUE_MOD_PER_ROUND_DECAY);
trace(uValue);
};
break;
};
};
}
}
}//package unit_package
Section 41
//Apocalypse (Apocalypse)
package {
import flash.media.*;
public dynamic class Apocalypse extends Sound {
}
}//package
Section 42
//Armory_mc (Armory_mc)
package {
import flash.display.*;
public dynamic class Armory_mc extends MovieClip {
}
}//package
Section 43
//attack_ico (attack_ico)
package {
import flash.display.*;
public dynamic class attack_ico extends MovieClip {
}
}//package
Section 44
//CH (CH)
package {
import flash.display.*;
public dynamic class CH extends MovieClip {
}
}//package
Section 45
//CommandCenter (CommandCenter)
package {
import flash.display.*;
public dynamic class CommandCenter extends MovieClip {
}
}//package
Section 46
//Commodore (Commodore)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import mochibot.*;
import flash.media.*;
import flash.ui.*;
public class Commodore extends MovieClip {
public var medButton:SimpleButton;
public var lbar:MovieClip;
public var instrButton:SimpleButton;
public var lpc:TextField;
public var creditsButton:SimpleButton;
public var t:SoundTransform;
public var playButton:SimpleButton;
public var easyButton:SimpleButton;
public var backButton:SimpleButton;
public var hardButton:SimpleButton;
public function Commodore(){
var _local1:ContextMenu;
super();
addFrameScript(0, frame1, 19, frame20, 29, frame30, 49, frame50, 50, frame51, 59, frame60, 69, frame70, 79, frame80, 93, frame94, 98, frame99, 103, frame104);
game.initiate(this, stage);
stage.quality = StageQuality.MEDIUM;
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
contextMenu = _local1;
}
function frame70(){
stop();
backButton.addEventListener(MouseEvent.CLICK, backClickHandler);
}
function frame80(){
stop();
backButton.addEventListener(MouseEvent.CLICK, backClickHandler);
}
public function backClickHandler(_arg1:MouseEvent){
gotoAndStop("MainMenu");
}
public function hardClickHandler(_arg1:MouseEvent){
gotoAndStop("lvl3");
game.startGame(3);
}
public function gotoPlayMenu(_arg1:MouseEvent){
gotoAndStop("PlayMenu");
}
function frame94(){
gotoAndPlay("PreMainMenu");
}
function frame1(){
stop();
addEventListener(Event.ENTER_FRAME, updatePreloader);
}
function frame104(){
gotoAndPlay("PreMainMenu");
}
function frame30(){
stop();
}
function frame20(){
MochiBot.track(this, "2dbe6be5");
gotoAndPlay("TG Intro");
}
public function medClickHandler(_arg1:MouseEvent){
gotoAndStop("lvl2");
game.startGame(2);
}
function frame99(){
gotoAndPlay("PreMainMenu");
}
public function updatePreloader(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
_local2 = root.loaderInfo.bytesLoaded;
_local3 = root.loaderInfo.bytesTotal;
_local4 = ((_local2 / _local3) * 100);
if (_local2 == _local3){
removeEventListener(Event.ENTER_FRAME, updatePreloader);
play();
} else {
lbar.scaleX = (_local4 / 100);
lpc.text = (((((("loaded: " + _local2) + "/") + _local3) + " = ") + _local4) + "%");
};
}
public function gotoInstructions(_arg1:MouseEvent){
gotoAndStop("Instructions");
}
public function gotoCredits(_arg1:MouseEvent){
gotoAndStop("Credits");
}
function frame51(){
stop();
playButton.addEventListener(MouseEvent.CLICK, gotoPlayMenu);
instrButton.addEventListener(MouseEvent.CLICK, gotoInstructions);
creditsButton.addEventListener(MouseEvent.CLICK, gotoCredits);
}
function frame50(){
t = SoundMixer.soundTransform;
t.volume = 0.75;
SoundMixer.soundTransform = t;
}
public function easyClickHandler(_arg1:MouseEvent){
gotoAndStop("lvl1");
game.startGame(1);
}
function frame60(){
stop();
easyButton.addEventListener(MouseEvent.CLICK, easyClickHandler, false, 0, true);
medButton.addEventListener(MouseEvent.CLICK, medClickHandler, false, 0, true);
hardButton.addEventListener(MouseEvent.CLICK, hardClickHandler, false, 0, true);
backButton.addEventListener(MouseEvent.CLICK, backClickHandler, false, 0, true);
}
}
}//package
Section 47
//Console (Console)
package {
import flash.text.*;
import flash.media.*;
public class Console {
static var dest:TextField;
static var errSound:Sound = new ErrorSound();
static var msgSound:Sound = new MsgSound();
public static function Initiate(_arg1:TextField){
dest = _arg1;
}
public static function out(_arg1:String, _arg2:Boolean=false){
dest.text = ((_arg1 + "\n\n") + dest.text);
if (_arg2){
errSound.play();
} else {
msgSound.play();
};
}
}
}//package
Section 48
//DATA (DATA)
package {
import flash.geom.*;
public class DATA {
public static const GUN_CANNON_CLIPS:Number = -1;
public static const GUN_CANNON_RANGE:Number = 600;
public static const GUN_CANNON_RDELY:Number = 55;
public static const GUN_MACHIN_CLIPS:Number = -1;
public static const PRO_ROCKET_LIFEX:Number = 160;
public static const DAMAGE_INIT_VAL:int = 100;
public static const PRO_CANBAL:Number = 502;
public static const CMD_PATR:Number = 104;
public static const ARMOR_STEP_VAL:int = 1;
public static const GUN_MACHIN_RDELY:Number = 55;
public static const TUR_RADARX:Number = 16;
public static const PRO_CANNON_DAMAG:Number = 15;
public static const GUN_MACHIN_RANGE:Number = 350;
public static const RANGE_INIT_VAL:int = 100;
public static const GUN_MORTAR_CLSIZ:Number = 1;
public static const GUN_CANNON_DELAY:Number = 45;
public static const RANGE_MAX_VAL:int = 160;
public static const ARMOR_MAX_VAL:int = 4;
public static const NO_SELECTION:Number = 0;
public static const PRO_MORTAR_SPEED:Number = 35;
public static const ARMOR_INIT_VAL:int = 1;
public static const GUN_MACHIN_DELAY:Number = 6;
public static const BLD_RADIOX:Number = 25;
public static const TUR_MORTAR_ARMOR:Number = 2;
public static const PRO_MORTAR:Number = 503;
public static const PRO_BULLET_DAMAG:Number = 12;
public static const TUR_MORTAR_PRICE:Number = 300;
public static const TUR_MORTAR_NAMEX:String = "Mortar";
public static const GUN_ROCKET_CLIPS:Number = -1;
public static const SELECTION_BOX_COLOR:Number = 2250018;
public static const GUN_MORTAR_STYPE:Number = 503;
public static const TUR_MORTAR:Number = 17;
public static const BLD_ARMORY_PRICE:Number = 100;
public static const BLD_ARMORY_NAMEX:String = "Armory";
public static const GUN_MORTAR_LDELY:Number = 0;
public static const BLD_GENERA:Number = 24;
public static const GUN_ROCKET_RANGE:Number = 950;
public static const GUN_ROCKET_RDELY:Number = 108;
public static const DAMAGE_MAX_VAL:int = 500;
public static const GUN_CANNON_CLSIZ:Number = 3;
public static const CMD_HOLD:Number = 103;
public static const PRO_ROCKET:Number = 504;
public static const PRO_CANNON_SPEED:Number = 45;
public static const GUN_MACHIN_CLSIZ:Number = 30;
public static const PRO_ROCKET_DAMAG:Number = 35;
public static const BLD_COMMAN:Number = 21;
public static const TUR_ROCKET:Number = 15;
public static const TUR_CANNON_ARMOR:Number = 4;
public static const PRO_BULLET:Number = 501;
public static const TUR_CANNON_PRICE:Number = 200;
public static const GUN_ROCKET_DELAY:Number = 36;
public static const TUR_CANNON_NAMEX:String = "Cannon";
public static const INF_PILOTX:Number = 5;
public static const GUN_CANNON_STYPE:Number = 502;
public static const TUR_CANNON:Number = 12;
public static const TUR_MACHIN_ARMOR:Number = 3;
public static const PRO_MISSIL:Number = 505;
public static const INF_CIVILI:Number = 4;
public static const TUR_MACHIN_PRICE:Number = 550;
public static const GUN_CANNON_LDELY:Number = 20;
public static const PRO_BULLET_SPEED:Number = 50;
public static const TUR_MACHIN_NAMEX:String = "Machine Gun";
public static const PRO_MORTAR_LIFEX:Number = 25;
public static const RATE_MAX_VAL:int = 250;
public static const GUN_MACHIN_STYPE:Number = 501;
public static const TUR_MISSIL:Number = 14;
public static const INF_SOLDIE:Number = 2;
public static const GUN_MACHIN_LDELY:Number = 6;
public static const BLD_FUELTA:Number = 27;
public static const GUN_ROCKET_CLSIZ:Number = 8;
public static const BLD_HELIPA:Number = 26;
public static const VEH_TRUCKG:Number = 11;
public static const PRO_ROCKET_SPEED:Number = 30;
public static const VEH_TRUCKX:Number = 10;
public static const TUR_ROCKET_ARMOR:Number = 0;
public static const INF_SCOUTX:Number = 3;
public static const RATE_STEP_VAL:int = 15;
public static const TUR_ROCKET_NAMEX:String = "Rocket";
public static const GUN_MORTAR_CLIPS:Number = -1;
public static const PRO_CANNON_LIFEX:Number = 30;
public static const GUN_ROCKET_STYPE:Number = 504;
public static const TUR_ROCKET_PRICE:Number = 450;
public static const GUN_MORTAR_RANGE:Number = 450;
public static const GUN_MORTAR_RDELY:Number = 142;
public static const GUN_ROCKET_LDELY:Number = 36;
public static const BLD_ARMORY:Number = 23;
public static const MIN_ZOOM:Number = 0.25;
public static const BLD_BARRAC:Number = 22;
public static const INF_WORKER:Number = 1;
public static const PRO_BULLET_LIFEX:Number = 20;
public static const CMD_MOVE:Number = 101;
public static const DAMAGE_STEP_VAL:int = 50;
public static const RATE_INIT_VAL:int = 100;
public static const TUR_MACHIN:Number = 13;
public static const PRO_MORTAR_DAMAG:Number = 100;
public static const MAX_ZOOM:Number = 1;
public static const CMD_ATTK:Number = 102;
public static const RANGE_STEP_VAL:int = 15;
public static const GUN_MORTAR_DELAY:Number = 142;
public static var path1:Array = new Array();
public static var path3:Array = new Array();
public static var path2:Array = new Array();
public static function initiate(){
}
public static function RATE_UP_PRICE(_arg1:int):int{
return ((150 + ((0.05 * _arg1) * _arg1)));
}
public static function DAMAGE_UP_PRICE(_arg1:int):int{
return ((50 + ((0.025 * _arg1) * _arg1)));
}
public static function RANGE_UP_PRICE(_arg1:int):int{
return ((-300 + (10 * _arg1)));
}
public static function ARMOR_UP_PRICE(_arg1:int):int{
return ((250 + (_arg1 * 250)));
}
path1[0] = new Point(700, -1850);
path1[1] = new Point(400, -1400);
path1[2] = new Point(700, -900);
path1[3] = new Point(1150, -850);
path1[4] = new Point(1500, -1000);
path1[5] = new Point(1950, -750);
path1[6] = new Point(2100, -300);
path1[7] = new Point(2450, 0);
path1[8] = new Point(2600, 500);
path1[9] = new Point(2400, 850);
path1[10] = new Point(2000, 1100);
path1[11] = new Point(1650, 1200);
path1[12] = new Point(1400, 1100);
path1[13] = new Point(1300, 900);
path1[14] = new Point(1400, 700);
path1[15] = new Point(1700, 600);
path1[16] = new Point(1800, 300);
path1[17] = new Point(1650, 100);
path1[18] = new Point(1300, 50);
path1[19] = new Point(1050, 200);
path1[20] = new Point(900, 550);
path1[21] = new Point(750, 800);
path1[22] = new Point(350, 800);
path1[23] = new Point(150, 550);
path1[24] = new Point(150, 150);
path2[0] = new Point(-4000, -2000);
path2[1] = new Point(-3000, -1900);
path2[2] = new Point(-2000, -1600);
path2[3] = new Point(-1500, -1100);
path2[4] = new Point(-1500, -600);
path2[5] = new Point(-1950, -100);
path2[6] = new Point(-2050, 300);
path2[7] = new Point(-1700, 700);
path2[8] = new Point(-1000, 1000);
path2[9] = new Point(-500, 1000);
path2[10] = new Point(-50, 800);
path2[11] = new Point(0, 600);
path2[12] = new Point(0, 400);
path2[13] = new Point(100, 200);
path3[0] = new Point(-100, 2000);
path3[1] = new Point(-50, 1550);
path3[2] = new Point(150, 1325);
path3[3] = new Point(600, 1000);
path3[4] = new Point(725, 800);
path3[5] = new Point(650, 500);
path3[6] = new Point(400, 350);
path3[7] = new Point(190, 325);
path3[8] = new Point(150, 200);
}
}//package
Section 49
//DeepHatred (DeepHatred)
package {
import flash.media.*;
public dynamic class DeepHatred extends Sound {
}
}//package
Section 50
//EndlessDesert (EndlessDesert)
package {
import flash.media.*;
public dynamic class EndlessDesert extends Sound {
}
}//package
Section 51
//ErrorSound (ErrorSound)
package {
import flash.media.*;
public dynamic class ErrorSound extends Sound {
}
}//package
Section 52
//game (game)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import unit_package.*;
import keyObject.*;
public class game {
public static const FSM_RUNNING = 1;
public static const FSM_GAMEOVER = 3;
public static const FSM_STOPPED = 0;
public static const FSM_PAUSED = 2;
public static var timeline:MovieClip;
public static var gameover:Boolean = true;
public static var currentLevel:Number = 1;
public static var key:KeyObject;
public static var curLevel:Level;
public static var dest:Stage;
public static var gameState:Number = 0;
public static function Distance(_arg1, _arg2):Number{
return (Math.sqrt((((_arg1.x - _arg2.x) * (_arg1.x - _arg2.x)) + ((_arg1.y - _arg2.y) * (_arg1.y - _arg2.y)))));
}
public static function initiate(_arg1:MovieClip, _arg2:Stage){
timeline = _arg1;
dest = _arg2;
key = new KeyObject(dest);
DATA.initiate();
dest.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
}
public static function loadLevel(_arg1:Number){
trace(("Load Level: " + _arg1));
if (curLevel != null){
endLevel();
} else {
trace("Current level null.");
};
switch (_arg1){
case 1:
curLevel = new Level(dest, DATA.path1, 1);
curLevel.addUnit(DATA.TUR_ROCKET, 0, 550, 150);
curLevel.addUnit(DATA.TUR_MACHIN, 0, 20, 360);
curLevel.addUnit(DATA.TUR_MACHIN, 0, 300, 355);
curLevel.addUnit(DATA.TUR_CANNON, 0, 50, -965);
break;
case 2:
curLevel = new Level(dest, DATA.path2, 2);
curLevel.addUnit(DATA.TUR_ROCKET, 0, 400, 25);
curLevel.addUnit(DATA.TUR_MACHIN, 0, 170, 280);
curLevel.addUnit(DATA.TUR_MORTAR, 0, -2100, -1200);
curLevel.addUnit(DATA.TUR_CANNON, 0, -1600, 200);
break;
case 3:
curLevel = new Level(dest, DATA.path3, 3);
curLevel.addUnit(DATA.TUR_ROCKET, 0, -125, 355);
curLevel.addUnit(DATA.TUR_MACHIN, 0, 400, 225);
curLevel.addUnit(DATA.TUR_CANNON, 0, 110, 550);
curLevel.addUnit(DATA.TUR_ROCKET, 0, -165, 800);
curLevel.addUnit(DATA.TUR_CANNON, 0, -210, 860);
break;
default:
trace("Error: No such level.");
};
currentLevel = _arg1;
gameState = FSM_RUNNING;
}
private static function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:Boolean;
_local2 = true;
switch (_arg1.charCode){
case 43:
if (curLevel != null){
curLevel.zoomIn();
};
break;
case 45:
if (curLevel != null){
curLevel.zoomOut();
};
break;
};
}
public static function endLevel(){
curLevel.Destroy();
curLevel = null;
gameState = FSM_STOPPED;
}
public static function startGame(_arg1:Number){
loadLevel(_arg1);
}
public static function endGame(){
endLevel();
timeline.play();
}
public static function mainLoop(_arg1:Event):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:SubmitHighScore;
if (curLevel == null){
return;
};
if (gameState == FSM_GAMEOVER){
return;
};
if (gameState == FSM_PAUSED){
return;
};
if (curLevel.cchealth == 0){
gameState = FSM_GAMEOVER;
_local5 = new SubmitHighScore();
_local5.setKills(curLevel.kills);
curLevel.addChild(_local5);
Console.out("Game Over.");
return;
};
_local4 = 0;
while (_local4 < game.curLevel.liveUnits.length) {
game.curLevel.liveUnits[_local4].Process();
_local4++;
};
_local4 = 0;
while (_local4 < game.curLevel.liveShots.length) {
game.curLevel.liveShots[_local4].Process();
_local4++;
};
}
}
}//package
Section 53
//health_bar (health_bar)
package {
import flash.display.*;
public dynamic class health_bar extends MovieClip {
}
}//package
Section 54
//HUD (HUD)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import tab_menu.*;
public class HUD extends MovieClip {
public var lowQualityButton:SimpleButton;
public var txtMoney:TextField;
public var sendNextWave:SimpleButton;
public var txtKills:TextField;
public var txtTime:TextField;
public var plusButton:SimpleButton;
public var txtOutput:TextField;
public var highQualityButton:SimpleButton;
public var medQualityButton:SimpleButton;
private var level:Level;
private var minimap:MiniMap;
public var minusButton:SimpleButton;
public var cchealth:MovieClip;
public var viewCC:SimpleButton;
private var tabmenu:TabMenu;
public function HUD(_arg1:Level){
addFrameScript(0, frame1);
super();
level = _arg1;
minimap = new MiniMap(level, 0);
minimap.x = 12.5;
minimap.y = 435.7;
addChild(minimap);
tabmenu = new TabMenu();
tabmenu.x = 637.5;
tabmenu.y = 437.5;
addChild(tabmenu);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
public function gotoViewCC(_arg1:MouseEvent){
game.curLevel.moveScreenTo(0, 0);
}
public function setLowQuality(_arg1:MouseEvent){
stage.quality = StageQuality.LOW;
}
private function mouseDownHandler(_arg1:MouseEvent):void{
if (_arg1.target == this){
game.curLevel.setFreeState();
_arg1.stopPropagation();
};
}
function frame1(){
viewCC.addEventListener(MouseEvent.CLICK, gotoViewCC, false, 0, true);
sendNextWave.addEventListener(MouseEvent.CLICK, sendWave, false, 0, true);
plusButton.addEventListener(MouseEvent.CLICK, goZoomIn, false, 0, true);
minusButton.addEventListener(MouseEvent.CLICK, goZoomOut, false, 0, true);
highQualityButton.addEventListener(MouseEvent.CLICK, setHighQuality, false, 0, true);
medQualityButton.addEventListener(MouseEvent.CLICK, setMedQuality, false, 0, true);
lowQualityButton.addEventListener(MouseEvent.CLICK, setLowQuality, false, 0, true);
}
public function goZoomOut(_arg1:MouseEvent){
game.curLevel.zoomOut();
}
public function sendWave(_arg1:MouseEvent){
game.curLevel.spawner.sendNextWave();
}
public function goZoomIn(_arg1:MouseEvent){
game.curLevel.zoomIn();
}
public function setMedQuality(_arg1:MouseEvent){
stage.quality = StageQuality.MEDIUM;
}
public function setHighQuality(_arg1:MouseEvent){
stage.quality = StageQuality.HIGH;
}
public function Destroy():void{
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
minimap.Destroy();
tabmenu.Destroy();
level = null;
}
}
}//package
Section 55
//left_arrow (left_arrow)
package {
import flash.display.*;
public dynamic class left_arrow extends MovieClip {
}
}//package
Section 56
//Level (Level)
package {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import unit_package.*;
import projectiles.*;
import flash.utils.*;
import flash.media.*;
import fps.*;
public class Level extends MovieClip {
public var meta:MovieClip;
public var rateMod:int;// = 100
public var lvl:Number;
public var path:Array;
public var overlay:Overlay;
public var buffer:MovieClip;
public var hp_bar:MovieClip;
public var infSpawner:Unit_Spawn_Area;
public var units_gun:MovieClip;
public var screen:MovieClip;
private var timeTimer:Timer;
public var CenterX:Number;
public var CenterY:Number;
public var rangeMod:int;// = 100
private var tileMapper:TileMapper;
public var iscale:Number;// = 0.5
private var selectionBox:MovieClip;
private var dest;
public var buildSelection:MovieClip;
public var cchealth:Number;// = 100
private var oldMouse:Point;
private var pathMapper:PathMapper;
public var money:Number;// = 600
public var time:Number;// = 0
public var kills:Number;// = 0
private var newMouse:Point;
public var hud:HUD;
private var mainTimer:Timer;
public var buildSelect:Number;// = 0
public var damageMod:int;// = 100
private var musicChannel:SoundChannel;
public var liveShots:Array;
public var fsmState:Number;// = 0
public var terrain:MovieClip;
public var armorMod:int;// = 1
public var buildCost:Number;
public var spawner:Unit_Spawner;
public var selectedUnits:Array;
public var units_base:MovieClip;
public var bullets:MovieClip;
public var getX:Number;
public var getY:Number;
public var liveUnits:Array;
private var musicSound:Sound;
public static const FSM_BUILD_STATE:Number = 2;
public static const FSM_FREE_STATE:Number = 0;
public static const FSM_SELECT_STATE:Number = 1;
public function Level(_arg1, _arg2:Array, _arg3:Number){
var f:Function;
var i:*;
var FPS:fpsBox;
var dest = _arg1;
var pmPath = _arg2;
var lvl = _arg3;
liveUnits = new Array();
liveShots = new Array();
selectedUnits = new Array();
path = new Array();
terrain = new MovieClip();
units_base = new MovieClip();
units_gun = new MovieClip();
bullets = new MovieClip();
hp_bar = new MovieClip();
meta = new MovieClip();
screen = new MovieClip();
buffer = new MovieClip();
iscale = 0.5;
buildSelect = DATA.NO_SELECTION;
oldMouse = new Point();
newMouse = new Point();
fsmState = 0;
money = 600;
time = 0;
kills = 0;
cchealth = 100;
rangeMod = 100;
rateMod = 100;
damageMod = 100;
armorMod = 1;
super();
this.dest = dest;
this.lvl = lvl;
dest.addChild(this);
screen.x = (stage.stageWidth / 2);
screen.y = (stage.stageHeight / 2);
addChild(screen);
screen.addChild(buffer);
selectionBox = new MovieClip();
addChild(selectionBox);
hud = new HUD(this);
addChild(hud);
buffer.addChild(terrain);
buffer.addChild(units_base);
buffer.addChild(units_gun);
buffer.addChild(bullets);
buffer.addChild(hp_bar);
buffer.addChild(meta);
meta.mouseEnabled = false;
meta.mouseChildren = false;
units_base.hitArea = units_base;
terrain.cacheAsBitmap = true;
f = function (_arg1:Number):MovieClip{
var _local2:MovieClip;
_local2 = new Tile1();
_local2.gotoAndStop((int((Math.random() * 3)) + 1));
return (_local2);
};
tileMapper = new TileMapper(f, stage.stageWidth, stage.stageHeight, DATA.MIN_ZOOM);
terrain.addChild(tileMapper);
pathMapper = new PathMapper(pmPath);
terrain.addChild(pathMapper);
scale = iscale;
buildSelection = new MovieClip();
stage.addChild(buildSelection);
overlay = new Overlay();
addChild(overlay);
i = 0;
while (i < pmPath.length) {
path[i] = new Array(DATA.CMD_MOVE, pmPath[i].x, pmPath[i].y);
i = (i + 1);
};
spawner = new Unit_Spawner(this);
infSpawner = new Unit_Spawn_Area(this, DATA.INF_SOLDIE, 4);
switch (lvl){
case 1:
spawner.setTimer(1.5);
spawner.setType(DATA.VEH_TRUCKX);
spawner.setForce(4);
spawner.setCommand(path);
spawner.setIdle(10);
spawner.setRound(15);
spawner.setValue(0.14);
infSpawner.setSpawn(new Rectangle(-400, -2200, 800, 200));
infSpawner.setTarget(new Point(0, 0));
break;
case 2:
spawner.setTimer(1.5);
spawner.setType(DATA.VEH_TRUCKX);
spawner.setForce(4);
spawner.setCommand(path);
spawner.setIdle(10);
spawner.setRound(17);
spawner.setValue(0.12);
infSpawner.setSpawn(new Rectangle(-700, -2200, 400, 200));
infSpawner.setTarget(new Point(0, 0));
break;
case 3:
spawner.setTimer(1.5);
spawner.setType(DATA.VEH_TRUCKX);
spawner.setForce(4);
spawner.setCommand(path);
spawner.setIdle(10);
spawner.setRound(20);
spawner.setValue(0.1);
infSpawner.setSpawn(new Rectangle(-800, 2000, 600, 200));
infSpawner.setTarget(new Point(0, 0));
break;
};
addUnit(DATA.BLD_COMMAN, 0, 0, 0);
FPS = new fpsBox(stage);
addChild(FPS);
mainTimer = new Timer((1000 / 64));
mainTimer.addEventListener(TimerEvent.TIMER, game.mainLoop);
mainTimer.addEventListener(TimerEvent.TIMER, this.Update);
mainTimer.start();
timeTimer = new Timer(1000);
timeTimer.addEventListener(TimerEvent.TIMER, decrementTime);
timeTimer.start();
Console.Initiate(hud.txtOutput);
Console.out("ALERT: Enemy forces detected. Fortify your position!");
screen.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
private function decrementTime(_arg1:Event):void{
if (game.gameState == game.FSM_RUNNING){
time++;
switch (lvl){
case 1:
if (((((time % 200) == 0)) && (!((time == 0))))){
infSpawner.spawnUnits(3, kills);
Console.out("Foot Soldiers attacking!");
};
break;
case 2:
if (((((time % 150) == 0)) && (!((time == 0))))){
infSpawner.spawnUnits(4, (kills * 1.5));
Console.out("Foot Soldiers attacking!");
};
break;
case 3:
if (((((time % 100) == 0)) && (!((time == 0))))){
infSpawner.spawnUnits(5, (kills * 2));
Console.out("Foot Soldiers attacking!");
};
break;
};
};
}
private function updateSelectionBox(_arg1:Boolean=true):void{
selectionBox.graphics.clear();
if (_arg1){
selectionBox.graphics.lineStyle(1, DATA.SELECTION_BOX_COLOR);
selectionBox.graphics.drawRect(oldMouse.x, oldMouse.y, (newMouse.x - oldMouse.x), (newMouse.y - oldMouse.y));
};
}
public function removeUnit(_arg1:MovieClip):void{
unRegUnit(_arg1);
}
public function deselectAllUnits():void{
var _local1:*;
_local1 = 0;
while (_local1 < selectedUnits.length) {
selectedUnits[_local1].isSelected = false;
_local1++;
};
selectedUnits.length = 0;
}
private function regUnit(_arg1:MovieClip):void{
liveUnits.push(_arg1);
}
private function mouseMoveHandler(_arg1:MouseEvent):void{
newMouse.x = _arg1.stageX;
newMouse.y = _arg1.stageY;
updateSelectionBox();
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:BaseUnit;
oldMouse.x = _arg1.stageX;
oldMouse.y = _arg1.stageY;
_local2 = localizePoint(oldMouse);
switch (fsmState){
case FSM_BUILD_STATE:
if (money < buildCost){
Console.out("You don't have enough money.", true);
} else {
if (!buildHitTest(_arg1.stageX, _arg1.stageY, 50)){
Console.out("You cannot build there.", true);
} else {
_local3 = addUnit(buildSelect, 0, _local2.x, _local2.y);
setSelectState(new Array(_local3));
money = (money - buildCost);
};
};
break;
case FSM_SELECT_STATE:
setFreeState();
case FSM_FREE_STATE:
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
};
}
public function zoomIn(){
if (scale < DATA.MAX_ZOOM){
scale = (scale * 2);
};
}
private function buildHitTest(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
_arg3 = (_arg3 * scale);
if (pathMapper.hitArea.hitTestPoint((_arg1 - (_arg3 / 2)), (_arg2 - (_arg3 / 2)), true)){
return (false);
};
if (pathMapper.hitArea.hitTestPoint((_arg1 + (_arg3 / 2)), (_arg2 - (_arg3 / 2)), true)){
return (false);
};
if (pathMapper.hitArea.hitTestPoint((_arg1 - (_arg3 / 2)), (_arg2 + (_arg3 / 2)), true)){
return (false);
};
if (pathMapper.hitArea.hitTestPoint((_arg1 + (_arg3 / 2)), (_arg2 + (_arg3 / 2)), true)){
return (false);
};
if (units_base.hitArea.hitTestPoint((_arg1 - (_arg3 / 2)), (_arg2 - (_arg3 / 2)), true)){
return (false);
};
if (units_base.hitArea.hitTestPoint((_arg1 + (_arg3 / 2)), (_arg2 - (_arg3 / 2)), true)){
return (false);
};
if (units_base.hitArea.hitTestPoint((_arg1 - (_arg3 / 2)), (_arg2 + (_arg3 / 2)), true)){
return (false);
};
if (units_base.hitArea.hitTestPoint((_arg1 + (_arg3 / 2)), (_arg2 + (_arg3 / 2)), true)){
return (false);
};
return (true);
}
public function zoomOut(){
if (scale > DATA.MIN_ZOOM){
scale = (scale / 2);
};
}
public function set scale(_arg1:Number):void{
screen.scaleX = _arg1;
screen.scaleY = _arg1;
iscale = _arg1;
}
public function setBuildState(_arg1:Number, _arg2:Number, _arg3:Number):void{
buildCost = _arg2;
setFreeState();
fsmState = FSM_BUILD_STATE;
buildSelect = _arg1;
buildSelection = new unit_btn(buildSelect);
stage.addChild(buildSelection);
buildSelection.x = -1000;
buildSelection.y = -1000;
buildSelection.scaleX = scale;
buildSelection.scaleY = scale;
buildSelection.mouseEnabled = false;
buildSelection.mouseChildren = false;
buildSelection.addChild(new unit_range_indicator(((_arg3 * rangeMod) / 100)));
stage.addEventListener(MouseEvent.MOUSE_MOVE, buildMoveHandler);
}
private function orderSelectedUnits(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:*;
_local4 = 0;
while (_local4 < selectedUnits.length) {
if (selectedUnits[_local4].isInfantry){
selectedUnits[_local4].command[0] = [_arg1, _arg2, _arg3];
};
_local4++;
};
}
private function Update(_arg1:Event):void{
var _local2:Number;
var _local3:Point;
_local2 = (12.5 / scale);
_local3 = new Point();
if (game.key.isDown(game.key.LEFT)){
_local3.x = -(_local2);
};
if (game.key.isDown(game.key.RIGHT)){
_local3.x = _local2;
};
if (game.key.isDown(game.key.UP)){
_local3.y = -(_local2);
};
if (game.key.isDown(game.key.DOWN)){
_local3.y = _local2;
};
if (((!((_local3.x == 0))) || (!((_local3.y == 0))))){
moveScreen(_local3.x, _local3.y);
};
getX = ((0 - buffer.x) / scale);
getY = ((0 - buffer.y) / scale);
CenterX = (0 - buffer.x);
CenterY = (0 - buffer.y);
money = int(money);
hud.txtMoney.text = (money + "");
hud.txtTime.text = (time + "");
hud.txtKills.text = (kills + "");
if (cchealth < 0){
cchealth = 0;
};
hud.cchealth.scaleX = (cchealth / 100);
}
private function buildMoveHandler(_arg1:MouseEvent):void{
buildSelection.x = _arg1.stageX;
buildSelection.y = _arg1.stageY;
}
private function unRegShot(_arg1:Sprite):Boolean{
var _local2:Boolean;
var _local3:*;
_local2 = false;
_local3 = 0;
while (_local3 < liveShots.length) {
if (liveShots[_local3] == _arg1){
liveShots.splice(_local3, 1);
bullets.removeChild(_arg1);
_local2 = true;
};
_local3++;
};
return (_local2);
}
public function localizePoint(_arg1:Point):Point{
return (terrain.globalToLocal(_arg1));
}
public function moveScreenTo(_arg1:Number, _arg2:Number){
var _local3:Number;
var _local4:Number;
_local3 = (buffer.x - _arg1);
_local4 = (buffer.y - _arg2);
moveScreen(_local3, _local4);
}
public function clearBuildState():void{
if (buildSelection != null){
stage.removeChild(buildSelection);
};
buildSelection = null;
buildSelect = DATA.NO_SELECTION;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, buildMoveHandler);
}
private function mouseUpHandler(_arg1:MouseEvent):void{
newMouse.x = _arg1.stageX;
newMouse.y = _arg1.stageY;
updateSelectionBox(false);
selectUnits(Math.min(oldMouse.x, newMouse.x), Math.min(oldMouse.y, newMouse.y), Math.max(oldMouse.x, newMouse.x), Math.max(oldMouse.y, newMouse.y));
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
public function setSelectState(_arg1:Array):void{
var _local2:*;
setFreeState();
fsmState = FSM_SELECT_STATE;
_local2 = 0;
while (_local2 < _arg1.length) {
_arg1[_local2].isSelected = true;
selectedUnits.push(_arg1[_local2]);
_local2++;
};
}
public function addShot(_arg1:int, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number):Projectile{
var _local6:Projectile;
switch (_arg1){
case DATA.PRO_BULLET:
_local6 = new Bullet(_arg5, _arg2, _arg3, _arg4);
break;
case DATA.PRO_CANBAL:
_local6 = new CannonBall(_arg5, _arg2, _arg3, _arg4);
break;
case DATA.PRO_MORTAR:
_local6 = new MortarShell(_arg5, _arg2, _arg3, _arg4);
break;
case DATA.PRO_ROCKET:
_local6 = new Rocket(_arg5, _arg2, _arg3, _arg4);
break;
case DATA.PRO_MISSIL:
_local6 = new Bullet(_arg5, _arg2, _arg3, _arg4);
break;
};
regShot(_local6);
return (_local6);
}
public function setFreeState():void{
fsmState = FSM_FREE_STATE;
deselectAllUnits();
clearBuildState();
}
private function unRegUnit(_arg1:MovieClip):void{
var _local2:*;
_local2 = 0;
while (_local2 < liveUnits.length) {
if (liveUnits[_local2] == _arg1){
liveUnits.splice(_local2, 1);
};
_local2++;
};
_local2 = 0;
while (_local2 < selectedUnits.length) {
if (selectedUnits[_local2] == _arg1){
selectedUnits.splice(_local2, 1);
};
_local2++;
};
}
private function cleanChildren(_arg1:MovieClip){
var _local2:*;
_local2 = 0;
while (_local2 < _arg1.numChildren) {
_arg1.removeChild(_arg1.getChildAt(_local2));
_local2++;
};
}
public function get scale():Number{
return (iscale);
}
public function moveScreen(_arg1:Number, _arg2:Number){
buffer.x = (buffer.x + -(_arg1));
buffer.y = (buffer.y + -(_arg2));
tileMapper.moveScreen(_arg1, _arg2);
}
public function removeShot(_arg1:Sprite):void{
if (unRegShot(_arg1) == false){
trace("Error in removeShot.");
};
}
private function regShot(_arg1:Sprite):void{
liveShots.push(_arg1);
bullets.addChild(_arg1);
}
public function addUnit(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):BaseUnit{
var _local5:BaseUnit;
switch (_arg1){
case DATA.INF_SOLDIE:
_local5 = new Soldier(this, _arg2, _arg3, _arg4);
break;
case DATA.TUR_CANNON:
_local5 = new Cannon(this, _arg2, _arg3, _arg4);
break;
case DATA.TUR_ROCKET:
_local5 = new Rockets(this, _arg2, _arg3, _arg4);
break;
case DATA.TUR_MORTAR:
_local5 = new Mortar(this, _arg2, _arg3, _arg4);
break;
case DATA.TUR_MACHIN:
_local5 = new Machine(this, _arg2, _arg3, _arg4);
break;
case DATA.VEH_TRUCKX:
_local5 = new Truck(this, _arg2, _arg3, _arg4);
break;
case DATA.VEH_TRUCKG:
_local5 = new TruckGunner(this, _arg2, _arg3, _arg4);
break;
case DATA.BLD_COMMAN:
_local5 = new CC(this, _arg2, _arg3, _arg4);
break;
case DATA.BLD_ARMORY:
_local5 = new Armory(this, _arg2, _arg3, _arg4);
break;
};
regUnit(_local5);
return (_local5);
}
private function selectUnits(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Point;
var _local6:Point;
var _local7:Array;
var _local8:BaseUnit;
var _local9:*;
_local5 = localizePoint(new Point(_arg1, _arg2));
_local6 = localizePoint(new Point(_arg3, _arg4));
_local7 = new Array();
_local9 = 0;
while (_local9 < liveUnits.length) {
_local8 = liveUnits[_local9];
if ((((((((_local8.x > _local5.x)) && ((_local8.x < _local6.x)))) && ((_local8.y > _local5.y)))) && ((_local8.y < _local6.y)))){
_local7.push(_local8);
};
_local9++;
};
setSelectState(_local7);
}
public function Destroy(){
var _local1:*;
if (liveUnits.length > 0){
_local1 = 0;
while (_local1 < liveUnits.length) {
liveUnits[_local1].Destroy();
_local1++;
};
};
liveUnits.length = 0;
liveUnits = null;
liveShots.length = 0;
liveShots = null;
selectedUnits.length = 0;
selectedUnits = null;
path.length = 0;
path = null;
mainTimer.removeEventListener(TimerEvent.TIMER, game.mainLoop);
mainTimer.removeEventListener(TimerEvent.TIMER, this.Update);
mainTimer.stop();
mainTimer = null;
timeTimer.removeEventListener(TimerEvent.TIMER, decrementTime);
timeTimer.stop();
timeTimer = null;
screen.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
spawner.Destroy();
hud.Destroy();
cleanChildren(terrain);
terrain = null;
cleanChildren(units_base);
units_base = null;
cleanChildren(units_gun);
units_gun = null;
cleanChildren(bullets);
bullets = null;
cleanChildren(meta);
meta = null;
cleanChildren(hud);
hud = null;
cleanChildren(tileMapper);
tileMapper = null;
cleanChildren(pathMapper);
pathMapper = null;
cleanChildren(screen);
screen = null;
cleanChildren(buffer);
buffer = null;
cleanChildren(overlay);
overlay = null;
cleanChildren(this);
parent.removeChild(this);
}
}
}//package
Section 57
//MD5 (MD5)
package {
public class MD5 {
public static const HEX_FORMAT_LOWERCASE:uint = 0;
public static const HEX_FORMAT_UPPERCASE:uint = 1;
public static const BASE64_PAD_CHARACTER_DEFAULT_COMPLIANCE:String = "";
public static const BASE64_PAD_CHARACTER_RFC_COMPLIANCE:String = "=";
public static var hexcase:uint = 0;
public static var b64pad:String = "";
public static function md5_gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(_arg2, _arg1), safe_add(_arg4, _arg6)), _arg5), _arg3));
}
public static function binl_md5(_arg1:Array, _arg2:Number):Array{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
_local3 = 1732584193;
_local4 = -271733879;
_local5 = -1732584194;
_local6 = 271733878;
_local7 = 0;
while (_local7 < _arg1.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, -680876936);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, -389564586);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, -1044525330);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, -176418897);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, -1473231341);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, -45705983);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, -1958414417);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, -42063);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, -1990404162);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, -40341101);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, -1502002290);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, -165796510);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, -1069501632);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, -373897302);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, -701558691);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, -660478335);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, -405537848);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, -1019803690);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, -187363961);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, -1444681467);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, -51403784);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, -1926607734);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, -378558);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, -2022574463);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, -35309556);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, -1530992060);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, -155497632);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, -1094730640);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, -358537222);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, -722521979);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, -640364487);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, -421815835);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, -995338651);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, -198630844);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, -1416354905);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, -57434055);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, -1894986606);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, -1051523);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, -2054922799);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, -30611744);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, -1560198380);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, -145523070);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, -1120210379);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, -343485551);
_local3 = safe_add(_local3, _local8);
_local4 = safe_add(_local4, _local9);
_local5 = safe_add(_local5, _local10);
_local6 = safe_add(_local6, _local11);
_local7 = (_local7 + 16);
};
return ([_local3, _local4, _local5, _local6]);
}
public static function str2rstr_utf16le(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode((_arg1.charCodeAt(_local3) & 0xFF), ((_arg1.charCodeAt(_local3) >>> 8) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function hex_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2hex(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function binl2rstr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < (_arg1.length * 32)) {
_local2 = (_local2 + String.fromCharCode(((_arg1[(_local3 >> 5)] >>> (_local3 % 32)) & 0xFF)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2binl(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array((_arg1.length >> 2));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = 0;
_local3++;
};
_local3 = 0;
while (_local3 < (_arg1.length * 8)) {
_local2[(_local3 >> 5)] = (_local2[(_local3 >> 5)] | ((_arg1.charCodeAt((_local3 / 8)) & 0xFF) << (_local3 % 32)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_vm_test():Boolean{
return ((hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
}
public static function b64_md5(_arg1:String):String{
return (rstr2b64(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function any_hmac_md5(_arg1:String, _arg2:String, _arg3:String):String{
return (rstr2any(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2)), _arg3));
}
public static function hex_md5(_arg1:String):String{
return (rstr2hex(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function bit_rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function encrypt(_arg1:String):String{
return (hex_md5(_arg1));
}
public static function md5_hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2hex(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
_local2 = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef";
_local3 = "";
_local5 = 0;
while (_local5 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local5);
_local3 = (_local3 + (_local2.charAt(((_local4 >>> 4) & 15)) + _local2.charAt((_local4 & 15))));
_local5++;
};
return (_local3);
}
public static function any_md5(_arg1:String, _arg2:String):String{
return (rstr2any(rstr_md5(str2rstr_utf8(_arg1)), _arg2));
}
public static function b64_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2b64(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function rstr2b64(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
_local3 = "";
_local4 = _arg1.length;
_local5 = 0;
while (_local5 < _local4) {
_local6 = (((_arg1.charCodeAt(_local5) << 16) | (((_local5 + 1) < _local4)) ? (_arg1.charCodeAt((_local5 + 1)) << 8) : 0) | (((_local5 + 2) < _local4)) ? _arg1.charCodeAt((_local5 + 2)) : 0);
_local7 = 0;
while (_local7 < 4) {
if (((_local5 * 8) + (_local7 * 6)) > (_arg1.length * 8)){
_local3 = (_local3 + b64pad);
} else {
_local3 = (_local3 + _local2.charAt(((_local6 >>> (6 * (3 - _local7))) & 63)));
};
_local7++;
};
_local5 = (_local5 + 3);
};
return (_local3);
}
public static function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
_local4 = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
public static function str2rstr_utf8(_arg1:String):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = "";
_local3 = -1;
while (++_local3 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local3);
_local5 = (((_local3 + 1) < _arg1.length)) ? _arg1.charCodeAt((_local3 + 1)) : 0;
if ((((((((0xD800 <= _local4)) && ((_local4 <= 56319)))) && ((0xDC00 <= _local5)))) && ((_local5 <= 57343)))){
_local4 = ((65536 + ((_local4 & 1023) << 10)) + (_local5 & 1023));
_local3++;
};
if (_local4 <= 127){
_local2 = (_local2 + String.fromCharCode(_local4));
} else {
if (_local4 <= 2047){
_local2 = (_local2 + String.fromCharCode((192 | ((_local4 >>> 6) & 31)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 0xFFFF){
_local2 = (_local2 + String.fromCharCode((224 | ((_local4 >>> 12) & 15)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 2097151){
_local2 = (_local2 + String.fromCharCode((240 | ((_local4 >>> 18) & 7)), (128 | ((_local4 >>> 12) & 63)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
};
};
};
};
};
return (_local2);
}
public static function rstr_hmac_md5(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = rstr2binl(_arg1);
if (_local3.length > 16){
_local3 = binl_md5(_local3, (_arg1.length * 8));
};
_local4 = new Array(16);
_local5 = new Array(16);
_local6 = 0;
while (_local6 < 16) {
_local4[_local6] = (_local3[_local6] ^ 909522486);
_local5[_local6] = (_local3[_local6] ^ 1549556828);
_local6++;
};
_local7 = binl_md5(_local4.concat(rstr2binl(_arg2)), (0x0200 + (_arg2.length * 8)));
return (binl2rstr(binl_md5(_local5.concat(_local7), (0x0200 + 128))));
}
public static function str2rstr_utf16be(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(((_arg1.charCodeAt(_local3) >>> 8) & 0xFF), (_arg1.charCodeAt(_local3) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function rstr2any(_arg1:String, _arg2:String):String{
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
var _local9:Array;
var _local10:String;
_local3 = _arg2.length;
_local4 = [];
_local9 = new Array((_arg1.length / 2));
_local5 = 0;
while (_local5 < _local9.length) {
_local9[_local5] = ((_arg1.charCodeAt((_local5 * 2)) << 8) | _arg1.charCodeAt(((_local5 * 2) + 1)));
_local5++;
};
while (_local9.length > 0) {
_local8 = [];
_local7 = 0;
_local5 = 0;
while (_local5 < _local9.length) {
_local7 = ((_local7 << 16) + _local9[_local5]);
_local6 = Math.floor((_local7 / _local3));
_local7 = (_local7 - (_local6 * _local3));
if ((((_local8.length > 0)) || ((_local6 > 0)))){
_local8[_local8.length] = _local6;
};
_local5++;
};
_local4[_local4.length] = _local7;
_local9 = _local8;
};
_local10 = "";
_local5 = (_local4.length - 1);
while (_local5 >= 0) {
_local10 = (_local10 + _arg2.charAt(_local4[_local5]));
_local5--;
};
return (_local10);
}
public static function rstr_md5(_arg1:String):String{
return (binl2rstr(binl_md5(rstr2binl(_arg1), (_arg1.length * 8))));
}
}
}//package
Section 58
//MiniMap (MiniMap)
package {
import flash.display.*;
import flash.events.*;
public class MiniMap extends MovieClip {
private const SIZE:Number = 150;
private const RANGE:Number = 5000;
private var force:Number;
private var uir:Array;
private var dots:Array;
private var level:MovieClip;
public function MiniMap(_arg1:Level, _arg2:Number){
dots = new Array();
uir = new Array();
super();
force = _arg2;
level = _arg1;
addEventListener(Event.ENTER_FRAME, mainLoop);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_arg1.localX - (SIZE / 2));
_local3 = (_arg1.localY - (SIZE / 2));
_local2 = (_local2 * (RANGE / SIZE));
_local3 = (_local3 * (RANGE / SIZE));
level.moveScreen(_local2, _local3);
}
public function Destroy():void{
removeEventListener(Event.ENTER_FRAME, mainLoop);
removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false);
dots.length = 0;
dots = null;
uir.length = 0;
uir = null;
level = null;
}
private function mainLoop(_arg1:Event):void{
var _local2:Number;
var _local3:*;
var _local4:MovieClip;
var _local5:Sprite;
_local2 = 0;
uir.length = 0;
_local3 = 0;
while (_local3 < level.liveUnits.length) {
_local4 = level.liveUnits[_local3];
if ((((Math.abs((_local4.x - level.CenterX)) < (RANGE / 2))) && ((Math.abs((_local4.y - level.CenterY)) < (RANGE / 2))))){
uir[_local2] = _local4;
_local2++;
};
_local3++;
};
while (dots.length > uir.length) {
removeChild(dots[0]);
dots.splice(0, 1);
};
while (dots.length < uir.length) {
_local5 = new Dot();
addChild(_local5);
dots.push(_local5);
};
_local3 = 0;
while (_local3 < uir.length) {
dots[_local3].x = (((uir[_local3].x - level.CenterX) / (RANGE / SIZE)) + (SIZE / 2));
dots[_local3].y = (((uir[_local3].y - level.CenterY) / (RANGE / SIZE)) + (SIZE / 2));
if (dots[_local3].force != uir[_local3].force){
if (uir[_local3].force == force){
dots[_local3].AssignTeam(force, 0xAA00);
} else {
dots[_local3].AssignTeam(uir[_local3].force, 0);
};
};
_local3++;
};
}
}
}//package
import flash.display.*;
class Dot extends Sprite {
public var force:Number;
private function Dot(){
AssignTeam(-1, 0);
mouseEnabled = false;
}
public function AssignTeam(_arg1:Number, _arg2:Number){
force = _arg1;
graphics.clear();
graphics.lineStyle(1, _arg2, 1);
graphics.beginFill(_arg2, 1);
graphics.drawCircle(0, 0, 1);
}
}
Section 59
//move_ico (move_ico)
package {
import flash.display.*;
public dynamic class move_ico extends MovieClip {
}
}//package
Section 60
//MsgSound (MsgSound)
package {
import flash.media.*;
public dynamic class MsgSound extends Sound {
}
}//package
Section 61
//Overlay (Overlay)
package {
import flash.display.*;
import flash.events.*;
public dynamic class Overlay extends MovieClip {
public var menuButton:SimpleButton;
public var backButton:SimpleButton;
public var exitButton:SimpleButton;
public function Overlay(){
addFrameScript(0, frame1, 1, frame2);
}
public function goExit(_arg1:MouseEvent):void{
game.endGame();
}
function frame1(){
stop();
menuButton.addEventListener(MouseEvent.CLICK, openMenu, false, 0, true);
}
function frame2(){
stop();
backButton.addEventListener(MouseEvent.CLICK, goBack, false, 0, true);
exitButton.addEventListener(MouseEvent.CLICK, goExit, false, 0, true);
}
public function openMenu(_arg1:MouseEvent):void{
gotoAndStop(2);
}
public function goBack(_arg1:MouseEvent):void{
gotoAndPlay(1);
}
}
}//package
Section 62
//PathMapper (PathMapper)
package {
import flash.display.*;
import flash.geom.*;
public class PathMapper extends MovieClip {
private const BACK_COLOR:Number = 0;
private const BRAD:Number = 49;
private const PATH_COLOR:Number = 10382653;
private const PRAD:Number = 45;
private var points:Array;
private var pathMC:Sprite;
private var lastY:Number;
private var lastX:Number;
public var backMC:Sprite;
public function PathMapper(_arg1:Array){
var _local2:*;
pathMC = new Sprite();
backMC = new Sprite();
super();
cacheAsBitmap = true;
points = _arg1;
lastX = points[0].x;
lastY = points[0].y;
pathMC.graphics.beginFill(PATH_COLOR, 1);
pathMC.graphics.drawCircle(lastX, lastY, PRAD);
_local2 = 1;
while (_local2 < points.length) {
drawPathTo(points[_local2]);
_local2++;
};
hitArea = this;
addChild(backMC);
addChild(pathMC);
}
private function drawPathTo(_arg1:Point):void{
var _local2:Number;
var _local3:Number;
var _local4:Sprite;
_local2 = Math.sqrt((((_arg1.x - lastX) * (_arg1.x - lastX)) + ((_arg1.y - lastY) * (_arg1.y - lastY))));
_local3 = ((Math.atan2((_arg1.y - lastY), (_arg1.x - lastX)) * 180) / Math.PI);
_local4 = new Sprite();
_local4.graphics.beginFill(PATH_COLOR, 1);
_local4.graphics.drawRect(0, -(PRAD), ((PRAD + _local2) - PRAD), (PRAD * 2));
_local4.x = lastX;
_local4.y = lastY;
_local4.rotation = _local3;
pathMC.addChild(_local4);
_local4 = new Sprite();
_local4.graphics.beginFill(BACK_COLOR, 1);
_local4.graphics.drawRect(0, -(BRAD), ((BRAD + _local2) - BRAD), (BRAD * 2));
_local4.x = lastX;
_local4.y = lastY;
_local4.rotation = _local3;
backMC.addChild(_local4);
pathMC.graphics.beginFill(PATH_COLOR, 1);
pathMC.graphics.drawCircle(_arg1.x, _arg1.y, PRAD);
backMC.graphics.beginFill(BACK_COLOR, 1);
backMC.graphics.drawCircle(_arg1.x, _arg1.y, BRAD);
lastX = _arg1.x;
lastY = _arg1.y;
}
}
}//package
Section 63
//right_arrow (right_arrow)
package {
import flash.display.*;
public dynamic class right_arrow extends MovieClip {
}
}//package
Section 64
//SubmitHighScore (SubmitHighScore)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.geom.*;
import flash.utils.*;
import flash.media.*;
import flash.net.*;
import flash.ui.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class SubmitHighScore extends MovieClip {
public var loader:URLLoader;
public var txtName:TextField;
public var submitbtn:SimpleButton;
public var txtKills:TextField;
public var txtStatus:TextField;
public var kills:int;
public var exitButton:SimpleButton;
public function SubmitHighScore(){
addFrameScript(0, frame1);
}
public function goExit(_arg1:MouseEvent):void{
game.endGame();
}
public function submitScore(_arg1:MouseEvent){
var _local2:URLRequest;
var _local3:URLVariables;
_local2 = new URLRequest("http://timegames.net/games/desertoutpost/highscores/highscores.php");
_local2.method = URLRequestMethod.POST;
_local3 = new URLVariables();
_local3.action = "g788v4s";
_local3.plrnm = txtName.text;
_local3.plrsc = kills;
_local3.plrci = MD5.encrypt((txtName.text + kills));
_local3.plrlv = game.currentLevel;
_local2.data = _local3;
loader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, dataOnLoad);
loader.load(_local2);
submitbtn.visible = false;
}
function frame1(){
submitbtn.addEventListener(MouseEvent.CLICK, submitScore);
exitButton.addEventListener(MouseEvent.CLICK, goExit, false, 0, true);
}
public function setKills(_arg1:int){
kills = _arg1;
txtKills.text = (("You killed " + kills) + " units.");
}
public function dataOnLoad(_arg1:Event){
switch (loader.data){
case "NK":
txtStatus.text = "Your score was submitted successfully! You may view your high scores at <a href='http://timegames.net/games/desertoutpost/highscores/'>TimeGames.net</a>.";
break;
case "NA":
txtStatus.text = "The website you are playing this game at is not allowed to submit high scores. Please inform the site administrator that they should contact TimeGames.net to get their site added to the allowed list. Until then, you may play this game at <a href='http://timegames.net/games/desertoutpost/'>TimeGames.net</a>.";
submitbtn.visible = true;
break;
default:
txtStatus.text = "It seems that you do not have an active internet connection or there is some other error. You can try playing this game at <a href='http://timegames.net/games/desertoutpost/'>TimeGames.net</a>. We're sorry for any inconvience.";
submitbtn.visible = true;
};
trace(loader.data);
}
}
}//package
Section 65
//tab_bar (tab_bar)
package {
import flash.display.*;
public dynamic class tab_bar extends MovieClip {
public var leftarrow:left_arrow;
public var rightarrow:right_arrow;
public var display:Tab1_Selector;
}
}//package
Section 66
//Tab1_Selector (Tab1_Selector)
package {
import flash.display.*;
public dynamic class Tab1_Selector extends MovieClip {
}
}//package
Section 67
//Tile1 (Tile1)
package {
import flash.display.*;
public dynamic class Tile1 extends MovieClip {
}
}//package
Section 68
//TileMapper (TileMapper)
package {
import flash.display.*;
public class TileMapper extends MovieClip {
private const S_DIV:Number = 5;
private const TILE_SIZE:Number = 64;
private var sectorWidth:Number;
private var getTile:Function;
private var mapData:Array;
private var pWidth:Number;
private var sectorHeight:Number;
private var sector:Array;
private var tiles:Array;
private var pHeight:Number;
private var tWidth:Number;
private var pScale:Number;
private var tHeight:Number;
private var pX:Number;
private var pY:Number;
public function TileMapper(_arg1:Function, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:*;
var _local6:*;
super();
mouseEnabled = false;
mouseChildren = false;
getTile = _arg1;
pHeight = _arg3;
pWidth = _arg2;
pScale = _arg4;
tHeight = Math.ceil(((pHeight / TILE_SIZE) / pScale));
tWidth = Math.ceil(((pWidth / TILE_SIZE) / pScale));
sectorWidth = (tWidth / (S_DIV - 1));
sectorHeight = (tHeight / (S_DIV - 1));
sector = new Array(S_DIV);
_local5 = 0;
while (_local5 < sector.length) {
sector[_local5] = new Array(S_DIV);
_local6 = 0;
while (_local6 < sector[_local5].length) {
sector[_local5][_local6] = new MovieClip();
sector[_local5][_local6].cacheAsBitmap = true;
addChild(sector[_local5][_local6]);
sector[_local5][_local6].x = (((_local5 - ((S_DIV + 1) / 2)) * TILE_SIZE) * sectorWidth);
sector[_local5][_local6].y = (((_local6 - ((S_DIV + 1) / 2)) * TILE_SIZE) * sectorHeight);
fillSector(sector[_local5][_local6], sectorWidth, sectorHeight);
_local6++;
};
_local5++;
};
tiles = new Array();
pX = 0;
pY = 0;
}
public function moveScreen(_arg1:Number, _arg2:Number):void{
var _local3:*;
var _local4:*;
pX = (pX + _arg1);
pY = (pY + _arg2);
_local3 = 0;
while (_local3 < sector.length) {
_local4 = 0;
while (_local4 < sector[_local3].length) {
sector[_local3][_local4].x = (((Math.ceil((pX / (TILE_SIZE * sectorWidth))) * TILE_SIZE) * sectorWidth) + (((_local3 - ((S_DIV + 1) / 2)) * TILE_SIZE) * sectorWidth));
sector[_local3][_local4].y = (((Math.ceil((pY / (TILE_SIZE * sectorHeight))) * TILE_SIZE) * sectorHeight) + (((_local4 - ((S_DIV + 1) / 2)) * TILE_SIZE) * sectorHeight));
_local4++;
};
_local3++;
};
}
public function changeScale(_arg1):void{
}
private function fillSector(_arg1:MovieClip, _arg2:Number, _arg3:Number){
var _local4:MovieClip;
var _local5:*;
var _local6:*;
_local5 = 0;
while (_local5 < _arg2) {
_local6 = 0;
while (_local6 < _arg3) {
_local4 = getTile(1);
_arg1.addChild(_local4);
_local4.x = (_local5 * TILE_SIZE);
_local4.y = (_local6 * TILE_SIZE);
_local6++;
};
_local5++;
};
}
}
}//package
Section 69
//Truck1 (Truck1)
package {
import flash.display.*;
public dynamic class Truck1 extends MovieClip {
}
}//package
Section 70
//Truck2 (Truck2)
package {
import flash.display.*;
public dynamic class Truck2 extends MovieClip {
}
}//package
Section 71
//Tur_Base (Tur_Base)
package {
import flash.display.*;
public dynamic class Tur_Base extends MovieClip {
}
}//package
Section 72
//unit_gun (unit_gun)
package {
import flash.display.*;
public dynamic class unit_gun extends MovieClip {
}
}//package
Section 73
//unit_soldier (unit_soldier)
package {
import flash.display.*;
public dynamic class unit_soldier extends MovieClip {
}
}//package