Section 1
//MainTimeline (game7_mochi_fla.MainTimeline)
package game7_mochi_fla {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
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 MainTimeline extends MovieClip {
public var lvl:int;
public var hp1:BitmapData;
public var hp2:BitmapData;
public var percent:Number;
public var detailTxt:TextField;
public var i:int;
public var continue1:SimpleButton;
public var f1:BitmapData;
public var f2:BitmapData;
public var f4:BitmapData;
public var f5:BitmapData;
public var eName:TextField;
public var f7:BitmapData;
public var f8:BitmapData;
public var f9:BitmapData;
public var bpuller:MovieClip;
public var myGunName:String;
public var f3:BitmapData;
public var BGM;
public var dFire:Number;
public var f6:BitmapData;
public var domain:String;
public var fireFrame:BitmapData;
public var dDamage:int;
public var myTimer:Timer;
public var f10:BitmapData;
public var f11:BitmapData;
public var f12:BitmapData;
public var f13:BitmapData;
public var f14:BitmapData;
public var f16:BitmapData;
public var f18:BitmapData;
public var f19:BitmapData;
public var f15:BitmapData;
public var f17:BitmapData;
public var buyMenu:Boolean;
public var noUpgrade:Boolean;
public var pFounder:int;
public var totalMob:int;
public var f25:BitmapData;
public var f26:BitmapData;
public var f27:BitmapData;
public var f28:BitmapData;
public var f22:BitmapData;
public var f23:BitmapData;
public var f20:BitmapData;
public var drag:BitmapData;
public var mb1:BitmapData;
public var mb2:BitmapData;
public var basePoint:Point;
public var mb6:BitmapData;
public var mb7:BitmapData;
public var mb3:BitmapData;
public var mb4:BitmapData;
public var bm2:Bitmap;
public var f24:BitmapData;
public var lvlSpeed:int;
public var mb5:BitmapData;
public var dTime:int;
public var f21:BitmapData;
public var clickClose:Boolean;
public var aRange:int;
public var planetData:BitmapData;
public var m1:BitmapData;
public var m2:BitmapData;
public var m3:BitmapData;
public var m6:BitmapData;
public var m7:BitmapData;
public var m4:BitmapData;
public var myMode:int;
public var tr1:BitmapData;
public var tr3:BitmapData;
public var tr4:BitmapData;
public var aPrice:int;
public var tr2:BitmapData;
public var menuOut:Boolean;
public var n2:BitmapData;
public var n3:BitmapData;
public var n5:BitmapData;
public var n1:BitmapData;
public var variables:URLVariables;
public var mobRemain:int;
public var n4:BitmapData;
public var upgradeMenu:Boolean;
public var dtype:int;
public var m5:BitmapData;
public var puller:Boolean;
public var dragr:BitmapData;
public var mySound1:Sound;
public var mySound3:Sound;
public var upgrader:Boolean;
public var bmd2:BitmapData;
public var bmd3:BitmapData;
public var bmd1:BitmapData;
public var rect:Rectangle;
public var redd:MovieClip;
public var b11:BitmapData;
public var b12:BitmapData;
public var b13:BitmapData;
public var pt:Point;
public var r12:SimpleButton;
public var myStar:BitmapData;
public var s3:BitmapData;
public var b21:BitmapData;
public var b23:BitmapData;
public var s1:BitmapData;
public var s2:BitmapData;
public var highScore:int;
public var aFire:int;
public var t2:BitmapData;
public var t3:BitmapData;
public var t1:BitmapData;
public var b33:BitmapData;
public var b31:BitmapData;
public var myName:String;
public var bigmenu:MovieClip;
public var b43:BitmapData;
public var t4:BitmapData;
public var founder2:int;
public var onBGM:int;
public var b41:BitmapData;
public var st:int;
public var bulletArray:Array;
public var loader2:URLLoader;
public var key:int;
public var moveX:int;
public var aTime:int;
public var ranger:MovieClip;
public var NoMenu:ContextMenu;
public var outPoint:Point;
public var survive:Boolean;
public var Chan1:SoundChannel;
public var life:int;
public var tUpgrade:MovieClip;
public var dEffect:int;
public var buyTurret:MovieClip;
public var starArray:Array;
public var aDamage:int;
public var cash:int;
public var myDelay:Number;
public var dRange:int;
public var mobArray:Array;
public var dPrice:int;
public var turretArray:Array;
public var tSeconds:int;
public var myData:URLRequest;
public var maxTurret:int;
public var found:Boolean;
public var allowed_site:String;
public var dragStart:Boolean;
public var gURL:SimpleButton;
public var gameStart:Boolean;
public var endTxt:TextField;
public var founder:int;
public var detailTxt2:TextField;
public var detailTxt3:TextField;
public var helper:MovieClip;
public var holdCtrl:Boolean;
public var percentTxt:TextField;
public var gameOver:Boolean;
public var mousePoint:Point;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
public function loader(_arg1){
if (currentFrame == 1){
percent = int(((root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal) * 100));
percentTxt.text = String((percent + "% Loaded"));
};
if (percent == 100){
removeEventListener(Event.ENTER_FRAME, loader);
};
}
public function closeWindow(_arg1:MouseEvent){
tUpgrade.visible = false;
ranger.visible = false;
upgrader = false;
clickClose = true;
}
public function MainLoop(_arg1){
var _local2:Rectangle;
var _local3:Point;
var _local4:*;
var _local5:int;
var _local6:*;
var _local7:Number;
var _local8:Point;
var _local9:Point;
var _local10:Point;
var _local11:BitmapData;
var _local12:BitmapData;
var _local13:BitmapData;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:int;
stage.focus = stage;
if ((((survive == true)) && ((mobRemain == 0)))){
startNew();
};
if (((((moveX % lvlSpeed) == 0)) && (!((mobRemain == 0))))){
createMob(1);
if (gameStart == true){
mobRemain--;
};
};
if (moveX != 0){
this.removeChild(bm2);
if (gameStart == true){
if (puller == false){
if (mouseY > 487){
if (bpuller.y > 470){
bpuller.y = (bpuller.y - 3);
} else {
puller = true;
};
} else {
if (mouseY <= 465){
if (bpuller.y < 495){
bpuller.y = (bpuller.y + 3);
} else {
puller = false;
bpuller.y = 495;
};
};
};
} else {
if (mouseY <= 465){
if (bpuller.y < 495){
bpuller.y = (bpuller.y + 3);
} else {
puller = false;
bpuller.y = 495;
};
};
};
bpuller.visible = true;
this.removeChild(detailTxt);
this.removeChild(detailTxt2);
this.removeChild(detailTxt3);
this.removeChild(ranger);
this.removeChild(redd);
this.removeChild(helper);
this.removeChild(bpuller);
if (lvl == 2){
helper.visible = false;
};
if (lvl < 2){
helper.visible = true;
};
helper.gotoAndStop(1);
if (turretArray.length > 0){
helper.gotoAndStop(2);
};
if (dragStart == true){
helper.gotoAndStop(4);
} else {
if (mobArray.length > 0){
helper.gotoAndStop(3);
};
};
if (menuOut == true){
this.removeChild(buyTurret);
menuOut = false;
helper.visible = false;
};
if (upgradeMenu == true){
this.removeChild(tUpgrade);
upgradeMenu = false;
helper.visible = false;
};
} else {
this.removeChild(bigmenu);
};
bmd2.dispose();
bmd2 = new BitmapData(700, 700, false, 0);
};
st = 0;
while (st < starArray.length) {
myStar = this[("s" + starArray[st][0])];
starArray[st][2].x = (starArray[st][2].x - starArray[st][1].x);
starArray[st][2].y = (starArray[st][2].y - starArray[st][1].y);
if (starArray[st][2].y < 90){
starArray[st][2].y = (starArray[st][2].y + 500);
starArray[st][2].x = (50 + rand(550));
};
bmd2.copyPixels(myStar, myStar.rect, starArray[st][2], null, null, false);
st++;
};
totalMob = mobArray.length;
moveX++;
pt.x = 18;
pt.y = 480;
bmd2.copyPixels(planetData, planetData.rect, pt, null, null, false);
found = false;
mousePoint = new Point((mouseX + 77), (mouseY + 77));
i = 0;
while (i < turretArray.length) {
pt.x = turretArray[i][1].x;
pt.y = turretArray[i][1].y;
if (checkPlacement(turretArray[i][1], mousePoint)){
found = true;
pFounder = i;
};
if (turretArray[i][8] > 0){
var _local18 = turretArray[i];
var _local19 = 8;
var _local20 = (_local18[_local19] - 1);
_local18[_local19] = _local20;
};
bmd2.copyPixels(turretArray[i][5], turretArray[i][5].rect, pt, null, null, false);
if (noUpgrade == false){
bmd2.copyPixels(this[("n" + turretArray[i][6])], this[("n" + turretArray[i][6])].rect, new Point((pt.x + 15), (pt.y + 14)), null, null, false);
};
i++;
};
if (dragStart == true){
pt.x = (mouseX + 77);
pt.y = (mouseY + 77);
ranger.x = (mouseX + 2);
ranger.y = (mouseY + 3);
if ((((found == true)) || ((cash < dPrice)))){
bmd2.copyPixels(dragr, dragr.rect, pt, null, null, false);
} else {
bmd2.copyPixels(drag, drag.rect, pt, null, null, false);
};
} else {
if ((((((dragStart == false)) && ((found == true)))) && ((upgrader == true)))){
ranger.x = (turretArray[founder2][1].x - 77);
ranger.y = (turretArray[founder2][1].y - 77);
};
};
i = 0;
while (i < mobArray.length) {
if (mobArray[i][15] > 0){
_local18 = mobArray[i];
_local19 = 15;
_local20 = (_local18[_local19] - 1);
_local18[_local19] = _local20;
};
if (mobArray[i][15] == 0){
mobArray[i][14] = 0;
};
if (mobArray[i][14] == 1){
mobArray[i][1] = (mobArray[i][1] - (mobArray[i][4] / 4));
mobArray[i][2] = (mobArray[i][2] - (mobArray[i][5] / 4));
} else {
mobArray[i][1] = (mobArray[i][1] - mobArray[i][4]);
mobArray[i][2] = (mobArray[i][2] - mobArray[i][5]);
};
_local18 = mobArray[i];
_local19 = 8;
_local20 = (_local18[_local19] + 1);
_local18[_local19] = _local20;
if (mobArray[i][8] == 29){
mobArray[i][8] = 1;
};
fireFrame = getFire(mobArray[i][8]);
if (mobArray[i][14] == 1){
bmd1 = this[("mb" + mobArray[i][0])];
} else {
bmd1 = mobArray[i][9];
};
pt.x = (mobArray[i][1] + 5);
pt.y = (mobArray[i][2] - 40);
bmd2.copyPixels(fireFrame, fireFrame.rect, pt, null, null, false);
pt.x = mobArray[i][1];
pt.y = mobArray[i][2];
if (mobArray[i][0] == 5){
pt.x = (mobArray[i][1] - 5);
pt.y = (mobArray[i][2] - 5);
};
if (mobArray[i][0] == 6){
pt.x = (mobArray[i][1] - 8);
pt.y = (mobArray[i][2] - 8);
};
if (mobArray[i][0] == 7){
pt.x = (mobArray[i][1] - 20);
pt.y = (mobArray[i][2] - 15);
};
bmd2.copyPixels(bmd1, bmd1.rect, pt, null, null, false);
_local2 = hp1.rect;
_local3 = new Point(pt.x, pt.y);
_local3.x = (_local3.x + 4);
_local3.y = (_local3.y + 4);
if (gameStart == true){
bmd2.copyPixels(hp1, hp1.rect, pt, null, null, false);
};
_local2.width = (_local2.width - 8);
_local2.height = (_local2.height - 8);
_local4 = int(((mobArray[i][10] / mobArray[i][11]) * 100));
_local2.width = ((_local2.width * _local4) / 100);
if (gameStart == true){
bmd2.copyPixels(hp2, _local2, _local3, null, null, false);
};
_local5 = 0;
while (_local5 < turretArray.length) {
if (turretArray[_local5][8] == 0){
if (checkRange(pt, turretArray[_local5][1], turretArray[_local5][7])){
if (mobArray[i][12] < mobArray[i][11]){
turretArray[_local5][8] = int(turretArray[_local5][2]);
_local6 = bulletArray.length;
bulletArray[_local6] = new Array();
bulletArray[_local6][0] = turretArray[_local5][0];
switch (bulletArray[_local6][0]){
case 1:
playSound1();
break;
case 2:
playSound1();
break;
case 3:
playSound3();
break;
};
bulletArray[_local6][1] = new Point((turretArray[_local5][1].x + 12), (turretArray[_local5][1].y + 12));
bulletArray[_local6][2] = new Point((turretArray[_local5][1].x + 12), (turretArray[_local5][1].y + 12));
bulletArray[_local6][3] = new Point((turretArray[_local5][1].x + 12), (turretArray[_local5][1].y + 12));
bulletArray[_local6][4] = ((lookAt(turretArray[_local5][1], pt) - 90) + rand(180));
bulletArray[_local6][5] = 2;
bulletArray[_local6][6] = new int(i);
bulletArray[_local6][7] = turretArray[_local5][3];
bulletArray[_local6][8] = turretArray[_local5][4];
bulletArray[_local6][9] = turretArray[_local5][9];
mobArray[i][12] = (mobArray[i][12] + turretArray[_local5][3]);
};
};
};
_local5++;
};
if (outside(pt)){
mobArray.splice(i, 1);
_local5 = 0;
while (_local5 < bulletArray.length) {
if (int(bulletArray[_local5][6]) == i){
bulletArray.splice(_local5, 1);
_local5--;
};
_local5++;
};
_local5 = 0;
while (_local5 < bulletArray.length) {
if (int(bulletArray[_local5][6]) > i){
_local18 = bulletArray[_local5];
_local19 = 6;
_local20 = (_local18[_local19] - 1);
_local18[_local19] = _local20;
};
_local5++;
};
i--;
if (gameStart == true){
redd.play();
life--;
};
if (life == 0){
removeEventListener(Event.ENTER_FRAME, MainLoop);
buyTurret.t1.removeEventListener(MouseEvent.CLICK, bt);
buyTurret.t2.removeEventListener(MouseEvent.CLICK, bt);
buyTurret.t3.removeEventListener(MouseEvent.CLICK, bt);
buyTurret.t4.removeEventListener(MouseEvent.CLICK, bt);
bigmenu.t1.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t2.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t3.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t4.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t5.removeEventListener(MouseEvent.CLICK, jumpURL2);
tUpgrade.t1.removeEventListener(MouseEvent.CLICK, ut);
tUpgrade.t2.removeEventListener(MouseEvent.CLICK, sell);
tUpgrade.closer.removeEventListener(MouseEvent.CLICK, closeWindow);
stage.removeEventListener(MouseEvent.CLICK, checkMouse);
bpuller.r1.removeEventListener(MouseEvent.CLICK, restarter);
bpuller.r2.removeEventListener(MouseEvent.CLICK, switchBGM);
bpuller.r3.removeEventListener(MouseEvent.CLICK, startBut);
bpuller.t1.removeEventListener(MouseEvent.CLICK, bt);
bpuller.t2.removeEventListener(MouseEvent.CLICK, bt);
bpuller.t3.removeEventListener(MouseEvent.CLICK, bt);
bpuller.t4.removeEventListener(MouseEvent.CLICK, bt);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyEnter);
myTimer.removeEventListener("timer", timedFunction);
detailTxt.visible = false;
detailTxt2.visible = false;
detailTxt3.visible = false;
bulletArray = new Array();
mobArray = new Array();
turretArray = new Array();
bmd2.dispose();
gameOver = true;
gotoAndStop(4);
break;
};
};
i++;
};
_local5 = 0;
while (_local5 < bulletArray.length) {
_local7 = lookAt(bulletArray[_local5][1], new Point(mobArray[bulletArray[_local5][6]][1], mobArray[bulletArray[_local5][6]][2]));
bulletArray[_local5][4] = _local7;
if (bulletArray[_local5][5] < 10){
bulletArray[_local5][5] = (bulletArray[_local5][5] + 0.2);
};
_local8 = new Point(bulletArray[_local5][1].x, bulletArray[_local5][1].y);
_local9 = new Point(bulletArray[_local5][2].x, bulletArray[_local5][2].y);
bulletArray[_local5][3] = new Point(_local9.x, _local9.y);
bulletArray[_local5][2] = new Point(_local8.x, _local8.y);
_local10 = moveByAngle(_local8, bulletArray[_local5][4], bulletArray[_local5][5]);
bulletArray[_local5][1].x = (bulletArray[_local5][1].x - _local10.x);
bulletArray[_local5][1].y = (bulletArray[_local5][1].y - _local10.y);
_local11 = this[(("b" + bulletArray[_local5][0]) + "1")];
_local12 = this[(("b" + bulletArray[_local5][0]) + "2")];
_local13 = this[(("b" + bulletArray[_local5][0]) + "3")];
bmd2.copyPixels(_local13, _local13.rect, bulletArray[_local5][2], null, null, false);
bmd2.copyPixels(_local11, _local11.rect, bulletArray[_local5][1], null, null, false);
_local14 = new int(bulletArray[_local5][6]);
if (bulletArray[_local5][0] == 4){
_local15 = 200;
_local16 = 0;
while (!(checkRange(bulletArray[_local5][1], new Point(mobArray[_local14][1], mobArray[_local14][2]), 10))) {
_local16 = (_local16 + 1);
if ((_local16 % 20) == 0){
_local16 = 0;
_local7 = lookAt(bulletArray[_local5][1], new Point(mobArray[bulletArray[_local5][6]][1], mobArray[bulletArray[_local5][6]][2]));
bulletArray[_local5][4] = _local7;
_local8 = new Point(bulletArray[_local5][1].x, bulletArray[_local5][1].y);
_local10 = moveByAngle(_local8, bulletArray[_local5][4], bulletArray[_local5][5]);
};
if (_local15 > 0){
_local15--;
};
bulletArray[_local5][1].x = ((bulletArray[_local5][1].x - _local10.x) + ((rand(_local15) - rand(_local15)) / 100));
bulletArray[_local5][1].y = ((bulletArray[_local5][1].y - _local10.y) + ((rand(_local15) - rand(_local15)) / 100));
bmd2.copyPixels(_local11, _local11.rect, bulletArray[_local5][1], null, null, false);
};
};
if (checkRange(bulletArray[_local5][1], new Point(mobArray[_local14][1], mobArray[_local14][2]), 30)){
if (bulletArray[_local5][8] == 1){
mobArray[_local14][14] = 1;
mobArray[_local14][15] = bulletArray[_local5][9];
};
mobArray[_local14][10] = (mobArray[_local14][10] - bulletArray[_local5][7]);
if (mobArray[_local14][10] <= 0){
highScore = (highScore + (((mobArray[_local14][13] * mobArray[_local14][13]) * 6) + mobArray[_local14][13]));
cash = (cash + mobArray[_local14][13]);
mobArray.splice(_local14, 1);
_local17 = 0;
while (_local17 < bulletArray.length) {
if (bulletArray[_local17][6] == _local14){
bulletArray.splice(_local17, 1);
_local17--;
};
_local17++;
};
_local17 = 0;
while (_local17 < bulletArray.length) {
if (bulletArray[_local17][6] > _local14){
_local18 = bulletArray[_local17];
_local19 = 6;
_local20 = (_local18[_local19] - 1);
_local18[_local19] = _local20;
};
_local17++;
};
} else {
bulletArray.splice(_local5, 1);
};
_local5--;
};
_local5++;
};
if (moveX >= 50){
moveX = 1;
};
if (gameOver == false){
bm2 = new Bitmap(bmd2);
bm2.x = -100;
bm2.y = -100;
updateString();
if (life != 0){
this.addChild(bm2);
if (gameStart == true){
this.addChild(detailTxt);
this.addChild(detailTxt2);
this.addChild(detailTxt3);
this.addChild(ranger);
this.addChild(redd);
this.addChild(helper);
this.addChild(bpuller);
if (buyMenu == true){
this.addChild(buyTurret);
menuOut = true;
};
if (upgrader == true){
this.addChild(tUpgrade);
upgradeMenu = true;
};
} else {
this.addChild(bigmenu);
};
};
};
}
public function rand(_arg1:int){
return (Math.floor((Math.random() * _arg1)));
}
public function getData(){
switch (turretArray[founder][0]){
case 1:
myGunName = "Gun Turret";
switch (turretArray[founder][6]){
case 1:
aPrice = 17;
aDamage = 5;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 2:
aPrice = 35;
aDamage = 12;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 3:
aPrice = 70;
aDamage = 25;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 4:
aPrice = 200;
aDamage = 75;
aFire = 0;
aRange = 10;
aTime = 0;
break;
};
break;
case 2:
myGunName = "Frozer";
switch (turretArray[founder][6]){
case 1:
aPrice = 20;
aDamage = 3;
aFire = 5;
aRange = 0;
aTime = 20;
break;
case 2:
aPrice = 20;
aDamage = 3;
aFire = 5;
aRange = 0;
aTime = 20;
break;
case 3:
aPrice = 20;
aDamage = 3;
aFire = 5;
aRange = 0;
aTime = 20;
break;
case 4:
aPrice = 100;
aDamage = 30;
aFire = 5;
aRange = 0;
aTime = 320;
break;
};
break;
case 3:
myGunName = "Rapid Turret";
switch (turretArray[founder][6]){
case 1:
aPrice = 30;
aDamage = 1;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 2:
aPrice = 60;
aDamage = 2;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 3:
aPrice = 80;
aDamage = 3;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 4:
aPrice = 250;
aDamage = 10;
aFire = 0;
aRange = 30;
aTime = 0;
break;
};
break;
case 4:
myGunName = "Beam Turret";
switch (turretArray[founder][6]){
case 1:
aPrice = 100;
aDamage = 1;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 2:
aPrice = 200;
aDamage = 2;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 3:
aPrice = 300;
aDamage = 4;
aFire = 0;
aRange = 10;
aTime = 0;
break;
case 4:
aPrice = 400;
aDamage = 7;
aFire = 0;
aRange = 0;
aTime = 0;
break;
};
break;
};
}
public function timedFunction(_arg1:TimerEvent){
tSeconds++;
}
public function bt(_arg1:MouseEvent){
clickClose = true;
if (_arg1.target.name == "t1"){
drag = t1;
dragr = tr1;
dragStart = true;
buyMenu = false;
dtype = 1;
dFire = 20;
dDamage = 5;
dEffect = 0;
dPrice = 20;
dRange = 200;
dTime = 0;
};
if (_arg1.target.name == "t2"){
drag = t3;
dragr = tr3;
dragStart = true;
buyMenu = false;
dtype = 2;
dFire = 30;
dDamage = 3;
dEffect = 1;
dPrice = 30;
dRange = 400;
dTime = 300;
};
if (_arg1.target.name == "t3"){
drag = t2;
dragr = tr2;
dragStart = true;
buyMenu = false;
dtype = 3;
dFire = 3;
dDamage = 2;
dEffect = 0;
dPrice = 80;
dRange = 300;
dTime = 0;
};
if (_arg1.target.name == "t4"){
drag = t4;
dragr = tr4;
dragStart = true;
buyMenu = false;
dtype = 4;
dFire = 1;
dDamage = 1;
dEffect = 0;
dPrice = 140;
dRange = 200;
dTime = 0;
};
ranger.visible = true;
ranger.width = dRange;
ranger.height = dRange;
}
public function createMob(_arg1:int){
var _local2:int;
var _local3:Point;
var _local4:Point;
var _local5:int;
_local2 = mobArray.length;
mobArray[_local2] = new Array();
mobArray[_local2][0] = _arg1;
_local3 = new Point();
_local3.x = (100 + rand(460));
_local3.y = -100;
mobArray[_local2][1] = _local3.x;
mobArray[_local2][2] = _local3.y;
if (_local3.x > 280){
mobArray[_local2][3] = (rand(10) + 180);
};
if (_local3.x <= 280){
mobArray[_local2][3] = (rand(10) + 170);
};
mobArray[_local2][6] = ((1000 + rand(3000)) / 1000);
_local4 = moveByAngle(_local3, mobArray[_local2][3], mobArray[_local2][6]);
mobArray[_local2][4] = _local4.x;
mobArray[_local2][5] = _local4.y;
mobArray[_local2][7] = 1;
mobArray[_local2][8] = 1;
if (lvl == 0){
_local5 = (rand(4) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 1){
_local5 = (rand(1) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 2){
_local5 = (rand(2) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 3){
_local5 = (rand(2) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 4){
_local5 = (rand(2) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 5){
_local5 = (rand(1) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 6){
_local5 = (rand(3) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 7){
_local5 = (rand(3) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 8){
_local5 = (rand(4) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 9){
_local5 = (rand(4) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 10){
_local5 = (rand(1) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 11){
_local5 = (rand(5) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 12){
_local5 = (rand(5) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 13){
_local5 = (rand(5) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl == 14){
_local5 = (rand(6) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if (lvl >= 15){
_local5 = (rand(6) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
if ((((lvl > 3)) || ((lvl == 0)))){
if ((((rand(100) + 1) - (lvl * 2)) % 99) == 1){
_local5 = ((4 + rand(3)) + 1);
mobArray[_local2][9] = this[("m" + _local5)];
};
};
switch (_local5){
case 1:
mobArray[_local2][10] = ((3 * lvl) + 2);
mobArray[_local2][11] = ((3 * lvl) + 2);
mobArray[_local2][13] = 1;
break;
case 2:
mobArray[_local2][10] = ((6 * lvl) + 2);
mobArray[_local2][11] = ((6 * lvl) + 2);
mobArray[_local2][13] = 3;
break;
case 3:
mobArray[_local2][10] = ((13 * lvl) + 3);
mobArray[_local2][11] = ((13 * lvl) + 3);
mobArray[_local2][13] = 5;
break;
case 4:
mobArray[_local2][10] = ((16 * lvl) + 5);
mobArray[_local2][11] = ((16 * lvl) + 5);
mobArray[_local2][13] = 6;
break;
case 5:
mobArray[_local2][10] = ((21 * lvl) + 15);
mobArray[_local2][11] = ((21 * lvl) + 15);
mobArray[_local2][13] = 10;
break;
case 6:
mobArray[_local2][10] = ((32 * lvl) + 20);
mobArray[_local2][11] = ((32 * lvl) + 20);
mobArray[_local2][13] = 20;
break;
case 7:
mobArray[_local2][10] = ((48 * lvl) + 30);
mobArray[_local2][11] = ((48 * lvl) + 30);
mobArray[_local2][13] = 45;
break;
};
mobArray[_local2][0] = _local5;
if (lvl < 20){
mobArray[_local2][10] = int((mobArray[_local2][10] * (((lvl * 3) + 100) / 100)));
mobArray[_local2][11] = int((mobArray[_local2][11] * (((lvl * 3) + 100) / 100)));
} else {
mobArray[_local2][10] = int((mobArray[_local2][10] * (((lvl * (lvl - 17)) + 100) / 100)));
mobArray[_local2][11] = int((mobArray[_local2][11] * (((lvl * (lvl - 17)) + 100) / 100)));
};
mobArray[_local2][12] = 0;
mobArray[_local2][14] = 0;
mobArray[_local2][15] = 0;
}
function frame2(){
if (myName == ""){
stage.addEventListener(KeyboardEvent.KEY_DOWN, enterName);
continue1.addEventListener(MouseEvent.CLICK, clickGo);
stop();
} else {
gotoAndStop(3);
};
}
function frame3(){
BGM = new myBGM();
onBGM = 1;
Chan1 = BGM.play(0, 99999);
mySound1 = new sound1();
mySound3 = new sound3();
myTimer = new Timer(1000);
tSeconds = 0;
myTimer.addEventListener("timer", timedFunction);
myTimer.start();
bigmenu.t5.addEventListener(MouseEvent.CLICK, jumpURL2);
addEventListener(Event.ENTER_FRAME, MainLoop);
bpuller.r1.addEventListener(MouseEvent.CLICK, restarter);
bpuller.r2.addEventListener(MouseEvent.CLICK, switchBGM);
bpuller.r3.addEventListener(MouseEvent.CLICK, startBut);
bpuller.t1.addEventListener(MouseEvent.CLICK, bt);
bpuller.t2.addEventListener(MouseEvent.CLICK, bt);
bpuller.t3.addEventListener(MouseEvent.CLICK, bt);
bpuller.t4.addEventListener(MouseEvent.CLICK, bt);
buyTurret.t1.addEventListener(MouseEvent.CLICK, bt);
buyTurret.t2.addEventListener(MouseEvent.CLICK, bt);
buyTurret.t3.addEventListener(MouseEvent.CLICK, bt);
buyTurret.t4.addEventListener(MouseEvent.CLICK, bt);
bigmenu.t1.addEventListener(MouseEvent.CLICK, mt);
bigmenu.t2.addEventListener(MouseEvent.CLICK, mt);
bigmenu.t3.addEventListener(MouseEvent.CLICK, mt);
bigmenu.t4.addEventListener(MouseEvent.CLICK, mt);
tUpgrade.t1.addEventListener(MouseEvent.CLICK, ut);
tUpgrade.t2.addEventListener(MouseEvent.CLICK, sell);
stage.addEventListener(MouseEvent.CLICK, checkMouse);
tUpgrade.closer.addEventListener(MouseEvent.CLICK, closeWindow);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyEnter);
stage.addEventListener(KeyboardEvent.KEY_UP, clearKey);
detailTxt.visible = true;
detailTxt2.visible = true;
detailTxt3.visible = true;
lvl = 0;
mobRemain = 5000;
cash = 1000;
life = 10;
noUpgrade = false;
found = false;
turretArray = new Array();
bulletArray = new Array();
upgradeMenu = false;
upgrader = false;
clickClose = false;
mobArray = new Array();
basePoint = new Point();
bmd1 = new ship1(0, 0);
bmd2 = new BitmapData(500, 500);
dragStart = false;
planetData = new planet(0, 0);
hp1 = new hpbar(0, 0);
hp2 = new rd(0, 0);
b11 = new bullet11(0, 0);
b12 = new bullet12(0, 0);
b13 = new bullet13(0, 0);
b21 = new bullet21(0, 0);
b23 = new bullet23(0, 0);
b31 = new bullet31(0, 0);
b33 = new bullet33(0, 0);
b41 = new bullet41(0, 0);
b43 = new bullet41(0, 0);
t1 = new tower1(0, 0);
t2 = new tower2(0, 0);
t3 = new tower3(0, 0);
t4 = new tower4(0, 0);
tr1 = new tower1r(0, 0);
tr2 = new tower2r(0, 0);
tr3 = new tower3r(0, 0);
tr4 = new tower4r(0, 0);
m1 = new ship1(0, 0);
m2 = new ship2(0, 0);
m3 = new ship3(0, 0);
m4 = new ship4(0, 0);
m5 = new ship5b(0, 0);
m6 = new ship6(0, 0);
m7 = new ship7(0, 0);
n1 = new num1(0, 0);
n2 = new num2(0, 0);
n3 = new num3(0, 0);
n4 = new num4(0, 0);
n5 = new num5(0, 0);
mb1 = new ship1b(0, 0);
mb2 = new ship2b(0, 0);
mb3 = new ship3b(0, 0);
mb4 = new ship4b(0, 0);
mb5 = new ship5b(0, 0);
mb6 = new ship6(0, 0);
mb7 = new ship7(0, 0);
f1 = new fire1(0, 0);
f2 = new fire2(0, 0);
f3 = new fire3(0, 0);
f4 = new fire4(0, 0);
f5 = new fire5(0, 0);
f6 = new fire6(0, 0);
f7 = new fire7(0, 0);
f8 = new fire8(0, 0);
f9 = new fire9(0, 0);
f10 = new fire10(0, 0);
f11 = new fire11(0, 0);
f12 = new fire12(0, 0);
f13 = new fire13(0, 0);
f14 = new fire14(0, 0);
f15 = new fire15(0, 0);
f16 = new fire16(0, 0);
f17 = new fire17(0, 0);
f18 = new fire18(0, 0);
f19 = new fire19(0, 0);
f20 = new fire20(0, 0);
f21 = new fire21(0, 0);
f22 = new fire22(0, 0);
f23 = new fire23(0, 0);
f24 = new fire24(0, 0);
f25 = new fire25(0, 0);
f26 = new fire26(0, 0);
f27 = new fire27(0, 0);
f28 = new fire28(0, 0);
s1 = new star1(0, 0);
s2 = new star2(0, 0);
s3 = new star3(0, 0);
starArray = new Array();
buyMenu = false;
gameStart = false;
holdCtrl = false;
moveX = 0;
pt = new Point(0, 0);
lvlSpeed = 2;
puller = false;
highScore = 0;
outPoint = new Point();
menuOut = false;
survive = false;
gameOver = false;
initStar();
init();
updateString();
bpuller.visible = false;
tUpgrade.visible = false;
this.removeChild(buyTurret);
this.removeChild(tUpgrade);
stop();
}
function frame4(){
endTxt.text = ("Your final score\n" + highScore);
myData = new URLRequest("http://www.webgames.bz/postScore.php");
myData.method = URLRequestMethod.POST;
variables = new URLVariables();
variables.myName = myName;
variables.myScore = highScore;
variables.myScore2 = tSeconds;
variables.myMode = myMode;
myData.data = variables;
loader2 = new URLLoader();
loader2.dataFormat = URLLoaderDataFormat.TEXT;
loader2.addEventListener(Event.COMPLETE, dataOnLoad);
loader2.load(myData);
}
function frame5(){
endTxt.text = ("Your final score\n" + highScore);
r12.addEventListener(MouseEvent.CLICK, restarter2);
gURL.addEventListener(MouseEvent.CLICK, jumpURL);
}
function frame1(){
MochiAd.showPreGameAd({clip:root, id:"a599f5fec5f0a483", res:"500x500", background:0xFFFFFF, color:15452340, outline:15445354, no_bg:true});
addEventListener(Event.ENTER_FRAME, loader);
myName = "";
myMode = 0;
NoMenu = new ContextMenu();
NoMenu.hideBuiltInItems();
this.contextMenu = NoMenu;
allowed_site = "kongregate.com";
domain = this.root.loaderInfo.url.split("/")[2];
if (domain.indexOf(allowed_site) == (domain.length - allowed_site.length)){
};
stop();
}
public function checkMouse(_arg1:MouseEvent){
if ((((((dragStart == true)) && ((menuOut == false)))) && ((clickClose == false)))){
if ((((found == false)) && ((cash >= dPrice)))){
maxTurret = turretArray.length;
turretArray[maxTurret] = new Array();
turretArray[maxTurret][0] = dtype;
turretArray[maxTurret][1] = mousePoint;
turretArray[maxTurret][2] = dFire;
turretArray[maxTurret][3] = dDamage;
turretArray[maxTurret][4] = dEffect;
turretArray[maxTurret][5] = drag;
turretArray[maxTurret][6] = 1;
turretArray[maxTurret][7] = dRange;
turretArray[maxTurret][8] = 0;
turretArray[maxTurret][9] = dTime;
turretArray[maxTurret][10] = int((dPrice / 2));
cash = (cash - dPrice);
if (holdCtrl == false){
dragStart = false;
ranger.visible = false;
tUpgrade.visible = false;
};
} else {
if (holdCtrl == false){
placementError();
};
};
} else {
if ((((noUpgrade == false)) && ((clickClose == false)))){
if ((((dragStart == false)) && ((found == true)))){
if (mouseX > 250){
tUpgrade.x = 105;
} else {
tUpgrade.x = 394;
};
founder2 = pFounder;
founder = pFounder;
tUpgrade.gotoAndStop(turretArray[founder][0]);
getData();
tUpgrade.dName.text = myGunName;
tUpgrade.dDetails.text = ((((((((((("Level: " + turretArray[founder][6]) + "\nDamage: ") + turretArray[founder][3]) + "\nFire Ratio: ") + turretArray[founder][2]) + "\nRange: ") + turretArray[founder][7]) + "\n\nValue: $") + turretArray[founder][10]) + "\nUpgrade Cost: $") + aPrice);
if (turretArray[founder][6] < 5){
tUpgrade.t1.visible = true;
} else {
tUpgrade.t1.visible = false;
};
tUpgrade.visible = true;
upgrader = true;
ranger.width = turretArray[founder][7];
ranger.height = turretArray[founder][7];
ranger.visible = true;
};
} else {
clickClose = false;
};
};
}
public function clickGo(_arg1){
stage.removeEventListener(KeyboardEvent.KEY_DOWN, enterName);
continue1.removeEventListener(MouseEvent.CLICK, clickGo);
myName = eName.text;
gotoAndStop(3);
}
public function restarter2(_arg1){
Chan1.stop();
gURL.removeEventListener(MouseEvent.CLICK, jumpURL);
r12.removeEventListener(MouseEvent.CLICK, restarter2);
gotoAndPlay(2);
}
public function clearKey(_arg1){
holdCtrl = false;
}
public function init(){
basePoint.x = 350;
basePoint.y = 700;
}
public function checkRange(_arg1:Point, _arg2:Point, _arg3:int){
var _local4:Number;
_local4 = (_arg3 / 2);
if ((((_arg2.x > (_arg1.x - _local4))) && ((_arg2.x < (_arg1.x + _local4))))){
if ((((_arg2.y > (_arg1.y - _local4))) && ((_arg2.y < (_arg1.y + _local4))))){
return (true);
};
};
}
public function switchBGM(_arg1){
if (onBGM == 1){
Chan1.stop();
onBGM = 0;
} else {
Chan1 = BGM.play(0, 99999);
onBGM = 1;
};
}
public function playSound1(){
if (onBGM == 1){
mySound1.play();
};
}
public function playSound3(){
if (onBGM == 1){
mySound3.play();
};
}
public function enterName(_arg1):void{
key = _arg1.keyCode;
if (key == Keyboard.ENTER){
myName = eName.text;
stage.removeEventListener(KeyboardEvent.KEY_DOWN, enterName);
continue1.removeEventListener(MouseEvent.CLICK, clickGo);
gotoAndStop(3);
};
}
public function outside(_arg1:Point){
if (_arg1.y > 600){
return (true);
};
}
public function mt(_arg1:MouseEvent){
if (_arg1.target.name == "t1"){
myMode = 1;
gameStart = true;
lvl = 0;
mobRemain = 0;
mobArray = new Array();
cash = 200;
bigmenu.t1.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t2.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t3.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t4.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t5.removeEventListener(MouseEvent.CLICK, jumpURL2);
this.removeChild(bigmenu);
};
if (_arg1.target.name == "t2"){
myMode = 2;
gameStart = true;
lvl = 0;
mobRemain = 0;
mobArray = new Array();
cash = 200;
survive = true;
bigmenu.t1.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t2.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t3.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t4.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t5.removeEventListener(MouseEvent.CLICK, jumpURL2);
this.removeChild(bigmenu);
};
if (_arg1.target.name == "t3"){
myMode = 3;
gameStart = true;
lvl = 0;
mobRemain = 0;
mobArray = new Array();
cash = 200;
noUpgrade = true;
bigmenu.t1.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t2.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t3.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t4.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t5.removeEventListener(MouseEvent.CLICK, jumpURL2);
this.removeChild(bigmenu);
};
if (_arg1.target.name == "t4"){
myMode = 4;
gameStart = true;
lvl = 9;
mobRemain = 0;
mobArray = new Array();
cash = 10000;
bigmenu.t1.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t2.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t3.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t4.removeEventListener(MouseEvent.CLICK, mt);
bigmenu.t5.removeEventListener(MouseEvent.CLICK, jumpURL2);
this.removeChild(bigmenu);
};
}
public function moveByAngle(_arg1, _arg2, _arg3){
var _local4:Number;
var _local5:Number;
if (_arg2 < 0){
_arg2 = (_arg2 + 360);
};
if (_arg2 > 360){
_arg2 = (_arg2 - 360);
};
if ((((_arg2 >= 0)) && ((_arg2 <= 90)))){
_local4 = (_arg2 / 90);
_local5 = (1 - _local4);
_local4 = -(_local4);
} else {
if ((((_arg2 > 90)) && ((_arg2 <= 180)))){
_local5 = ((_arg2 - 90) / 90);
_local4 = (1 - _local5);
_local4 = -(_local4);
_local5 = -(_local5);
} else {
if ((((_arg2 > 180)) && ((_arg2 <= 270)))){
_local4 = ((_arg2 - 180) / 90);
_local5 = (1 - _local4);
_local5 = -(_local5);
} else {
if ((((_arg2 > 270)) && ((_arg2 <= 360)))){
_local5 = ((_arg2 - 270) / 90);
_local4 = (1 - _local5);
};
};
};
};
_arg1.x = (_local4 * _arg3);
_arg1.y = (_local5 * _arg3);
return (_arg1);
}
public function startNew(){
if ((((((((mobRemain == 0)) && (!((life == 0))))) && ((mobArray.length == 0)))) || ((survive == true)))){
lvl++;
switch (lvl){
case 1:
mobRemain = 70;
lvlSpeed = 7;
break;
case 2:
mobRemain = 50;
lvlSpeed = 8;
break;
case 3:
mobRemain = 100;
lvlSpeed = 6;
break;
case 4:
mobRemain = 150;
lvlSpeed = 5;
break;
case 5:
mobRemain = 150;
lvlSpeed = 4;
break;
case 6:
mobRemain = 250;
lvlSpeed = 4;
break;
case 7:
mobRemain = 250;
lvlSpeed = 4;
break;
case 8:
mobRemain = 250;
lvlSpeed = 4;
break;
case 9:
mobRemain = 300;
lvlSpeed = 3;
break;
case 10:
mobRemain = 300;
lvlSpeed = 3;
break;
case 11:
mobRemain = 300;
lvlSpeed = 3;
break;
case 12:
mobRemain = 500;
lvlSpeed = 2;
break;
case 13:
mobRemain = 500;
lvlSpeed = 2;
break;
case 14:
mobRemain = 700;
lvlSpeed = 2;
break;
case 15:
mobRemain = 700;
lvlSpeed = 1;
break;
case 16:
mobRemain = 400;
lvlSpeed = 1;
break;
case 17:
mobRemain = 600;
lvlSpeed = 1;
break;
case 18:
mobRemain = 800;
lvlSpeed = 1;
break;
case 19:
mobRemain = 1000;
lvlSpeed = 1;
break;
default:
mobRemain = 2000;
lvlSpeed = 1;
break;
};
};
}
public function jumpURL2(_arg1){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.webgames.bz");
navigateToURL(_local2);
}
public function upgradeScript(){
var _local1:String;
if ((((cash >= aPrice)) && ((turretArray[founder][6] < 5)))){
getData();
_local1 = (((((((((((((((((((("Level: " + turretArray[founder][6]) + "<font color='#00FF00'>+") + 1) + "</font>\nDamage: ") + turretArray[founder][3]) + "<font color='#00FF00'>+") + aDamage) + "</font>\nFire Ratio: ") + turretArray[founder][2]) + "<font color='#00FF00'>+") + aFire) + "</font>\nRange: ") + turretArray[founder][7]) + "<font color='#00FF00'>+") + aRange) + "</font>\n\nValue: $") + turretArray[founder][10]) + "<font color='#00FF00'>+") + int((aPrice / 2))) + "</font>");
cash = (cash - aPrice);
var _local2 = turretArray[founder];
var _local3 = 6;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
turretArray[founder][3] = (turretArray[founder][3] + aDamage);
turretArray[founder][10] = (turretArray[founder][10] + int((aPrice / 2)));
turretArray[founder][9] = (turretArray[founder][9] + aTime);
turretArray[founder][2] = (turretArray[founder][2] - aFire);
turretArray[founder][7] = (turretArray[founder][7] + aRange);
getData();
tUpgrade.dDetails.htmlText = ((_local1 + "\nUpgrade Price: $") + aPrice);
ranger.width = turretArray[founder][7];
ranger.height = turretArray[founder][7];
if (turretArray[founder][6] < 5){
tUpgrade.t1.visible = true;
} else {
tUpgrade.t1.visible = false;
};
};
}
public function placementError(){
dragStart = false;
ranger.visible = false;
}
public function updateString(){
detailTxt.text = String(((("Wave: " + lvl) + "\nRemaining mob: ") + mobRemain));
detailTxt2.text = String(((("Cash: $" + cash) + "\nLife: ") + life));
detailTxt3.text = String(("High Score: " + highScore));
}
public function jumpURL(_arg1){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.webgames.bz/highScore.php?id=1");
navigateToURL(_local2);
}
public function ut(_arg1:MouseEvent){
if (noUpgrade == false){
if (_arg1.target.name == "t1"){
upgradeScript();
};
if (_arg1.target.name == "t2"){
sellScript();
};
};
}
public function getFire(_arg1:int){
return (this[("f" + _arg1)]);
}
public function sellScript(){
if (upgrader == true){
cash = (cash + turretArray[founder][10]);
turretArray.splice(founder, 1);
found = false;
tUpgrade.visible = false;
ranger.visible = false;
upgrader = false;
};
}
public function startBut(_arg1){
startNew();
}
public function rRed(_arg1:BitmapData){
if (_arg1 == t1){
_arg1 = tr1;
};
if (_arg1 == t2){
_arg1 = tr2;
};
if (_arg1 == t3){
_arg1 = tr3;
};
if (_arg1 == t4){
_arg1 = tr4;
};
return (_arg1);
}
public function checkPlacement(_arg1:Point, _arg2:Point){
if ((((_arg2.x > (_arg1.x - 35))) && ((_arg2.x < (_arg1.x + 35))))){
if ((((_arg2.y > (_arg1.y - 35))) && ((_arg2.y < (_arg1.y + 35))))){
return (true);
};
};
}
public function restarter(_arg1){
Chan1.stop();
bpuller.r1.removeEventListener(MouseEvent.CLICK, restarter);
gotoAndPlay(2);
}
public function lookAt(_arg1:Point, _arg2:Point){
var _local3:Number;
var _local4:Number;
var _local5:Number;
if ((((_arg2.x >= _arg1.x)) && ((_arg2.y < _arg1.y)))){
_local3 = (_arg2.x - _arg1.x);
_local4 = (_arg1.y - _arg2.y);
if (_local3 <= _local4){
_local5 = ((45 * _local3) / _local4);
} else {
_local5 = ((45 * _local4) / _local3);
_local5 = (90 - _local5);
};
};
if ((((_arg2.x >= _arg1.x)) && ((_arg2.y > _arg1.y)))){
_local3 = (_arg2.x - _arg1.x);
_local4 = (_arg2.y - _arg1.y);
if (_local3 <= _local4){
_local5 = ((45 * _local3) / _local4);
_local5 = (180 - _local5);
} else {
_local5 = (((45 * _local4) / _local3) + 90);
};
};
if ((((_arg2.x <= _arg1.x)) && ((_arg2.y > _arg1.y)))){
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg2.y - _arg1.y);
if (_local3 <= _local4){
_local5 = ((45 * _local3) / _local4);
_local5 = (180 + _local5);
} else {
_local5 = (270 - ((45 * _local4) / _local3));
};
};
if ((((_arg2.x <= _arg1.x)) && ((_arg2.y < _arg1.y)))){
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
if (_local3 <= _local4){
_local5 = ((45 * _local3) / _local4);
_local5 = (360 - _local5);
} else {
_local5 = (270 + ((45 * _local4) / _local3));
};
};
return (_local5);
}
public function sell(_arg1:MouseEvent){
sellScript();
}
public function initStar(){
st = 0;
while (st < 20) {
starArray[st] = new Array();
starArray[st][0] = 1;
starArray[st][1] = new Point();
starArray[st][1].x = 0;
starArray[st][1].y = 0.5;
starArray[st][2] = new Point();
starArray[st][2].x = (50 + rand(550));
starArray[st][2].y = (50 + rand(550));
st++;
};
st = 20;
while (st < 60) {
starArray[st] = new Array();
starArray[st][0] = 2;
starArray[st][1] = new Point();
starArray[st][1].x = 0;
starArray[st][1].y = 1.5;
starArray[st][2] = new Point();
starArray[st][2].x = (50 + rand(550));
starArray[st][2].y = (50 + rand(550));
st++;
};
st = 60;
while (st < 80) {
starArray[st] = new Array();
starArray[st][0] = 3;
starArray[st][1] = new Point();
starArray[st][1].x = 0;
starArray[st][1].y = 1;
starArray[st][2] = new Point();
starArray[st][2].x = (50 + rand(550));
starArray[st][2].y = (50 + rand(550));
st++;
};
}
public function dataOnLoad(_arg1){
loader2.removeEventListener(Event.COMPLETE, dataOnLoad);
gotoAndStop(5);
}
public function keyEnter(_arg1):void{
key = _arg1.keyCode;
switch (key){
case Keyboard.SPACE:
if (gameStart == true){
startNew();
break;
};
case 66:
if (gameStart == true){
if (buyMenu == true){
buyMenu = false;
} else {
ranger.visible = false;
tUpgrade.visible = false;
buyMenu = true;
};
};
break;
case 83:
sellScript();
break;
case 85:
upgradeScript();
break;
};
if (key == 17){
holdCtrl = true;
};
if (key == 27){
ranger.visible = false;
tUpgrade.visible = false;
buyMenu = false;
dragStart = false;
};
}
public function rNormal(_arg1:BitmapData){
if (_arg1 == tr1){
_arg1 = t1;
};
if (_arg1 == tr2){
_arg1 = t2;
};
if (_arg1 == tr3){
_arg1 = t3;
};
if (_arg1 == tr4){
_arg1 = t4;
};
return (_arg1);
}
}
}//package game7_mochi_fla
Section 2
//Timeline_1 (game7_mochi_fla.Timeline_1)
package game7_mochi_fla {
import flash.display.*;
public dynamic class Timeline_1 extends MovieClip {
public function Timeline_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package game7_mochi_fla
Section 3
//Timeline_17 (game7_mochi_fla.Timeline_17)
package game7_mochi_fla {
import flash.display.*;
public dynamic class Timeline_17 extends MovieClip {
public function Timeline_17(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package game7_mochi_fla
Section 4
//Timeline_21 (game7_mochi_fla.Timeline_21)
package game7_mochi_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Timeline_21 extends MovieClip {
public var dName:TextField;
public var t2:SimpleButton;
public var t1:SimpleButton;
public var dDetails:TextField;
public var closer:SimpleButton;
public var dType:MovieClip;
public function Timeline_21(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package game7_mochi_fla
Section 5
//Timeline_29 (game7_mochi_fla.Timeline_29)
package game7_mochi_fla {
import flash.display.*;
public dynamic class Timeline_29 extends MovieClip {
public var t2:SimpleButton;
public var t3:SimpleButton;
public var t1:SimpleButton;
public var t5:SimpleButton;
public var t4:SimpleButton;
}
}//package game7_mochi_fla
Section 6
//Timeline_41 (game7_mochi_fla.Timeline_41)
package game7_mochi_fla {
import flash.display.*;
public dynamic class Timeline_41 extends MovieClip {
public var r2:SimpleButton;
public var r3:SimpleButton;
public var t2:SimpleButton;
public var t3:SimpleButton;
public var t1:SimpleButton;
public var t4:SimpleButton;
public var r1:SimpleButton;
}
}//package game7_mochi_fla
Section 7
//Timeline_49 (game7_mochi_fla.Timeline_49)
package game7_mochi_fla {
import flash.display.*;
public dynamic class Timeline_49 extends MovieClip {
public function Timeline_49(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package game7_mochi_fla
Section 8
//Timeline_7 (game7_mochi_fla.Timeline_7)
package game7_mochi_fla {
import flash.display.*;
public dynamic class Timeline_7 extends MovieClip {
public var t2:SimpleButton;
public var t3:SimpleButton;
public var t1:SimpleButton;
public var t4:SimpleButton;
}
}//package game7_mochi_fla
Section 9
//bullet11 (bullet11)
package {
import flash.display.*;
public dynamic class bullet11 extends BitmapData {
public function bullet11(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 10
//bullet12 (bullet12)
package {
import flash.display.*;
public dynamic class bullet12 extends BitmapData {
public function bullet12(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 11
//bullet13 (bullet13)
package {
import flash.display.*;
public dynamic class bullet13 extends BitmapData {
public function bullet13(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 12
//bullet21 (bullet21)
package {
import flash.display.*;
public dynamic class bullet21 extends BitmapData {
public function bullet21(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 13
//bullet23 (bullet23)
package {
import flash.display.*;
public dynamic class bullet23 extends BitmapData {
public function bullet23(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 14
//bullet31 (bullet31)
package {
import flash.display.*;
public dynamic class bullet31 extends BitmapData {
public function bullet31(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 15
//bullet33 (bullet33)
package {
import flash.display.*;
public dynamic class bullet33 extends BitmapData {
public function bullet33(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 16
//bullet41 (bullet41)
package {
import flash.display.*;
public dynamic class bullet41 extends BitmapData {
public function bullet41(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 17
//fire1 (fire1)
package {
import flash.display.*;
public dynamic class fire1 extends BitmapData {
public function fire1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 18
//fire10 (fire10)
package {
import flash.display.*;
public dynamic class fire10 extends BitmapData {
public function fire10(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 19
//fire11 (fire11)
package {
import flash.display.*;
public dynamic class fire11 extends BitmapData {
public function fire11(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 20
//fire12 (fire12)
package {
import flash.display.*;
public dynamic class fire12 extends BitmapData {
public function fire12(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 21
//fire13 (fire13)
package {
import flash.display.*;
public dynamic class fire13 extends BitmapData {
public function fire13(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 22
//fire14 (fire14)
package {
import flash.display.*;
public dynamic class fire14 extends BitmapData {
public function fire14(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 23
//fire15 (fire15)
package {
import flash.display.*;
public dynamic class fire15 extends BitmapData {
public function fire15(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 24
//fire16 (fire16)
package {
import flash.display.*;
public dynamic class fire16 extends BitmapData {
public function fire16(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 25
//fire17 (fire17)
package {
import flash.display.*;
public dynamic class fire17 extends BitmapData {
public function fire17(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 26
//fire18 (fire18)
package {
import flash.display.*;
public dynamic class fire18 extends BitmapData {
public function fire18(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 27
//fire19 (fire19)
package {
import flash.display.*;
public dynamic class fire19 extends BitmapData {
public function fire19(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 28
//fire2 (fire2)
package {
import flash.display.*;
public dynamic class fire2 extends BitmapData {
public function fire2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 29
//fire20 (fire20)
package {
import flash.display.*;
public dynamic class fire20 extends BitmapData {
public function fire20(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 30
//fire21 (fire21)
package {
import flash.display.*;
public dynamic class fire21 extends BitmapData {
public function fire21(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 31
//fire22 (fire22)
package {
import flash.display.*;
public dynamic class fire22 extends BitmapData {
public function fire22(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 32
//fire23 (fire23)
package {
import flash.display.*;
public dynamic class fire23 extends BitmapData {
public function fire23(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 33
//fire24 (fire24)
package {
import flash.display.*;
public dynamic class fire24 extends BitmapData {
public function fire24(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 34
//fire25 (fire25)
package {
import flash.display.*;
public dynamic class fire25 extends BitmapData {
public function fire25(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 35
//fire26 (fire26)
package {
import flash.display.*;
public dynamic class fire26 extends BitmapData {
public function fire26(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 36
//fire27 (fire27)
package {
import flash.display.*;
public dynamic class fire27 extends BitmapData {
public function fire27(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 37
//fire28 (fire28)
package {
import flash.display.*;
public dynamic class fire28 extends BitmapData {
public function fire28(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 38
//fire3 (fire3)
package {
import flash.display.*;
public dynamic class fire3 extends BitmapData {
public function fire3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 39
//fire4 (fire4)
package {
import flash.display.*;
public dynamic class fire4 extends BitmapData {
public function fire4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 40
//fire5 (fire5)
package {
import flash.display.*;
public dynamic class fire5 extends BitmapData {
public function fire5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 41
//fire6 (fire6)
package {
import flash.display.*;
public dynamic class fire6 extends BitmapData {
public function fire6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 42
//fire7 (fire7)
package {
import flash.display.*;
public dynamic class fire7 extends BitmapData {
public function fire7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 43
//fire8 (fire8)
package {
import flash.display.*;
public dynamic class fire8 extends BitmapData {
public function fire8(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 44
//fire9 (fire9)
package {
import flash.display.*;
public dynamic class fire9 extends BitmapData {
public function fire9(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 45
//hpbar (hpbar)
package {
import flash.display.*;
public dynamic class hpbar extends BitmapData {
public function hpbar(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 46
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return ("2.2");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 47
//myBGM (myBGM)
package {
import flash.media.*;
public dynamic class myBGM extends Sound {
}
}//package
Section 48
//num1 (num1)
package {
import flash.display.*;
public dynamic class num1 extends BitmapData {
public function num1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 49
//num2 (num2)
package {
import flash.display.*;
public dynamic class num2 extends BitmapData {
public function num2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 50
//num3 (num3)
package {
import flash.display.*;
public dynamic class num3 extends BitmapData {
public function num3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 51
//num4 (num4)
package {
import flash.display.*;
public dynamic class num4 extends BitmapData {
public function num4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 52
//num5 (num5)
package {
import flash.display.*;
public dynamic class num5 extends BitmapData {
public function num5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 53
//planet (planet)
package {
import flash.display.*;
public dynamic class planet extends BitmapData {
public function planet(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 54
//rd (rd)
package {
import flash.display.*;
public dynamic class rd extends BitmapData {
public function rd(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 55
//ship1 (ship1)
package {
import flash.display.*;
public dynamic class ship1 extends BitmapData {
public function ship1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 56
//ship1b (ship1b)
package {
import flash.display.*;
public dynamic class ship1b extends BitmapData {
public function ship1b(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 57
//ship2 (ship2)
package {
import flash.display.*;
public dynamic class ship2 extends BitmapData {
public function ship2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 58
//ship2b (ship2b)
package {
import flash.display.*;
public dynamic class ship2b extends BitmapData {
public function ship2b(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 59
//ship3 (ship3)
package {
import flash.display.*;
public dynamic class ship3 extends BitmapData {
public function ship3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 60
//ship3b (ship3b)
package {
import flash.display.*;
public dynamic class ship3b extends BitmapData {
public function ship3b(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 61
//ship4 (ship4)
package {
import flash.display.*;
public dynamic class ship4 extends BitmapData {
public function ship4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 62
//ship4b (ship4b)
package {
import flash.display.*;
public dynamic class ship4b extends BitmapData {
public function ship4b(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 63
//ship5 (ship5)
package {
import flash.display.*;
public dynamic class ship5 extends BitmapData {
public function ship5(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 64
//ship5b (ship5b)
package {
import flash.display.*;
public dynamic class ship5b extends BitmapData {
public function ship5b(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 65
//ship6 (ship6)
package {
import flash.display.*;
public dynamic class ship6 extends BitmapData {
public function ship6(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 66
//ship7 (ship7)
package {
import flash.display.*;
public dynamic class ship7 extends BitmapData {
public function ship7(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 67
//sound1 (sound1)
package {
import flash.media.*;
public dynamic class sound1 extends Sound {
}
}//package
Section 68
//sound3 (sound3)
package {
import flash.media.*;
public dynamic class sound3 extends Sound {
}
}//package
Section 69
//star1 (star1)
package {
import flash.display.*;
public dynamic class star1 extends BitmapData {
public function star1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 70
//star2 (star2)
package {
import flash.display.*;
public dynamic class star2 extends BitmapData {
public function star2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 71
//star3 (star3)
package {
import flash.display.*;
public dynamic class star3 extends BitmapData {
public function star3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 72
//tower1 (tower1)
package {
import flash.display.*;
public dynamic class tower1 extends BitmapData {
public function tower1(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 73
//tower1r (tower1r)
package {
import flash.display.*;
public dynamic class tower1r extends BitmapData {
public function tower1r(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 74
//tower2 (tower2)
package {
import flash.display.*;
public dynamic class tower2 extends BitmapData {
public function tower2(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 75
//tower2r (tower2r)
package {
import flash.display.*;
public dynamic class tower2r extends BitmapData {
public function tower2r(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 76
//tower3 (tower3)
package {
import flash.display.*;
public dynamic class tower3 extends BitmapData {
public function tower3(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 77
//tower3r (tower3r)
package {
import flash.display.*;
public dynamic class tower3r extends BitmapData {
public function tower3r(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 78
//tower4 (tower4)
package {
import flash.display.*;
public dynamic class tower4 extends BitmapData {
public function tower4(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 79
//tower4r (tower4r)
package {
import flash.display.*;
public dynamic class tower4r extends BitmapData {
public function tower4r(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package