[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Section 1 (2.49 KiB) ●
//CMG_Logo_Animation_4 (41reality_fla.CMG_Logo_Animation_4)
package 41reality_fla {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.geom.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class CMG_Logo_Animation_4 extends MovieClip {
public var CMG_MonkeyBlink:MovieClip;
public var CMG_HomePageLink:SimpleButton;
public var monkeyBlinkCheckTimer:Timer;
public var CMG_LoadingWidget:MovieClip;
public function CMG_Logo_Animation_4(){
addFrameScript(0, frame1, 80, frame81, 81, frame82);
}
public function goToUrl(_arg1:String):void{
var success:Boolean;
var url = _arg1;
success = false;
if (((ExternalInterface.available) && (!((Capabilities.playerType == "External"))))){
try {
ExternalInterface.call("window.open", url, "win", "");
success = true;
} catch(error:Error) {
} catch(error:SecurityError) {
};
};
if (success != true){
navigateToURL(new URLRequest(url), "_BLANK");
};
}
function frame81(){
stop();
monkeyBlinkCheckTimer.addEventListener(TimerEvent.TIMER, onMonkeyBlinkCheckTimer);
monkeyBlinkCheckTimer.start();
}
function frame82(){
monkeyBlinkCheckTimer.stop();
MovieClip(parent).play();
}
public function onMouseUpHandler_CMGHomePageBtn(_arg1:MouseEvent):void{
goToUrl("http://www.crazymonkeygames.com");
}
function frame1(){
MovieClip(parent).stop();
CMG_HomePageLink.addEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler_CMGHomePageBtn);
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler_CMGLoader);
monkeyBlinkCheckTimer = new Timer(800);
}
public function onEnterFrameHandler_CMGLoader(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
_local2 = CMG_HomePageLink.stage.loaderInfo.bytesLoaded;
_local3 = CMG_HomePageLink.stage.loaderInfo.bytesTotal;
CMG_LoadingWidget.CMG_LoadingBar.bar.scaleX = (_local2 / _local3);
if (_local2 == _local3){
CMG_LoadingWidget.nextFrame();
removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler_CMGLoader);
};
}
public function onMonkeyBlinkCheckTimer(_arg1:TimerEvent):void{
var _local2:Number;
_local2 = Math.random();
if (_local2 < 0.3){
CMG_MonkeyBlink.play();
};
}
}
}//package 41reality_fla
Section 2 (311 B)
//CMG_monkey_blink_22 (41reality_fla.CMG_monkey_blink_22)
package 41reality_fla {
import flash.display.*;
public dynamic class CMG_monkey_blink_22 extends MovieClip {
public function CMG_monkey_blink_22(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 3 (432 B)
//deployables_77 (41reality_fla.deployables_77)
package 41reality_fla {
import flash.display.*;
public dynamic class deployables_77 extends MovieClip {
public function deployables_77(){
addFrameScript(0, frame1, 2, frame3, 5, frame6, 6, frame7);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 4 (459 B)
//enternamepod_58 (41reality_fla.enternamepod_58)
package 41reality_fla {
import flash.display.*;
public dynamic class enternamepod_58 extends MovieClip {
public var l1:MovieClip;
public var l4:MovieClip;
public var l8:MovieClip;
public var l5:MovieClip;
public var l3:MovieClip;
public var l7:MovieClip;
public var l6:MovieClip;
public var l2:MovieClip;
public var l9:MovieClip;
public var l10:MovieClip;
}
}//package 41reality_fla
Section 5 (307 B)
//enternameselect_57 (41reality_fla.enternameselect_57)
package 41reality_fla {
import flash.display.*;
public dynamic class enternameselect_57 extends MovieClip {
public function enternameselect_57(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 6 (542 B)
//gameoverscore_26 (41reality_fla.gameoverscore_26)
package 41reality_fla {
import flash.display.*;
public dynamic class gameoverscore_26 extends MovieClip {
public var num10:MovieClip;
public var num11:MovieClip;
public var num12:MovieClip;
public var num1:MovieClip;
public var num3:MovieClip;
public var num6:MovieClip;
public var num7:MovieClip;
public var num4:MovieClip;
public var num5:MovieClip;
public var num2:MovieClip;
public var num8:MovieClip;
public var num9:MovieClip;
}
}//package 41reality_fla
Section 7 (311 B)
//gameoverselector_30 (41reality_fla.gameoverselector_30)
package 41reality_fla {
import flash.display.*;
public dynamic class gameoverselector_30 extends MovieClip {
public function gameoverselector_30(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 8 (287 B)
//gfxbutton_103 (41reality_fla.gfxbutton_103)
package 41reality_fla {
import flash.display.*;
public dynamic class gfxbutton_103 extends MovieClip {
public function gfxbutton_103(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 9 (275 B)
//letters_52 (41reality_fla.letters_52)
package 41reality_fla {
import flash.display.*;
public dynamic class letters_52 extends MovieClip {
public function letters_52(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 10 (326 B)
//lives_76 (41reality_fla.lives_76)
package 41reality_fla {
import flash.display.*;
public dynamic class lives_76 extends MovieClip {
public var num1:MovieClip;
public var num2:MovieClip;
public function lives_76(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 11 (210 B)
//load_barMC_15 (41reality_fla.load_barMC_15)
package 41reality_fla {
import flash.display.*;
public dynamic class load_barMC_15 extends MovieClip {
public var bar:MovieClip;
}
}//package 41reality_fla
Section 12 (121.13 KiB) ● ● ● ●
//MainTimeline (41reality_fla.MainTimeline)
package 41reality_fla {
import flash.display.*;
import flash.events.*;
import CMG_AS3.*;
import mochi.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.geom.*;
import flash.system.*;
import flash.external.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var transSwitch:Boolean;
public var badbullets:Array;
public var scores:SCORES;
public var powerNum:int;
public var track1:musicmenus;
public var track2:musicgame;
public var scoreLimit:int;
public var upowerup:usePowerup;
public var wave1:Array;
public var wave101:Array;
public var wave102:Array;
public var wave103:Array;
public var wave104:Array;
public var wave105:Array;
public var wave8:Array;
public var wave2:Array;
public var wave3:Array;
public var wave4:Array;
public var wave5:Array;
public var wave6:Array;
public var wave106:Array;
public var wave9:Array;
public var speed:int;
public var wave7:Array;
public var iexplode:invaderExplode;
public var hmissiles:Array;
public var ALILLM:alillmlink;
public var EN:enterName;
public var pausebg:pausedbg;
public var spikers:Array;
public var spinnerexplodes:Array;
public var pausetxt:pausedtxt;
public var launchers:Array;
public var kills:int;
public var GC:gamecomplete;
public var GO:gameover;
public var fps:FPS;
public var sexplode2:spinnerExplode2;
public var spawnTime:int;
public var hunters:Array;
public var titleStars:Array;
public var invaderQueueTime:int;
public var soundDir:int;
public var lives:int;
public var letters:Array;
public var sexplode:spikerExplode;
public var stageH:int;
public var invaders:Array;
public var playerName:Array;
public var invadersNum:int;
public var stageW:int;
public var sentanceNum:int;
public var soundSwitch:int;
public var gui:GUI;
public var gun:int;
public var nextPartTimer:int;
public var aexplode:asteroidExplode;
public var invaders2:Array;
public var spinners:Array;
public var titleSelect:int;
public var turrets:Array;
public var combo:int;
public var levelPart:int;
public var backing:BitmapData;
public var scoreCount:int;
public var tutorialbox:tutorial;
public var downKeys:Object;
public var tutorialText:Array;
public var shieldTime:int;
public var deployables:Array;
public var invaderTime;
public var stageRect:Rectangle;
public var waitingLetters:Array;
public var levelEnemies:int;
public var pdie:playerDie2;
public var powerups:Array;
public var homings:Array;
public var music:Boolean;
public var TITLE:titles;
public var ship:player;
public var pointer:mousep;
public var lrocket:launchRockets;
public var invaderQueue:Array;
public var comboTimer:int;
public var waiting:Boolean;
public var whiteCT:ColorTransform;
public var dspeed:int;
public var transFrom:String;
public var OPTIONS:options;
public var score:int;
public var savedata;
public var particles:Array;
public var letterTimer:int;
public var blueCol:int;
public var rdie:rocketDie;
public var wave10:Array;
public var wave11:Array;
public var wave12:Array;
public var wave13:Array;
public var wave14:Array;
public var wave15:Array;
public var wave16:Array;
public var wave18:Array;
public var wave19:Array;
public var flashTime:int;
public var wave17:Array;
public var multipliers:Array;
public var lexplode:launcherExplode;
public var wave20:Array;
public var wave22:Array;
public var wave23:Array;
public var wave24:Array;
public var wave25:Array;
public var wave26:Array;
public var wave27:Array;
public var wave28:Array;
public var wave29:Array;
public var currentLetter:int;
public var wave21:Array;
public var wave30:Array;
public var wave31:Array;
public var wave33:Array;
public var wave34:Array;
public var wave35:Array;
public var wave36:Array;
public var wave38:Array;
public var wave37:Array;
public var wave39:Array;
public var wave32:Array;
public var endTimer:int;
public var redCol:int;
public var wave40:Array;
public var wave41:Array;
public var wave42:Array;
public var wave43:Array;
public var wave44:Array;
public var wave45:Array;
public var wave46:Array;
public var wave47:Array;
public var wave48:Array;
public var wave49:Array;
public var powerList:Array;
public var backbmp:Bitmap;
public var backingCT:ColorTransform;
public var transTo:String;
public var wave50:Array;
public var wave51:Array;
public var wave52:Array;
public var wave53:Array;
public var wave54:Array;
public var wave55:Array;
public var wave56:Array;
public var wave57:Array;
public var wave59:Array;
public var asteroids:Array;
public var wave58:Array;
public var turn2:Number;
public var turn3:Number;
public var shield:Boolean;
public var wave60:Array;
public var turn1:Number;
public var hexplode:hunterExplode;
public var greenCol:int;
public var level:int;
public var shootTime:int;
public var bullets:Array;
public var gameState:String;
public var gameCT:ColorTransform;
public var ppowerup:pickupPowerup;
public var game:Sprite;
public var fadeSound:Boolean;
public var explosions:Array;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function mouseclick(_arg1:MouseEvent):void{
Mouse.hide();
if ((((gameState == "game")) || ((gameState == "tutorial")))){
if (gui.deploy.currentFrame == 3){
upowerup.play();
powerupExplode();
radialBlast();
gui.deploy.gotoAndStop(1);
} else {
if (gui.deploy.currentFrame == 6){
upowerup.play();
powerupExplode();
newTurret(ship.x, ship.y);
gui.deploy.gotoAndStop(1);
} else {
if (gui.deploy.currentFrame == 7){
upowerup.play();
powerupExplode();
ship.gotoAndPlay(131);
shield = true;
gui.deploy.gotoAndStop(1);
} else {
if (deployables.length > 0){
if (deployables[0].currentFrame == 3){
upowerup.play();
powerupExplode();
radialBlast();
gui.deploy.gotoAndStop(1);
} else {
if (deployables[0].currentFrame == 6){
upowerup.play();
powerupExplode();
newTurret(ship.x, ship.y);
gui.deploy.gotoAndStop(1);
} else {
if (deployables[0].currentFrame == 7){
upowerup.play();
powerupExplode();
ship.gotoAndPlay(131);
shield = true;
gui.deploy.gotoAndStop(1);
};
};
};
removeChild(deployables[0]);
deployables.splice(0, 1);
};
};
};
};
} else {
if (gameState == "enterName"){
if (titleSelect == 1){
gameState = "trans";
transTo = "title";
transFrom = "enterName";
savedata.data.Name = playerName;
savedata.flush();
};
} else {
if (gameState == "title"){
if (titleSelect == 1){
stageH = 520;
initGame();
gameState = "trans";
transTo = "game";
transFrom = "title";
} else {
if (titleSelect == 2){
stageH = 420;
initGame();
level = 100;
nextSentance();
addChild(tutorialbox);
tutorialbox.y = 420;
gameState = "trans";
transTo = "tutorial";
transFrom = "title";
} else {
if (titleSelect == 3){
gameState = "trans";
transTo = "options";
transFrom = "title";
};
};
};
} else {
if (gameState == "options"){
if (titleSelect == 1){
gameState = "trans";
transTo = "enterName";
transFrom = "options";
} else {
if (titleSelect == 2){
savedata.data.HS = 0;
savedata.flush();
gameState = "trans";
transTo = "title";
transFrom = "options";
} else {
if (titleSelect == 3){
if (OPTIONS.option3.currentFrame == 1){
music = false;
SoundMixer.stopAll();
OPTIONS.option3.gotoAndStop(2);
} else {
music = true;
track1.play(0, 999);
OPTIONS.option3.gotoAndStop(1);
};
} else {
if (titleSelect == 4){
if (OPTIONS.option4.currentFrame == 1){
stage.quality = StageQuality.HIGH;
OPTIONS.option4.gotoAndStop(2);
} else {
stage.quality = StageQuality.LOW;
OPTIONS.option4.gotoAndStop(1);
};
} else {
if (titleSelect == 5){
gameState = "trans";
transTo = "title";
transFrom = "options";
titleSelect = 1;
};
};
};
};
};
} else {
if (gameState == "paused"){
gameState = "game";
removeChild(pausebg);
removeChild(pausetxt);
} else {
if (gameState == "paused2"){
gameState = "tutorial";
removeChild(pausebg);
removeChild(pausetxt);
} else {
if (gameState == "gameOver"){
if (titleSelect == 2){
gameState = "trans";
transTo = "title";
transFrom = "gameOver";
};
} else {
if (gameState == "gameComplete"){
if (titleSelect == 2){
gameState = "trans";
transTo = "title";
transFrom = "gameComplete";
};
};
};
};
};
};
};
};
};
}
public function getNearest(_arg1:int, _arg2:int){
var _local3:int;
var _local4:*;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
_local3 = 9999999;
_local4 = 0;
_local5 = 0;
_local5 = 0;
while (_local5 < asteroids.length) {
_local6 = (asteroids[_local5].x - _arg1);
_local7 = (asteroids[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = asteroids[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < hunters.length) {
_local6 = (hunters[_local5].x - _arg1);
_local7 = (hunters[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = hunters[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < invaders.length) {
_local6 = (invaders[_local5].x - _arg1);
_local7 = (invaders[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = invaders[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < invaders2.length) {
_local6 = (invaders2[_local5].x - _arg1);
_local7 = (invaders2[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = invaders2[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < spinners.length) {
_local6 = (spinners[_local5].x - _arg1);
_local7 = (spinners[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = spinners[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < spikers.length) {
_local6 = (spikers[_local5].x - _arg1);
_local7 = (spikers[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = spikers[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < launchers.length) {
_local6 = (launchers[_local5].x - _arg1);
_local7 = (launchers[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = launchers[_local5];
};
_local5++;
};
_local5 = 0;
while (_local5 < hmissiles.length) {
_local6 = (hmissiles[_local5].x - _arg1);
_local7 = (hmissiles[_local5].y - _arg2);
_local8 = ((_local6 * _local6) + (_local7 * _local7));
if (_local8 < _local3){
_local3 = _local8;
_local4 = hmissiles[_local5];
};
_local5++;
};
return (_local4);
}
public function soundFade():void{
if (soundDir == 0){
SoundMixer.soundTransform = new SoundTransform((SoundMixer.soundTransform.volume - 0.02), 0);
if (SoundMixer.soundTransform.volume <= 0){
SoundMixer.soundTransform = new SoundTransform(0, 0);
soundDir = 1;
SoundMixer.stopAll();
if (soundSwitch == 0){
if (music == true){
track2.play(0, 999);
};
} else {
if (music == true){
track1.play(0, 999);
};
};
};
} else {
SoundMixer.soundTransform = new SoundTransform((SoundMixer.soundTransform.volume + 0.02), 0);
if (SoundMixer.soundTransform.volume >= 1){
SoundMixer.soundTransform = new SoundTransform(1, 0);
soundDir = 0;
fadeSound = false;
};
};
}
public function checkHitPlayer(_arg1:int, _arg2:int, _arg3:int):Boolean{
var _local4:int;
var _local5:int;
var _local6:int;
if ((((spawnTime == 0)) && ((shield == false)))){
_local4 = (ship.x - _arg1);
_local5 = (ship.y - _arg2);
_local6 = ((_local4 * _local4) + (_local5 * _local5));
if (_local6 <= ((_arg3 + 2) * (_arg3 + 2))){
return (true);
};
};
return (false);
}
function frame3(){
letters = [" ", " ", " ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
powerList = [7, 1, 3, 2, 4, 6, 1, 3, 2, 7, 4, 3, 2, 5, 1, 3];
wave101 = [[0]];
wave102 = [[100], [2, 0]];
wave103 = [[100], [2, 0]];
wave104 = [[100], [3, 0]];
wave105 = [[150], [4, 4, 4, 0]];
wave106 = [[0]];
wave1 = [[3, 200], [3, 3, 0]];
wave2 = [[3, 3, 3, 400], [1, 1, 1, 1, 1, 1, 0]];
wave3 = [[4, 4, 4, 100], [2, 2, 0]];
wave4 = [[4, 4, 60], [4, 4, 4, 60], [4, 4, 4, 4, 0]];
wave5 = [[2, 2, 100], [5, 0]];
wave6 = [[2, 2, 5, 100], [2, 2, 100], [2, 2, 0]];
wave7 = [[5, 5, 100], [4, 4, 4, 80], [4, 4, 4, 0]];
wave8 = [[3, 4, 4, 100], [3, 3, 3, 3, 0]];
wave9 = [[4, 30], [4, 30], [4, 30], [4, 30], [4, 30], [4, 30], [4, 30], [4, 30], [4, 30], [4, 0]];
wave10 = [[5, 5, 5, 200], [4, 3, 100], [4, 20], [4, 20], [4, 100], [4, 3, 20]];
wave11 = [[1, 1, 1, 1, 1, 100], [1, 1, 1, 1, 1, 0]];
wave12 = [[5, 5, 6, 0]];
wave13 = [[4, 4, 4, 4, 4, 200], [5, 6, 6, 0]];
wave14 = [[6, 6, 3, 3, 400], [2, 2, 2, 0]];
wave15 = [[4, 4, 50], [4, 4, 50], [4, 4, 50], [4, 4, 50], [4, 4, 0]];
wave16 = [[3, 3, 3, 3]];
wave17 = [[3, 3, 3, 4, 30], [4, 4, 50], [4, 4, 50], [4, 4, 0]];
wave18 = [[6, 3, 100], [6, 1, 1, 1, 100], [6, 4, 4, 4, 0]];
wave19 = [[1, 4, 30], [1, 4, 30], [1, 4, 30], [1, 4, 30], [1, 4, 30], [1, 4, 0]];
wave20 = [[5, 6, 5, 6, 5, 6]];
wave21 = [[9, 0]];
wave22 = [[4, 4, 4, 100], [4, 4, 4, 100], [4, 4, 4, 100], [4, 4, 4, 0]];
wave23 = [[5, 6, 6, 2, 300], [2, 2, 2]];
wave24 = [[9, 100], [4, 20], [4, 20], [4, 20], [4, 20], [4, 20], [4, 20], [4, 20], [4, 0]];
wave25 = [[6, 300], [2, 100], [6, 300], [3, 0]];
wave26 = [[9, 9, 3]];
wave27 = [[3, 3, 2, 400], [5, 5, 6, 100], [2, 2, 1, 0]];
wave28 = [[1, 40], [1, 40], [1, 40], [9, 20], [1, 40], [1, 40], [1, 40], [1, 40], [1, 40], [1, 40], [1, 40], [1, 0]];
wave29 = [[6, 6, 6, 6, 300], [9, 0]];
wave30 = [[5, 6, 3, 2, 1, 4, 4, 4, 0]];
wave31 = [[7, 2, 2, 0]];
wave32 = [[9, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 0]];
wave33 = [[7, 7, 0]];
wave34 = [[6, 6, 6, 6, 9, 0]];
wave35 = [[9, 7, 7, 0]];
wave36 = [[3, 2, 1, 4, 4, 30], [4, 4, 1, 30], [4, 4, 1, 50], [4, 4, 1, 0]];
wave37 = [[5, 5, 5, 100], [6, 6, 6, 100], [3, 3, 3, 0]];
wave38 = [[7, 7, 7, 0]];
wave39 = [[7, 7, 2, 2, 50], [2, 2, 0]];
wave40 = [[9, 9, 9, 0]];
wave41 = [[8, 0]];
wave42 = [[4, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 20], [4, 4, 0]];
wave43 = [[3, 3, 7, 7, 0]];
wave44 = [[8, 8, 0]];
wave45 = [[5, 6, 6, 7, 50], [4, 4, 30], [4, 4, 30], [4, 4, 0]];
wave46 = [[7, 8, 2, 0]];
wave47 = [[7, 3, 2, 1, 40], [1, 1, 1, 30], [1, 1, 1, 0]];
wave48 = [[1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 10], [1, 1, 1, 0]];
wave49 = [[8, 8, 2, 50], [2, 2, 0]];
wave50 = [[8, 8, 6, 6, 0]];
wave51 = [[3, 3, 3, 4, 4, 4, 20], [4, 4, 4, 20], [4, 4, 4, 20], [4, 4, 4, 20], [4, 4, 4, 20], [4, 4, 4, 0]];
wave52 = [[7, 7, 7, 3, 3, 0]];
wave53 = [[8, 8, 8, 0]];
wave54 = [[6, 6, 7, 7, 7, 0]];
wave55 = [[1, 1, 1, 1, 10], [1, 1, 1, 1, 10], [1, 1, 1, 1, 10], [1, 1, 1, 1, 10], [1, 1, 1, 1, 10], [1, 1, 1, 1, 0]];
wave56 = [[8, 8, 9, 0]];
wave57 = [[9, 9, 9, 6, 6, 6, 0]];
wave58 = [[3, 2, 1, 9, 9, 0]];
wave59 = [[4, 4, 4, 4, 30], [4, 4, 4, 4, 30], [4, 4, 4, 4, 30], [4, 4, 4, 4, 30], [4, 4, 4, 4, 0]];
wave60 = [[8, 8, 9, 9, 0]];
tutorialText = ["Welcome to 41st reality's training mode. Use the WASD or Arrow keys to move your ship. Your gun fires automatically, use the mouse to aim.", "Here is a basic enemy, take it out and try to avoid being hit. You have infinite lives in training mode", "This next enemy will drop a powerup when you destroy it. Some powerups like this gun upgrade will activate automaticaly when you pick them up.", "Other powerups like the bomb powerup which this enemy will drop are activated manualy. Once you have collected the powerup, press the left mouse button to use it.", "Points are scored when an enemy is destroyed. Taking out multiple enemies in quick succession will create combos which will boost your score", "You have reached the end of training mode. You are now ready to play. Good luck!"];
sentanceNum = -1;
waitingLetters = new Array();
waiting = false;
letterTimer = 2;
Mouse.hide();
stage.quality = StageQuality.LOW;
SoundMixer.soundTransform = new SoundTransform(0, 0);
stageW = 520;
stageH = 520;
fps = new FPS(10);
music = true;
savedata = SharedObject.getLocal("41reality");
SoundMixer.soundTransform = new SoundTransform(1, 0);
track1 = new musicmenus();
track2 = new musicgame();
aexplode = new asteroidExplode();
hexplode = new hunterExplode();
iexplode = new invaderExplode();
lrocket = new launchRockets();
lexplode = new launcherExplode();
sexplode = new spikerExplode();
sexplode2 = new spinnerExplode2();
ppowerup = new pickupPowerup();
upowerup = new usePowerup();
pdie = new playerDie2();
rdie = new rocketDie();
stageRect = new Rectangle(0, 0, stageW, stageH);
backingCT = new ColorTransform(1, 1, 1, 0.7, 0, 0, 0, 0);
gameCT = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
whiteCT = new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, 0);
downKeys = new Object();
redCol = 0;
greenCol = 0;
blueCol = 0;
pointer = new mousep();
ship = new player();
gui = new GUI();
ALILLM = new alillmlink();
EN = new enterName();
TITLE = new titles();
OPTIONS = new options();
GO = new gameover();
GC = new gamecomplete();
pausebg = new pausedbg();
pausetxt = new pausedtxt();
tutorialbox = new tutorial();
scores = new SCORES();
speed = 4;
dspeed = 3;
level = 1;
levelPart = -1;
nextPartTimer = 0;
levelEnemies = 0;
fadeSound = false;
soundDir = 0;
soundSwitch = 0;
kills = 0;
scoreLimit = 200000;
scoreCount = 0;
powerNum = 0;
shootTime = 3;
invaderTime = 15;
invadersNum = 0;
score = 0;
combo = 1;
lives = 3;
spawnTime = 130;
shield = false;
shieldTime = 600;
comboTimer = 0;
gun = 1;
endTimer = 120;
bullets = new Array();
badbullets = new Array();
homings = new Array();
hmissiles = new Array();
explosions = new Array();
multipliers = new Array();
powerups = new Array();
deployables = new Array();
turrets = new Array();
asteroids = new Array();
invaders = new Array();
invaders2 = new Array();
hunters = new Array();
launchers = new Array();
spinners = new Array();
spikers = new Array();
particles = new Array();
spinnerexplodes = new Array();
titleStars = new Array();
invaderQueue = new Array();
invaderQueueTime = 15;
turn1 = 25;
turn2 = 25;
turn3 = 25;
flashTime = 0;
playerName = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
currentLetter = 1;
titleSelect = 1;
gameState = "none";
transFrom = "";
transTo = "";
transSwitch = false;
ScoreSubmitter.gameId = 388;
ScoreSubmitter.gameVersion = "1.0";
ScoreSubmitter.gameValidationCode = "41st201f01bf73c8f6c1c4802e0e43ba5f0f";
init();
stage.addEventListener(Event.ENTER_FRAME, update);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keysDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keysUp);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseclick);
stage.addEventListener(MouseEvent.MOUSE_UP, mouserelease);
stage.showDefaultContextMenu = false;
stop();
}
public function newSpinner():void{
var _local1:spinner;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Number;
_local1 = new spinner();
_local1.rotation = (Math.random() * 360);
game.addChild(_local1);
spinners.push(_local1);
_local2 = ((Math.random() * 360) * (Math.PI / 180));
_local1.x = ((stageW / 2) + (Math.cos(_local2) * stageW));
_local1.y = ((stageH / 2) + (Math.sin(_local2) * stageH));
_local3 = ((Math.random() * (stageW - 40)) + 20);
_local4 = ((Math.random() * (stageH - 40)) + 20);
_local5 = (_local3 - _local1.x);
_local6 = (_local4 - _local1.y);
_local7 = Math.atan2(_local6, _local5);
_local1.xv = (Math.cos(_local7) * 2);
_local1.yv = (Math.sin(_local7) * 2);
_local1.x = (_local1.x + (_local1.xv * 3));
_local1.y = (_local1.y + (_local1.yv * 3));
_local1.score = 36482;
_local1.hit = false;
_local1.hitTime = 5;
_local1.health = 25;
_local1.shootTime = 15;
_local1.out = true;
}
function frame1(){
stop();
stage.showDefaultContextMenu = false;
stage.frameRate = 30;
}
function frame2(){
SoundMixer.stopAll();
stage.frameRate = 65;
SoundMixer.soundTransform = new SoundTransform(0, 0);
}
public function newBomb(_arg1:int, _arg2:int):void{
var _local3:bomb;
_local3 = new bomb();
_local3.x = _arg1;
_local3.y = (_arg2 + 15);
_local3.t = "bomb";
_local3.dead = false;
game.addChild(_local3);
badbullets.push(_local3);
}
public function updateAsteroids():void{
var _local1:int;
var _local2:asteroid;
_local1 = 0;
while (_local1 < asteroids.length) {
_local2 = asteroids[_local1];
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local2.transform.colorTransform = gameCT;
_local2.rotation = (_local2.rotation + 2);
if (_local2.out == true){
if ((((((((_local2.x > 0)) && ((_local2.x < stageW)))) && ((_local2.y > 0)))) && ((_local2.y < stageH)))){
_local2.out = false;
};
} else {
if ((((_local2.x < 0)) || ((_local2.x > stageW)))){
_local2.xv = (_local2.xv * -1);
};
if ((((_local2.y < 0)) || ((_local2.y > stageH)))){
_local2.yv = (_local2.yv * -1);
};
};
if (checkHitPlayer(_local2.x, _local2.y, (_local2.s * 15)) == true){
playerDie();
};
if (checkCollision(_local2.x, _local2.y, (_local2.s * 15)) >= 1){
levelEnemies--;
aexplode.play();
if (_local2.s > 1){
levelEnemies = (levelEnemies + 2);
newAsteroid((_local2.s - 1), _local2.x, _local2.y);
newAsteroid((_local2.s - 1), _local2.x, _local2.y);
};
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion1(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 25;
updateScore((_local2.score * combo));
game.removeChild(_local2);
asteroids.splice(_local1, 1);
};
_local1++;
};
}
public function newPowerup(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:powerup;
var _local5:powerup;
var _local6:powerup;
if (gameState == "game"){
kills++;
scoreCount = (scoreCount + _arg3);
if (scoreCount >= (scoreLimit * ((combo + 2) / 2))){
scoreCount = 0;
_local4 = new powerup();
_local4.x = _arg1;
_local4.y = _arg2;
_local4.gotoAndStop(powerList[powerNum]);
_local4.num = powerList[powerNum];
powerNum++;
if (powerNum >= powerList.length){
powerNum = 0;
};
_local4.timer = 400;
_local4.rTime = 30;
_local4.sTime = 40;
_local4.cTime = -1;
_local4.xv = 0;
_local4.yv = 0;
game.addChild(_local4);
powerups.push(_local4);
};
} else {
if (gameState == "tutorial"){
if (asteroids.length == 1){
if (level == 103){
_local5 = new powerup();
_local5.x = _arg1;
_local5.y = _arg2;
_local5.gotoAndStop(1);
_local5.num = 1;
_local5.timer = 9999999;
_local5.rTime = 30;
_local5.sTime = 40;
_local5.cTime = -1;
_local5.xv = 0;
_local5.yv = 0;
game.addChild(_local5);
powerups.push(_local5);
} else {
if (level == 104){
_local6 = new powerup();
_local6.x = _arg1;
_local6.y = _arg2;
_local6.gotoAndStop(3);
_local6.num = 3;
_local6.timer = 9999999;
_local6.rTime = 30;
_local6.sTime = 40;
_local6.cTime = -1;
_local6.xv = 0;
_local6.yv = 0;
game.addChild(_local6);
powerups.push(_local6);
};
};
};
};
};
}
public function updateTurrets():void{
var _local1:int;
var _local2:turret;
var _local3:*;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:int;
var _local8:int;
var _local9:int;
_local1 = 0;
while (_local1 < turrets.length) {
_local2 = turrets[_local1];
_local2.transform.colorTransform = gameCT;
_local3 = getNearest(_local2.x, _local2.y);
if (_local3 != 0){
_local4 = (_local3.x - _local2.x);
_local5 = (_local3.y - _local2.y);
_local6 = Math.atan2(_local5, _local4);
_local7 = (_local6 * (180 / Math.PI));
_local8 = _local2.rotation;
if (_local7 < 0){
_local7 = (_local7 + 360);
} else {
if (_local7 > 360){
_local7 = (_local7 - 360);
};
};
if (_local8 < 0){
_local8 = (_local8 + 360);
} else {
if (_local8 > 360){
_local8 = (_local8 - 360);
};
};
_local9 = (_local8 - _local7);
if ((((((_local9 > 0)) && ((_local9 <= 180)))) || ((_local9 < -180)))){
_local2.rotation = (_local2.rotation - 4);
} else {
if ((((((_local9 < 0)) && ((_local9 >= -180)))) || ((_local9 > 180)))){
_local2.rotation = (_local2.rotation + 4);
};
};
if (Math.abs(_local9) < 10){
_local2.sTime--;
if (_local2.sTime <= 0){
turretGun(_local2.x, _local2.y, _local2.rotation);
_local2.sTime = 3;
};
};
};
_local2.life--;
if (_local2.life <= 0){
_local2.scaleX = (_local2.scaleX - 0.02);
_local2.scaleY = (_local2.scaleY - 0.02);
if (_local2.scaleX <= 0){
game.removeChild(_local2);
turrets.splice(_local1, 1);
_local1--;
};
};
_local1++;
};
}
public function keysDown(_arg1:KeyboardEvent):void{
downKeys[("key" + _arg1.keyCode)] = true;
if (gameState == "enterName"){
if ((((_arg1.keyCode >= 65)) && ((_arg1.keyCode <= 90)))){
if (currentLetter <= 10){
EN.pod[("l" + currentLetter)].gotoAndStop((_arg1.keyCode - 62));
playerName[(currentLetter - 1)] = (_arg1.keyCode - 63);
currentLetter++;
};
};
if (_arg1.keyCode == 8){
if (currentLetter >= 2){
EN.pod[("l" + (currentLetter - 1))].gotoAndStop(1);
if (currentLetter <= 10){
EN.pod[("l" + currentLetter)].gotoAndStop(1);
};
playerName[(currentLetter - 1)] = 0;
currentLetter--;
};
};
if (_arg1.keyCode == 32){
if (currentLetter <= 9){
EN.pod[("l" + currentLetter)].gotoAndStop(1);
playerName[(currentLetter - 1)] = 1;
currentLetter++;
};
};
} else {
if (gameState == "game"){
if (_arg1.keyCode == 80){
gameState = "paused";
addChild(pausebg);
pausebg.x = (stageW / 2);
pausebg.y = (stageH / 2);
addChild(pausetxt);
pausetxt.x = (stageW / 2);
pausetxt.y = (stageH / 2);
};
} else {
if (gameState == "tutorial"){
if (_arg1.keyCode == 80){
gameState = "paused2";
addChild(pausebg);
pausebg.x = (stageW / 2);
pausebg.y = ((stageH + 100) / 2);
addChild(pausetxt);
pausetxt.x = (stageW / 2);
pausetxt.y = ((stageH + 100) / 2);
} else {
if (_arg1.keyCode == 32){
if (waiting == true){
nextSentance();
} else {
skipWriting();
};
};
};
} else {
if (gameState == "paused"){
if (_arg1.keyCode == 80){
gameState = "game";
removeChild(pausebg);
removeChild(pausetxt);
};
} else {
if (gameState == "paused2"){
if (_arg1.keyCode == 80){
gameState = "tutorial";
removeChild(pausebg);
removeChild(pausetxt);
};
};
};
};
};
};
}
public function update(_arg1:Event):void{
var _local2:int;
var _local3:String;
var _local4:*;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:String;
var _local9:*;
var _local10:int;
var _local11:int;
if (gameState == "game"){
runLevel();
updatePlayer();
updateGUI();
updateAsteroids();
updateInvaders();
updateInvaders2();
updateInvaderQueue();
updateHunters();
updateLaunchers();
updateSpinners();
updateSpikers();
updateExplosions();
updateMultipliers();
updatePowerups();
updateDeployables();
updateParticles();
updateTurrets();
updateSpinnerexplodes();
fire();
updateBullets();
updateHomings();
updateHmissiles();
updateBadbullets();
} else {
if (gameState == "enterName"){
updateEnterName();
updateTitleStars();
} else {
if (gameState == "title"){
updateTitle();
updateTitleStars();
} else {
if (gameState == "options"){
updateOptions();
updateTitleStars();
} else {
if (gameState == "trans"){
trans();
updateTitleStars();
} else {
if ((((gameState == "paused")) || ((gameState == "paused2")))){
pausetxt.transform.colorTransform = gameCT;
} else {
if (gameState == "gameOver"){
updateGO();
updateTitleStars();
} else {
if (gameState == "gameComplete"){
updateGC();
updateTitleStars();
} else {
if (gameState == "hscores"){
updateSCORES();
updateTitleStars();
} else {
if (gameState == "tutorial"){
updateTutorial();
updatePlayer();
updateGUI();
updateAsteroids();
updateInvaders();
updateInvaders2();
updateInvaderQueue();
updateHunters();
updateLaunchers();
updateSpinners();
updateSpikers();
updateExplosions();
updateMultipliers();
updatePowerups();
updateDeployables();
updateParticles();
updateTurrets();
updateSpinnerexplodes();
fire();
updateBullets();
updateHomings();
updateHmissiles();
updateBadbullets();
} else {
if (gameState == "endGame"){
endTimer--;
updateGUI();
updateAsteroids();
updateInvaders();
updateInvaders2();
updateInvaderQueue();
updateHunters();
updateLaunchers();
updateSpinners();
updateSpikers();
updateExplosions();
updateMultipliers();
updatePowerups();
updateDeployables();
updateParticles();
updateSpinnerexplodes();
updateBullets();
updateHomings();
updateHmissiles();
updateBadbullets();
if (endTimer <= 0){
endTimer = 120;
gameState = "trans";
transFrom = "game";
transTo = "gameOver";
pointer.gotoAndStop(1);
endGame();
if ((((savedata.data.HS == undefined)) || ((score > savedata.data.HS)))){
savedata.data.HS = score;
savedata.flush();
};
_local2 = 0;
while (_local2 < 15) {
newTitleStar();
_local2++;
};
_local3 = String(score);
_local4 = (12 - _local3.length);
_local5 = 1;
while (_local5 < 13) {
_local6 = Number(_local3.charAt(((_local5 - _local4) - 1)));
if ((((_local5 >= (_local4 + 1))) && (!((score == 0))))){
GO.score[("num" + _local5)].gotoAndStop((_local6 + 2));
} else {
GO.score[("num" + _local5)].gotoAndStop(1);
};
_local5++;
};
};
} else {
if (gameState == "endGame2"){
endTimer--;
updateGUI();
updateAsteroids();
updateInvaders();
updateInvaders2();
updateInvaderQueue();
updateHunters();
updateLaunchers();
updateSpinners();
updateSpikers();
updateExplosions();
updateMultipliers();
updatePowerups();
updateDeployables();
updateParticles();
updateSpinnerexplodes();
updateBullets();
updateHomings();
updateHmissiles();
updateBadbullets();
if (endTimer <= 0){
endTimer = 120;
gameState = "trans";
transFrom = "game";
transTo = "gameComplete";
pointer.gotoAndStop(1);
endGame();
if ((((savedata.data.HS == undefined)) || ((score > savedata.data.HS)))){
savedata.data.HS = score;
savedata.flush();
};
_local7 = 0;
while (_local7 < 15) {
newTitleStar();
_local7++;
};
_local8 = String(score);
_local9 = (12 - _local8.length);
_local10 = 1;
while (_local10 < 13) {
_local11 = Number(_local8.charAt(((_local10 - _local9) - 1)));
if ((((_local10 >= (_local9 + 1))) && (!((score == 0))))){
GC.score[("num" + _local10)].gotoAndStop((_local11 + 2));
} else {
GC.score[("num" + _local10)].gotoAndStop(1);
};
_local10++;
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (fadeSound == true){
soundFade();
};
backing.colorTransform(stageRect, backingCT);
backing.draw(game);
blendColor();
updateMouse();
fps.calculate();
trace(gameState);
}
public function updateSpinnerexplodes():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < spinnerexplodes.length) {
_local2 = spinnerexplodes[_local1];
_local2.rotation = (_local2.rotation + 3);
if (_local2.width < 1500){
_local2.scaleX = (_local2.scaleX * 1.1);
_local2.scaleY = (_local2.scaleY * 1.1);
_local2.transform.colorTransform = gameCT;
} else {
_local2.alpha = (_local2.alpha - 0.01);
if (_local2.alpha <= 0){
game.removeChild(_local2);
spinnerexplodes.splice(_local1, 1);
_local1--;
};
};
_local1++;
};
}
public function checkLineHit(_arg1:int, _arg2:int, _arg3:Number, _arg4:Number, _arg5:int):Boolean{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
_local6 = 0;
while (_local6 < _arg5) {
_local7 = (ship.x - _arg1);
_local8 = (ship.y - _arg2);
_local9 = ((_local7 * _local7) + (_local8 * _local8));
if (_local9 <= 36){
return (true);
};
_arg1 = (_arg1 + _arg3);
_arg2 = (_arg2 + _arg4);
_local6++;
};
return (false);
}
public function goToUrl(_arg1:String):void{
var success:Boolean;
var url = _arg1;
success = false;
if (((ExternalInterface.available) && (!((Capabilities.playerType == "External"))))){
try {
ExternalInterface.call("window.open", url, "win", "");
success = true;
} catch(error:Error) {
} catch(error:SecurityError) {
};
};
if (success != true){
navigateToURL(new URLRequest(url), "_BLANK");
};
}
public function nextSentance():void{
var _local1:int;
var _local2:int;
if (sentanceNum < (tutorialText.length - 1)){
gui.lives.gotoAndStop(2);
sentanceNum++;
level++;
waiting = false;
levelPart = -1;
tutorialbox.tuttext.txt.text = "";
tutorialbox.tuttext.pressspace.y = 200;
_local1 = 0;
while (_local1 < tutorialText[sentanceNum].length) {
waitingLetters[_local1] = tutorialText[sentanceNum].charAt(_local1);
_local1++;
};
} else {
removeChild(tutorialbox);
stageH = 520;
gui.lives.gotoAndStop(1);
endGame();
_local2 = 0;
while (_local2 < 15) {
newTitleStar();
_local2++;
};
gameState = "trans";
transTo = "title";
transFrom = "tutorial";
};
}
public function init():void{
var _local1:int;
game = new Sprite();
backing = new BitmapData(stageW, stageH, true, 0);
backbmp = new Bitmap(backing);
score = 0;
lives = 3;
track1.play(0, 999);
addChild(backbmp);
addChild(game);
MochiServices.connect("8b91a91838bc1094", this);
downKeys = new Object();
chooseNextColors();
gameCT.redOffset = redCol;
gameCT.greenOffset = greenCol;
gameCT.blueOffset = blueCol;
game.transform.colorTransform = gameCT;
game.addChild(ALILLM);
ALILLM.x = ((stageW / 2) + 5);
ALILLM.y = (((stageH + 30) / 2) - 10);
ALILLM.gotoAndPlay(1);
gameState = "trans";
transFrom = "logo";
if (savedata.data.Name == undefined){
transTo = "enterName";
} else {
transTo = "title";
};
_local1 = 0;
while (_local1 < 15) {
newTitleStar();
_local1++;
};
game.addChild(pointer);
game.addEventListener(Event.ADDED, alwaysOnTop);
}
public function updateHomings():void{
var _local1:int;
var _local2:homing;
var _local3:*;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Number;
_local1 = 0;
while (_local1 < homings.length) {
_local2 = homings[_local1];
_local2.transform.colorTransform = gameCT;
_local3 = getNearest(_local2.x, _local2.y);
if (_local3 != 0){
_local4 = (_local3.x - _local2.x);
_local5 = (_local3.y - _local2.y);
_local6 = Math.atan2(_local5, _local4);
_local7 = (_local6 * (180 / Math.PI));
_local8 = _local2.rotation;
if (_local7 < 0){
_local7 = (_local7 + 360);
} else {
if (_local7 > 360){
_local7 = (_local7 - 360);
};
};
if (_local8 < 0){
_local8 = (_local8 + 360);
} else {
if (_local8 > 360){
_local8 = (_local8 - 360);
};
};
_local9 = (_local8 - _local7);
if ((((((_local9 > 0)) && ((_local9 <= 180)))) || ((_local9 < -180)))){
_local2.rotation = (_local2.rotation - 3);
} else {
if ((((((_local9 < 0)) && ((_local9 >= -180)))) || ((_local9 > 180)))){
_local2.rotation = (_local2.rotation + 3);
};
};
_local10 = (_local2.rotation * (Math.PI / 180));
_local2.xv = (Math.cos(_local10) * 7);
_local2.yv = (Math.sin(_local10) * 7);
};
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
if ((((((((_local2.x >= stageW)) || ((_local2.x <= 0)))) || ((_local2.y <= 0)))) || ((_local2.y >= stageH)))){
game.removeChild(_local2);
homings.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function initGame():void{
var _local1:int;
fadeSound = true;
soundSwitch = 0;
score = 0;
resetScore();
lives = 3;
level = 1;
levelPart = -1;
nextPartTimer = 0;
levelEnemies = 0;
gun = 1;
game.addChild(ship);
ship.gotoAndPlay(1);
ship.x = (stageW / 2);
ship.y = (stageH / 2);
kills = 0;
powerNum = 0;
gui.y = 520;
addChild(gui);
gui.lives.gotoAndStop(1);
bullets = new Array();
badbullets = new Array();
homings = new Array();
hmissiles = new Array();
explosions = new Array();
multipliers = new Array();
powerups = new Array();
deployables = new Array();
turrets = new Array();
asteroids = new Array();
invaders = new Array();
invaders2 = new Array();
hunters = new Array();
launchers = new Array();
spinners = new Array();
spikers = new Array();
particles = new Array();
spinnerexplodes = new Array();
_local1 = 0;
while (_local1 < titleStars.length) {
removeChild(titleStars[_local1]);
_local1++;
};
titleStars = new Array();
invaderQueue = new Array();
updateLives();
pointer.gotoAndStop(2);
}
public function updateInvaders():void{
var _local1:int;
var _local2:*;
var _local3:int;
_local1 = 0;
while (_local1 < invaders.length) {
_local2 = invaders[_local1];
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
if ((((_local2.x > (stageW - 15))) || ((((_local2.x < 15)) && ((_local2.yv == 3)))))){
_local2.ying = true;
_local2.yv = 3;
};
if (_local2.ying == true){
_local2.y = (_local2.y + _local2.yv);
_local2.ytime--;
if (_local2.ytime == 0){
_local2.ying = false;
_local2.ytime = 15;
_local2.xv = (_local2.xv * -1);
_local2.x = (_local2.x + _local2.xv);
};
} else {
_local2.x = (_local2.x + _local2.xv);
};
if (checkHitPlayer(_local2.x, _local2.y, 15) == true){
playerDie();
};
if (_local2.y > (stageH + 20)){
levelEnemies--;
game.removeChild(_local2);
invaders.splice(_local1, 1);
_local1--;
} else {
_local3 = checkCollision(_local2.x, _local2.y, 15);
if (_local3 > 0){
_local2.health = (_local2.health - _local3);
_local2.hit = true;
if (_local2.health < 0){
levelEnemies--;
iexplode.play();
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion3(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 60;
updateScore((_local2.score * combo));
game.removeChild(_local2);
invaders.splice(_local1, 1);
_local1--;
};
};
};
_local1++;
};
}
public function updatePlayer():void{
ship.transform.colorTransform = gameCT;
if (spawnTime > 0){
spawnTime--;
};
if (shield == true){
ship.rotation = (ship.rotation + 2);
shieldTime--;
if (shieldTime <= 0){
shieldTime = 600;
shield = false;
ship.play();
};
};
if (spawnTime < 80){
if ((((((downKeys.key37 == true)) && ((downKeys.key38 == true)))) || ((((downKeys.key65 == true)) && ((downKeys.key87 == true)))))){
ship.x = (ship.x - dspeed);
ship.y = (ship.y - dspeed);
} else {
if ((((((downKeys.key37 == true)) && ((downKeys.key40 == true)))) || ((((downKeys.key65 == true)) && ((downKeys.key83 == true)))))){
ship.x = (ship.x - dspeed);
ship.y = (ship.y + dspeed);
} else {
if ((((((downKeys.key39 == true)) && ((downKeys.key38 == true)))) || ((((downKeys.key68 == true)) && ((downKeys.key87 == true)))))){
ship.x = (ship.x + dspeed);
ship.y = (ship.y - dspeed);
} else {
if ((((((downKeys.key39 == true)) && ((downKeys.key40 == true)))) || ((((downKeys.key68 == true)) && ((downKeys.key83 == true)))))){
ship.x = (ship.x + dspeed);
ship.y = (ship.y + dspeed);
} else {
if ((((downKeys.key37 == true)) || ((downKeys.key65 == true)))){
ship.x = (ship.x - speed);
} else {
if ((((downKeys.key38 == true)) || ((downKeys.key87 == true)))){
ship.y = (ship.y - speed);
} else {
if ((((downKeys.key39 == true)) || ((downKeys.key68 == true)))){
ship.x = (ship.x + speed);
} else {
if ((((downKeys.key40 == true)) || ((downKeys.key83 == true)))){
ship.y = (ship.y + speed);
};
};
};
};
};
};
};
};
};
if (ship.x < 0){
ship.x = 0;
};
if (ship.y < 0){
ship.y = 0;
};
if (ship.x > stageW){
ship.x = stageW;
};
if (ship.y > stageH){
ship.y = stageH;
};
}
public function updateDeployables():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < deployables.length) {
_local2 = deployables[_local1];
_local2.transform.colorTransform = gameCT;
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local2.timer--;
if (_local2.timer <= 0){
gui.deploy.gotoAndStop(_local2.num);
removeChild(_local2);
deployables.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function newHunter():void{
var _local1:hunter;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:Number;
_local1 = new hunter();
_local1.rotation = (Math.random() * 360);
game.addChild(_local1);
hunters.push(_local1);
_local2 = ((Math.random() * 360) * (Math.PI / 180));
_local1.x = ((stageW / 2) + (Math.cos(_local2) * stageW));
_local1.y = ((stageH / 2) + (Math.sin(_local2) * stageH));
_local3 = (ship.x - _local1.x);
_local4 = (ship.y - _local1.y);
_local5 = Math.atan2(_local4, _local3);
_local1.xv = (Math.cos(_local5) * 3);
_local1.yv = (Math.sin(_local5) * 3);
_local1.health = 2;
_local1.score = 5620;
_local1.hit = false;
_local1.hitTime = 5;
}
public function onScoreResponse(_arg1:ServerResponseEvent):void{
switch (_arg1.returnCode){
case ScoreSubmitter.RETURNCODE_WORKING:
break;
case ScoreSubmitter.RETURNCODE_SUCCESS:
ScoreSubmitter.loadHighScorePage();
break;
case ScoreSubmitter.RETURNCODE_REJECTED:
break;
case ScoreSubmitter.RETURNCODE_WRONGVERSION:
ScoreSubmitter.loadUpdatePage();
break;
case ScoreSubmitter.RETURNCODE_NETWORKERROR:
break;
default:
break;
};
}
public function updateMouse():void{
pointer.transform.colorTransform = gameCT;
pointer.x = game.mouseX;
pointer.y = game.mouseY;
}
public function updateSpinners():void{
var _local1:int;
var _local2:spinner;
var _local3:int;
_local1 = 0;
while (_local1 < spinners.length) {
_local2 = spinners[_local1];
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
_local2.rotation = (_local2.rotation + 2);
if (_local2.out == true){
if ((((((((_local2.x > 20)) && ((_local2.x < (stageW - 20))))) && ((_local2.y > 20)))) && ((_local2.y < (stageH - 20))))){
_local2.out = false;
};
} else {
if ((((_local2.x < 20)) || ((_local2.x > (stageW - 20))))){
_local2.xv = (_local2.xv * -1);
_local2.x = (_local2.x + _local2.xv);
};
if ((((_local2.y < 20)) || ((_local2.y > (stageH - 20))))){
_local2.yv = (_local2.yv * -1);
_local2.y = (_local2.y + _local2.yv);
};
};
_local2.shootTime--;
if (_local2.shootTime <= 0){
_local2.shootTime = 15;
fireSpinner(_local2.x, _local2.y, _local2.rotation);
};
if (checkHitPlayer(_local2.x, _local2.y, 20) == true){
playerDie();
};
_local3 = checkCollision(_local2.x, _local2.y, 20);
if (_local3 > 0){
_local2.health = (_local2.health - _local3);
_local2.hit = true;
if (_local2.health <= 0){
levelEnemies--;
sexplode2.play();
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion4(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 300;
updateScore((_local2.score * combo));
game.removeChild(_local2);
spinners.splice(_local1, 1);
};
};
_local1++;
};
}
public function checkCombo(_arg1:int, _arg2:int):void{
if (comboTimer > 0){
combo++;
if (combo > 1){
newMultiplier(_arg1, _arg2);
};
};
}
public function updateInvaderQueue():void{
invaderQueueTime--;
if (invaderQueueTime <= 0){
invaderQueueTime = 15;
if (invaderQueue[0] == 1){
newInvader();
} else {
if (invaderQueue[0] == 2){
newInvader2();
};
};
invaderQueue.splice(0, 1);
};
}
public function newExplosion1(_arg1:int, _arg2:int):void{
var _local3:circleexplode;
var _local4:int;
_local4 = 0;
while (_local4 < 3) {
_local3 = new circleexplode();
_local3.x = _arg1;
_local3.y = _arg2;
game.addChild(_local3);
_local3.expand = (_local4 + 1);
_local3.fade = 0.03;
_local3.transform.colorTransform = gameCT;
explosions.push(_local3);
_local4++;
};
}
public function newExplosion2(_arg1:int, _arg2:int):void{
var _local3:hunter;
_local3 = new hunter();
_local3.rotation = (Math.random() * 360);
_local3.x = _arg1;
_local3.y = _arg2;
game.addChild(_local3);
_local3.expand = 5;
_local3.fade = 0.03;
_local3.transform.colorTransform = gameCT;
explosions.push(_local3);
}
public function newExplosion4(_arg1:int, _arg2:int):void{
var _local3:spinnerexplode;
_local3 = new spinnerexplode();
_local3.x = _arg1;
_local3.y = _arg2;
_local3.rotation = (Math.random() * 360);
_local3.timer = 60;
game.addChild(_local3);
spinnerexplodes.push(_local3);
}
public function newExplosion6(_arg1:int, _arg2:int){
var _local3:int;
var _local4:Number;
var _local5:fireexplode;
var _local6:*;
_local3 = 0;
while (_local3 < 8) {
_local4 = ((Math.random() * 360) * (Math.PI / 180));
_local5 = new fireexplode();
_local5.x = _arg1;
_local5.y = _arg2;
_local6 = ((Math.random() * 1) + 1);
_local5.xv = (Math.cos(_local4) * _local6);
_local5.yv = (Math.sin(_local4) * _local6);
_local5.shrink = 0.02;
_local5.dupe = false;
_local5.fade = true;
_local5.dupeTime = 5;
_local5.rotation = (Math.random() * 360);
_local5.gotoAndStop((int((Math.random() * 5)) + 1));
_local5.transform.colorTransform = gameCT;
particles.push(_local5);
game.addChild(_local5);
_local3++;
};
}
public function newExplosion7(_arg1:int, _arg2:int){
var _local3:int;
var _local4:Number;
var _local5:spike;
var _local6:*;
_local3 = 0;
while (_local3 < 8) {
_local4 = ((_local3 * 45) * (Math.PI / 180));
_local5 = new spike();
_local5.x = _arg1;
_local5.y = _arg2;
_local5.scaleX = 2;
_local5.scaleY = 2;
_local6 = 6;
_local5.xv = (Math.cos(_local4) * _local6);
_local5.yv = (Math.sin(_local4) * _local6);
_local5.shrink = 0.01;
_local5.dupe = false;
_local5.fade = false;
_local5.dupeTime = 5;
_local5.rotation = ((_local4 * (180 / Math.PI)) + 90);
_local5.transform.colorTransform = gameCT;
particles.push(_local5);
game.addChild(_local5);
_local3++;
};
}
public function newExplosion3(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:Number;
var _local5:pixelpart;
_local3 = 0;
while (_local3 < 6) {
_local4 = ((Math.random() * 360) * (Math.PI / 180));
_local5 = new pixelpart();
_local5.x = _arg1;
_local5.y = _arg2;
_local5.xv = (Math.cos(_local4) * 5);
_local5.yv = (Math.sin(_local4) * 5);
_local5.shrink = 0.01;
_local5.dupe = false;
_local5.fade = true;
_local5.dupeTime = 3;
_local5.rotation = (Math.random() * 360);
_local5.transform.colorTransform = gameCT;
particles.push(_local5);
game.addChild(_local5);
_local3++;
};
}
public function newExplosion5(_arg1:int, _arg2:int){
var _local3:int;
var _local4:Number;
var _local5:fireexplode;
var _local6:*;
_local3 = 0;
while (_local3 < 15) {
_local4 = ((Math.random() * 360) * (Math.PI / 180));
_local5 = new fireexplode();
_local5.x = _arg1;
_local5.y = _arg2;
_local6 = ((Math.random() * 2) + 1);
_local5.xv = (Math.cos(_local4) * _local6);
_local5.yv = (Math.sin(_local4) * _local6);
_local5.shrink = 0.02;
_local5.dupe = false;
_local5.fade = true;
_local5.dupeTime = 5;
_local5.rotation = (Math.random() * 360);
_local5.gotoAndStop((int((Math.random() * 5)) + 1));
_local5.transform.colorTransform = gameCT;
particles.push(_local5);
game.addChild(_local5);
_local3++;
};
}
public function blendColor():void{
if ((((((((((((gameCT.redOffset > (redCol - 5))) && ((gameCT.redOffset < (redCol + 5))))) && ((gameCT.greenOffset > (greenCol - 5))))) && ((gameCT.greenOffset < (greenCol + 5))))) && ((gameCT.blueOffset > (blueCol - 5))))) && ((gameCT.blueOffset < (blueCol + 5))))){
chooseNextColors();
};
if (gameCT.redOffset > redCol){
gameCT.redOffset = (gameCT.redOffset - 5);
} else {
if (gameCT.redOffset < redCol){
gameCT.redOffset = (gameCT.redOffset + 5);
};
};
if (gameCT.greenOffset > greenCol){
gameCT.greenOffset = (gameCT.greenOffset - 5);
} else {
if (gameCT.greenOffset < greenCol){
gameCT.greenOffset = (gameCT.greenOffset + 5);
};
};
if (gameCT.blueOffset > blueCol){
gameCT.blueOffset = (gameCT.blueOffset - 5);
} else {
if (gameCT.blueOffset < blueCol){
gameCT.blueOffset = (gameCT.blueOffset + 5);
};
};
}
public function newLauncher():void{
var _local1:launcher;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:Number;
_local1 = new launcher();
game.addChild(_local1);
launchers.push(_local1);
_local1.xd = (Math.random() * stageW);
_local1.yd = (Math.random() * stageH);
_local2 = ((Math.random() * 360) * (Math.PI / 180));
_local1.x = ((stageW / 2) + (Math.cos(_local2) * stageW));
_local1.y = ((stageH / 2) + (Math.sin(_local2) * stageH));
_local3 = (_local1.xd - _local1.x);
_local4 = (_local1.yd - _local1.y);
_local5 = Math.atan2(_local4, _local3);
_local1.rotation = (_local5 * (180 / Math.PI));
_local1.xv = (Math.cos(_local5) * 2);
_local1.yv = (Math.sin(_local5) * 2);
_local1.newTimer = ((Math.random() * 180) + 120);
_local1.shootTimer = 200;
_local1.health = 20;
_local1.score = 27694;
_local1.hit = false;
_local1.hitTime = 5;
}
public function newHmissile(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:hmissile;
var _local5:Number;
_local4 = new hmissile();
_local4.x = _arg1;
_local4.y = _arg2;
_local4.rotation = _arg3;
_local5 = (_arg3 * (Math.PI / 180));
_local4.speed = 6;
_local4.xv = (Math.cos(_local5) * _local4.speed);
_local4.yv = (Math.sin(_local5) * _local4.speed);
_local4.hit = false;
_local4.hitTime = 5;
_local4.health = 3;
levelEnemies++;
hmissiles.push(_local4);
game.addChild(_local4);
}
public function updateExplosions():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < explosions.length) {
_local2 = explosions[_local1];
_local2.width = (_local2.width + _local2.expand);
_local2.height = (_local2.height + _local2.expand);
_local2.alpha = (_local2.alpha - _local2.fade);
if (_local2.alpha <= 0){
game.removeChild(_local2);
explosions.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function updateHmissiles():void{
var _local1:int;
var _local2:hmissile;
var _local3:*;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:int;
_local1 = 0;
while (_local1 < hmissiles.length) {
_local2 = hmissiles[_local1];
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
_local3 = ship;
_local4 = (_local3.x - _local2.x);
_local5 = (_local3.y - _local2.y);
_local6 = Math.atan2(_local5, _local4);
_local7 = (_local6 * (180 / Math.PI));
_local8 = _local2.rotation;
if (_local7 < 0){
_local7 = (_local7 + 360);
} else {
if (_local7 > 360){
_local7 = (_local7 - 360);
};
};
if (_local8 < 0){
_local8 = (_local8 + 360);
} else {
if (_local8 > 360){
_local8 = (_local8 - 360);
};
};
_local9 = (_local8 - _local7);
if ((((((_local9 > 0)) && ((_local9 <= 180)))) || ((_local9 < -180)))){
_local2.rotation = (_local2.rotation - 3);
} else {
if ((((((_local9 < 0)) && ((_local9 >= -180)))) || ((_local9 > 180)))){
_local2.rotation = (_local2.rotation + 3);
};
};
_local10 = (_local2.rotation * (Math.PI / 180));
_local2.xv = (Math.cos(_local10) * _local2.speed);
_local2.yv = (Math.sin(_local10) * _local2.speed);
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local11 = (_local2.rotation * (Math.PI / 180));
rocketTrail((_local2.x - (Math.cos(_local11) * 15)), (_local2.y - (Math.sin(_local11) * 15)));
if (_local2.speed > 3){
_local2.speed = (_local2.speed - 0.1);
};
if (checkHitPlayer(_local2.x, _local2.y, 15) == true){
playerDie();
levelEnemies--;
rdie.play();
newExplosion6(_local2.x, _local2.y);
game.removeChild(_local2);
hmissiles.splice(_local1, 1);
_local1--;
} else {
_local12 = checkCollision(_local2.x, _local2.y, 15);
if (_local12 > 0){
_local2.health = (_local2.health - _local12);
_local2.hit = true;
if (_local2.health < 0){
levelEnemies--;
rdie.play();
newExplosion6(_local2.x, _local2.y);
game.removeChild(_local2);
hmissiles.splice(_local1, 1);
_local1--;
};
};
};
_local1++;
};
}
public function updateBadbullets():void{
var _local1:int;
_local1 = 0;
while (_local1 < badbullets.length) {
if (badbullets[_local1].dead == true){
game.removeChild(badbullets[_local1]);
badbullets.splice(_local1, 1);
_local1--;
} else {
if (badbullets[_local1].t == "bomb"){
updateBomb(badbullets[_local1]);
} else {
if (badbullets[_local1].t == "spin"){
updateSpinnerbullet(badbullets[_local1]);
};
};
};
_local1++;
};
}
public function updateOptions():void{
OPTIONS.transform.colorTransform = gameCT;
turn1++;
turn2++;
turn3++;
if (turn1 > 0){
OPTIONS.titl.rotation = (OPTIONS.titl.rotation + 0.2);
} else {
OPTIONS.titl.rotation = (OPTIONS.titl.rotation - 0.2);
};
if (turn1 >= 50){
turn1 = -50;
};
if (turn2 > 0){
OPTIONS.option1.rotation = (OPTIONS.option1.rotation - 0.2);
OPTIONS.option3.rotation = (OPTIONS.option3.rotation - 0.2);
OPTIONS.option5.rotation = (OPTIONS.option5.rotation - 0.2);
} else {
OPTIONS.option1.rotation = (OPTIONS.option1.rotation + 0.2);
OPTIONS.option3.rotation = (OPTIONS.option3.rotation + 0.2);
OPTIONS.option5.rotation = (OPTIONS.option5.rotation + 0.2);
};
if (turn2 >= 50){
turn2 = -50;
};
if (turn3 > 0){
OPTIONS.option2.rotation = (OPTIONS.option2.rotation + 0.2);
OPTIONS.option4.rotation = (OPTIONS.option4.rotation + 0.2);
} else {
OPTIONS.option2.rotation = (OPTIONS.option2.rotation - 0.2);
OPTIONS.option4.rotation = (OPTIONS.option4.rotation - 0.2);
};
if (turn3 >= 50){
turn3 = -50;
};
if (titleSelect >= 1){
OPTIONS.selector.rotation = OPTIONS[("option" + titleSelect)].rotation;
OPTIONS.selector.y = OPTIONS[("option" + titleSelect)].y;
};
if (game.mouseY > 160){
if (game.mouseY < 210){
titleSelect = 1;
OPTIONS.selector.gotoAndStop(1);
} else {
if (game.mouseY < 300){
titleSelect = 2;
OPTIONS.selector.gotoAndStop(2);
} else {
if (game.mouseY < 370){
titleSelect = 3;
OPTIONS.selector.gotoAndStop(3);
} else {
if (game.mouseY < 440){
titleSelect = 4;
OPTIONS.selector.gotoAndStop(4);
} else {
if (game.mouseY < 510){
titleSelect = 5;
OPTIONS.selector.gotoAndStop(5);
} else {
titleSelect = 0;
OPTIONS.selector.gotoAndStop(6);
};
};
};
};
};
} else {
titleSelect = 0;
OPTIONS.selector.gotoAndStop(6);
};
}
public function updateLives():void{
var _local1:String;
_local1 = String(lives);
if (_local1.length == 1){
gui.lives.num1.gotoAndStop(2);
gui.lives.num2.gotoAndStop((Number(_local1.charAt(0)) + 2));
} else {
gui.lives.num1.gotoAndStop((Number(_local1.charAt(0)) + 2));
gui.lives.num2.gotoAndStop((Number(_local1.charAt(1)) + 2));
};
}
public function newEnemy(_arg1:int):void{
var _local2:int;
var _local3:int;
if (_arg1 == 1){
levelEnemies++;
newAsteroid(1);
} else {
if (_arg1 == 2){
levelEnemies++;
newAsteroid(2);
} else {
if (_arg1 == 3){
levelEnemies++;
newAsteroid(3);
} else {
if (_arg1 == 4){
levelEnemies++;
newHunter();
} else {
if (_arg1 == 5){
_local2 = 0;
while (_local2 < 10) {
levelEnemies++;
invaderQueue.push(1);
_local2++;
};
} else {
if (_arg1 == 6){
_local3 = 0;
while (_local3 < 10) {
levelEnemies++;
invaderQueue.push(2);
_local3++;
};
} else {
if (_arg1 == 7){
levelEnemies++;
newLauncher();
} else {
if (_arg1 == 8){
levelEnemies++;
newSpinner();
} else {
if (_arg1 == 9){
levelEnemies++;
newSpiker();
};
};
};
};
};
};
};
};
};
}
public function playerDie():void{
var _local1:int;
if (gameState == "game"){
lives--;
pdie.play();
};
gun = 1;
shield = false;
gui.deploy.gotoAndStop(1);
_local1 = 0;
while (_local1 < deployables.length) {
removeChild(deployables[_local1]);
deployables.splice(_local1, 1);
_local1--;
_local1++;
};
spawnTime = 130;
playerExplode();
if (lives < 0){
lives = 0;
gameState = "endGame";
ship.gotoAndStop(1);
} else {
ship.gotoAndPlay(1);
};
if (gameState == "game"){
updateLives();
};
}
public function newInvader():void{
var _local1:invader;
_local1 = new invader();
_local1.x = -20;
_local1.y = 30;
_local1.xv = 3;
_local1.yv = 0;
_local1.ytime = 15;
_local1.ying = false;
_local1.hit = false;
_local1.hitTime = 5;
_local1.score = 8888;
if (_local1.turnDir == 0){
_local1.turnDir = -1;
};
_local1.health = 3;
invaders.push(_local1);
game.addChild(_local1);
}
public function writeSentance():void{
if (waitingLetters.length > 0){
letterTimer--;
if (letterTimer <= 0){
tutorialbox.tuttext.txt.appendText(waitingLetters[0]);
waitingLetters.splice(0, 1);
letterTimer = 2;
};
};
}
public function updateLaunchers():void{
var _local1:int;
var _local2:launcher;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
var _local12:int;
_local1 = 0;
while (_local1 < launchers.length) {
_local2 = launchers[_local1];
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
_local3 = (_local2.xd - _local2.x);
_local4 = (_local2.yd - _local2.y);
_local5 = Math.atan2(_local4, _local3);
_local6 = (_local5 * (180 / Math.PI));
_local7 = _local2.rotation;
if (_local6 < 0){
_local6 = (_local6 + 360);
} else {
if (_local6 > 360){
_local6 = (_local6 - 360);
};
};
if (_local7 < 0){
_local7 = (_local7 + 360);
} else {
if (_local7 > 360){
_local7 = (_local7 - 360);
};
};
_local8 = (_local7 - _local6);
if (Math.abs(_local8) < 3){
_local2.rotation = (_local5 * (180 / Math.PI));
} else {
if ((((((_local8 > 0)) && ((_local8 <= 180)))) || ((_local8 < -180)))){
_local2.rotation = (_local2.rotation - 2);
} else {
if ((((((_local8 < 0)) && ((_local8 >= -180)))) || ((_local8 > 180)))){
_local2.rotation = (_local2.rotation + 2);
};
};
};
_local9 = (_local2.rotation * (Math.PI / 180));
_local2.xv = (Math.cos(_local9) * 2);
_local2.yv = (Math.sin(_local9) * 2);
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local2.newTimer--;
if (_local2.newTimer <= 0){
_local2.xd = (Math.random() * stageW);
_local2.yd = (Math.random() * stageH);
_local2.newTimer = ((Math.random() * 180) + 120);
};
_local2.shootTimer--;
if (_local2.shootTimer == 100){
_local10 = (_local2.rotation - 90);
_local11 = (_local10 * (Math.PI / 180));
_local2.nextFrame();
newHmissile((_local2.x + (Math.cos(_local11) * 15)), (_local2.y + (Math.sin(_local11) * 15)), _local2.rotation);
lrocket.play();
} else {
if (_local2.shootTimer == 0){
_local10 = (_local2.rotation - 90);
_local11 = (_local10 * (Math.PI / 180));
_local2.nextFrame();
newHmissile((_local2.x - (Math.cos(_local11) * 15)), (_local2.y - (Math.sin(_local11) * 15)), _local2.rotation);
lrocket.play();
} else {
if (_local2.shootTimer == -200){
_local2.gotoAndPlay(1);
_local2.shootTimer = 200;
};
};
};
if (checkHitPlayer(_local2.x, _local2.y, 15) == true){
playerDie();
};
_local12 = checkCollision(_local2.x, _local2.y, 15);
if (_local12 > 0){
_local2.health = (_local2.health - _local12);
_local2.hit = true;
if (_local2.health < 0){
levelEnemies--;
lexplode.play();
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion5(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 200;
updateScore((_local2.score * combo));
game.removeChild(_local2);
launchers.splice(_local1, 1);
_local1--;
};
};
_local1++;
};
}
public function updatePowerups():void{
var _local1:int;
var _local2:powerup;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = 0;
while (_local1 < powerups.length) {
_local2 = powerups[_local1];
_local2.transform.colorTransform = gameCT;
_local2.timer--;
_local2.rTime--;
_local2.sTime--;
if (_local2.cTime > -1){
_local2.timer++;
_local2.cTime--;
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
if ((((_local2.cTime > -1)) && ((_local2.cTime < 1)))){
_local2.timer = -3;
};
};
if (_local2.rTime >= 0){
_local2.rotation = (_local2.rotation + 0.5);
} else {
_local2.rotation = (_local2.rotation - 0.5);
if (_local2.rTime <= -60){
_local2.rTime = 60;
};
};
if (_local2.sTime >= 0){
_local2.scaleX = (_local2.scaleX + 0.005);
_local2.scaleY = (_local2.scaleY + 0.005);
} else {
_local2.scaleX = (_local2.scaleX - 0.005);
_local2.scaleY = (_local2.scaleY - 0.005);
if (_local2.sTime <= -80){
_local2.sTime = 80;
};
};
if (_local2.timer <= 0){
_local2.scaleX = (_local2.scaleX - 0.04);
_local2.scaleY = (_local2.scaleY - 0.04);
if (_local2.scaleX <= 0.01){
game.removeChild(_local2);
powerups.splice(_local1, 1);
_local1--;
};
} else {
_local3 = (ship.x - _local2.x);
_local4 = (ship.y - _local2.y);
_local5 = ((_local3 * _local3) + (_local4 * _local4));
if (_local5 <= 625){
if ((((((_local2.num == 3)) || ((_local2.num == 6)))) || ((_local2.num == 7)))){
ppowerup.play();
newDeployablePowerup(_local2.x, _local2.y, _local2.num);
} else {
upowerup.play();
};
activatePowerup(_local2.num);
game.removeChild(_local2);
powerups.splice(_local1, 1);
_local1--;
};
};
_local1++;
};
}
public function activatePowerup(_arg1:int):void{
if (_arg1 == 1){
gun = 2;
powerupExplode();
} else {
if (_arg1 == 2){
gun = 3;
powerupExplode();
} else {
if (_arg1 == 3){
} else {
if (_arg1 == 4){
gun = 4;
powerupExplode();
} else {
if (_arg1 == 5){
lives++;
updateLives();
powerupExplode();
} else {
if (_arg1 == 6){
} else {
if (_arg1 == 7){
};
};
};
};
};
};
};
}
public function updateSpinnerbullet(_arg1:spinnerbullet):void{
_arg1.x = (_arg1.x + _arg1.xv);
_arg1.y = (_arg1.y + _arg1.yv);
_arg1.transform.colorTransform = gameCT;
if (checkHitPlayer(_arg1.x, _arg1.y, 4) == true){
_arg1.dead = true;
playerDie();
};
if ((((((((_arg1.y > stageH)) || ((_arg1.y < 0)))) || ((_arg1.x < 0)))) || ((_arg1.x > stageW)))){
_arg1.dead = true;
};
}
public function alwaysOnTop(_arg1:Event):void{
if ((game.numChildren - 1) > game.getChildIndex(pointer)){
game.swapChildrenAt((stage.numChildren - 1), game.getChildIndex(pointer));
};
}
public function updateSCORES():void{
scores.transform.colorTransform = gameCT;
}
public function turretGun(_arg1:int, _arg2:int, _arg3:Number):void{
var _local4:bullet;
_local4 = new bullet();
_local4.x = _arg1;
_local4.y = _arg2;
_local4.damage = 1;
game.addChild(_local4);
_arg3 = (_arg3 * (Math.PI / 180));
_local4.xv = (Math.cos(_arg3) * 8);
_local4.yv = (Math.sin(_arg3) * 8);
bullets.push(_local4);
}
public function updateMultipliers():void{
var _local1:int;
var _local2:multiplier;
_local1 = 0;
while (_local1 < multipliers.length) {
_local2 = multipliers[_local1];
_local2.alpha = (_local2.alpha - 0.01);
_local2.scaleX = (_local2.scaleX - 0.02);
_local2.scaleY = (_local2.scaleY - 0.02);
if (_local2.alpha <= 0){
game.removeChild(_local2);
multipliers.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function fire():void{
if (spawnTime < 80){
shootTime--;
if (shootTime <= 0){
if (gun == 1){
shootTime = 6;
gun1(ship.x, ship.y);
} else {
if (gun == 2){
shootTime = 3;
gun2(ship.x, ship.y);
} else {
if (gun == 3){
shootTime = 4;
gun3(ship.x, ship.y);
} else {
if (gun == 4){
shootTime = 8;
newHoming();
};
};
};
};
};
};
}
public function skipWriting():void{
var _local1:int;
_local1 = 0;
while (_local1 < waitingLetters.length) {
tutorialbox.tuttext.txt.appendText(waitingLetters[_local1]);
_local1++;
};
waitingLetters = [];
}
public function powerupExplode():void{
var _local1:int;
var _local2:Number;
var _local3:starpart;
_local1 = 0;
while (_local1 < 15) {
_local2 = ((Math.random() * 360) * (Math.PI / 180));
_local3 = new starpart();
_local3.x = ship.x;
_local3.y = ship.y;
_local3.xv = (Math.cos(_local2) * 5);
_local3.yv = (Math.sin(_local2) * 5);
_local3.shrink = 0.04;
_local3.dupe = false;
_local3.fade = true;
_local3.dupeTime = 3;
_local3.rotation = (Math.random() * 360);
_local3.transform.colorTransform = gameCT;
particles.push(_local3);
game.addChild(_local3);
_local1++;
};
}
public function checkHitSpiker(_arg1:int, _arg2:int, _arg3:Number, _arg4:int):Boolean{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Number;
var _local9:int;
var _local10:Number;
_local5 = (ship.x - _arg1);
_local6 = (ship.y - _arg2);
_local7 = ((_local5 * _local5) + (_local6 * _local6));
_local8 = (_arg4 * (Math.PI / 180));
if (_local7 <= 729){
return (true);
};
_local9 = 0;
while (_local9 < 7) {
_local10 = (((_local9 * 45) * (Math.PI / 180)) + _local8);
if (checkLineHit((_arg1 + (Math.cos(_local10) * 50)), (_arg2 + (Math.sin(_local10) * 50)), (Math.cos(_local10) * 5), (Math.sin(_local10) * 5), int((_arg3 / 5))) == true){
return (true);
};
_local9++;
};
return (false);
}
public function newAsteroid(_arg1:int, _arg2:int=-10, _arg3:int=-10):void{
var _local4:asteroid;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Number;
var _local10:Number;
_local4 = new asteroid();
_local4.width = (20 * _arg1);
_local4.height = (10 * _arg1);
_local4.rotation = (Math.random() * 360);
_local4.s = _arg1;
game.addChild(_local4);
asteroids.push(_local4);
if (_arg2 == -10){
_local10 = ((Math.random() * 360) * (Math.PI / 180));
_local4.x = ((stageW / 2) + (Math.cos(_local10) * stageW));
_local4.y = ((stageH / 2) + (Math.sin(_local10) * stageH));
} else {
_local4.x = _arg2;
_local4.y = _arg3;
};
_local5 = (Math.random() * stageW);
_local6 = (Math.random() * stageH);
_local7 = (_local5 - _local4.x);
_local8 = (_local6 - _local4.y);
_local9 = Math.atan2(_local8, _local7);
_local4.xv = (Math.cos(_local9) * 4);
_local4.yv = (Math.sin(_local9) * 4);
_local4.x = (_local4.x + (_local4.xv * 3));
_local4.y = (_local4.y + (_local4.yv * 3));
_local4.score = 3333;
_local4.out = true;
}
public function resetScore():void{
var _local1:int;
_local1 = 1;
while (_local1 < 13) {
gui.score[("num" + _local1)].gotoAndStop(1);
_local1++;
};
}
public function newInvader2():void{
var _local1:invader2;
_local1 = new invader2();
_local1.x = -20;
_local1.y = 30;
_local1.xv = 3;
_local1.yv = 0;
_local1.ytime = 15;
_local1.ying = false;
_local1.dropTime = ((Math.random() * 200) + 100);
_local1.hit = false;
_local1.hitTime = 8;
_local1.score = 11111;
if (_local1.turnDir == 0){
_local1.turnDir = -1;
};
_local1.health = 5;
invaders2.push(_local1);
game.addChild(_local1);
}
public function updateInvaders2():void{
var _local1:int;
var _local2:*;
var _local3:int;
_local1 = 0;
while (_local1 < invaders2.length) {
_local2 = invaders2[_local1];
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
if ((((_local2.x > (stageW - 15))) || ((((_local2.x < 15)) && ((_local2.yv == 3)))))){
_local2.ying = true;
_local2.yv = 3;
};
if (_local2.ying == true){
_local2.y = (_local2.y + _local2.yv);
_local2.ytime--;
if (_local2.ytime == 0){
_local2.ying = false;
_local2.ytime = 15;
_local2.xv = (_local2.xv * -1);
_local2.x = (_local2.x + _local2.xv);
};
} else {
_local2.x = (_local2.x + _local2.xv);
};
_local2.dropTime--;
if (_local2.dropTime <= 0){
_local2.dropTime = (Math.random() * 350);
newBomb(_local2.x, _local2.y);
};
if (checkHitPlayer(_local2.x, _local2.y, 15) == true){
playerDie();
};
if (_local2.y > (stageH + 20)){
levelEnemies--;
game.removeChild(_local2);
invaders2.splice(_local1, 1);
_local1--;
} else {
_local3 = checkCollision(_local2.x, _local2.y, 15);
if (_local3 > 0){
_local2.health = (_local2.health - _local3);
_local2.hit = true;
if (_local2.health < 0){
levelEnemies--;
iexplode.play();
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion3(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 60;
updateScore((_local2.score * combo));
game.removeChild(_local2);
invaders2.splice(_local1, 1);
_local1--;
};
};
};
_local1++;
};
}
public function newDeployablePowerup(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:powerup;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
_local4 = new powerup();
_local4.x = _arg1;
_local4.y = _arg2;
_local4.gotoAndStop(_arg3);
addChild(_local4);
_local5 = (23 - _local4.x);
_local6 = (540 - _local4.y);
_local7 = Math.atan2(_local6, _local5);
_local4.xv = (Math.cos(_local7) * 12);
_local4.yv = (Math.sin(_local7) * 12);
_local4.num = _arg3;
_local8 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
_local4.timer = (_local8 / 12);
deployables.push(_local4);
}
public function updateTitleStars():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < titleStars.length) {
_local2 = titleStars[_local1];
_local2.transform.colorTransform = gameCT;
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local2.rotation++;
if (_local2.out == true){
if ((((((((_local2.x > 0)) && ((_local2.x < stageW)))) && ((_local2.y > 0)))) && ((_local2.y < stageH)))){
_local2.out = false;
};
} else {
if ((((((((_local2.x < -20)) || ((_local2.x > (stageW + 20))))) || ((_local2.y < -20)))) || ((_local2.y > (stageH + 20))))){
removeChild(_local2);
titleStars.splice(_local1, 1);
newTitleStar();
_local1--;
};
};
_local1++;
};
}
public function newTurret(_arg1:int, _arg2:int):void{
var _local3:turret;
_local3 = new turret();
_local3.x = _arg1;
_local3.y = _arg2;
turrets.push(_local3);
game.addChild(_local3);
_local3.rotation = (Math.random() * 360);
_local3.sTime = 3;
_local3.life = 1000;
}
public function updateEnterName():void{
EN.transform.colorTransform = gameCT;
turn1++;
turn2++;
turn3++;
if (turn1 > 0){
EN.txt.rotation = (EN.txt.rotation + 0.2);
} else {
EN.txt.rotation = (EN.txt.rotation - 0.2);
};
if (turn1 >= 50){
turn1 = -50;
};
if (turn2 > 0){
EN.pod.rotation = (EN.pod.rotation - 0.2);
} else {
EN.pod.rotation = (EN.pod.rotation + 0.2);
};
if (turn2 >= 50){
turn2 = -50;
};
if (turn3 > 0){
EN.donebtn.rotation = (EN.donebtn.rotation + 0.2);
} else {
EN.donebtn.rotation = (EN.donebtn.rotation - 0.2);
};
if (turn3 >= 50){
turn3 = -50;
};
if (currentLetter <= 10){
flashTime++;
if (flashTime > 10){
flashTime = -10;
EN.pod[("l" + currentLetter)].gotoAndStop(2);
};
if (flashTime == 0){
EN.pod[("l" + currentLetter)].gotoAndStop(1);
};
};
if (titleSelect > 0){
EN.selector.rotation = EN.donebtn.rotation;
};
if (game.mouseY > 350){
if (game.mouseY < 390){
titleSelect = 1;
EN.selector.gotoAndStop(1);
} else {
titleSelect = 0;
EN.selector.gotoAndStop(2);
};
} else {
titleSelect = 0;
EN.selector.gotoAndStop(2);
};
}
public function updateBullets():void{
var _local1:int;
var _local2:*;
_local1 = 0;
while (_local1 < bullets.length) {
_local2 = bullets[_local1];
if (_local2.dead == true){
game.removeChild(_local2);
bullets.splice(_local1, 1);
_local1--;
} else {
_local2.transform.colorTransform = gameCT;
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
if ((((((((_local2.x >= stageW)) || ((_local2.x <= 0)))) || ((_local2.y <= 0)))) || ((_local2.y >= stageH)))){
game.removeChild(_local2);
bullets.splice(_local1, 1);
_local1--;
};
};
_local1++;
};
}
public function trans():void{
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:*;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:String;
var _local9:int;
var _local10:String;
var _local11:int;
if (transTo == "enterName"){
if (transSwitch == false){
if (transFrom == "logo"){
ALILLM.transform.colorTransform = gameCT;
if (ALILLM.currentFrame == 180){
transSwitch = true;
game.removeChild(ALILLM);
game.addChild(EN);
EN.x = (stageW / 2);
EN.y = ((stageH + 30) / 2);
EN.scaleX = 4;
EN.scaleY = 4;
};
} else {
if (transFrom == "options"){
OPTIONS.transform.colorTransform = gameCT;
OPTIONS.scaleX = (OPTIONS.scaleX * 1.08);
OPTIONS.scaleY = (OPTIONS.scaleY * 1.08);
if (OPTIONS.scaleX >= 6){
game.removeChild(OPTIONS);
game.addChild(EN);
EN.x = (stageW / 2);
EN.y = ((stageH + 30) / 2);
EN.scaleX = 4;
EN.scaleY = 4;
transSwitch = true;
currentLetter = 11;
playerName = savedata.data.Name;
_local1 = 9;
while (_local1 >= 0) {
if (savedata.data.Name != undefined){
if (((!((savedata.data.Name[_local1] == 0))) && (!((savedata.data.Name[_local1] == 1))))){
EN.pod[("l" + (_local1 + 1))].gotoAndStop((savedata.data.Name[_local1] + 1));
} else {
if (savedata.data.Name[_local1] == 1){
EN.pod[("l" + (_local1 + 1))].gotoAndStop(1);
} else {
if (savedata.data.Name[_local1] == 0){
currentLetter = (_local1 + 1);
trace(currentLetter);
EN.pod[("l" + (_local1 + 1))].gotoAndStop(1);
};
};
};
};
_local1--;
};
};
};
};
} else {
EN.transform.colorTransform = gameCT;
EN.scaleX = (EN.scaleX / 1.07);
EN.scaleY = (EN.scaleY / 1.07);
if (EN.scaleX <= 1){
EN.scaleX = 1;
EN.scaleY = 1;
gameState = transTo;
transSwitch = false;
turn1 = 25;
turn2 = 25;
turn3 = 25;
};
};
} else {
if (transTo == "title"){
if (transSwitch == false){
if (transFrom == "enterName"){
EN.transform.colorTransform = gameCT;
EN.scaleX = (EN.scaleX * 1.08);
EN.scaleY = (EN.scaleY * 1.08);
if (EN.scaleX >= 6){
game.removeChild(EN);
game.addChild(TITLE);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
transSwitch = true;
};
} else {
if (transFrom == "tutorial"){
game.addChild(TITLE);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
transSwitch = true;
} else {
if (transFrom == "hscores"){
game.addChild(TITLE);
game.removeChild(scores);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
transSwitch = true;
} else {
if (transFrom == "options"){
OPTIONS.transform.colorTransform = gameCT;
OPTIONS.scaleX = (OPTIONS.scaleX * 1.08);
OPTIONS.scaleY = (OPTIONS.scaleY * 1.08);
if (OPTIONS.scaleX >= 6){
game.removeChild(OPTIONS);
game.addChild(TITLE);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
transSwitch = true;
};
} else {
if (transFrom == "logo"){
ALILLM.transform.colorTransform = gameCT;
if (ALILLM.currentFrame == 180){
transSwitch = true;
game.removeChild(ALILLM);
game.addChild(TITLE);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
};
} else {
if (transFrom == "gameOver"){
GO.transform.colorTransform = gameCT;
GO.scaleX = (GO.scaleX * 1.08);
GO.scaleY = (GO.scaleY * 1.08);
if (GO.scaleX >= 6){
game.removeChild(GO);
game.addChild(TITLE);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
transSwitch = true;
};
} else {
if (transFrom == "gameComplete"){
GC.transform.colorTransform = gameCT;
GC.scaleX = (GC.scaleX * 1.08);
GC.scaleY = (GC.scaleY * 1.08);
if (GC.scaleX >= 6){
game.removeChild(GC);
game.addChild(TITLE);
TITLE.x = (stageW / 2);
TITLE.y = ((stageH + 30) / 2);
TITLE.scaleX = 4;
TITLE.scaleY = 4;
transSwitch = true;
};
};
};
};
};
};
};
};
} else {
TITLE.transform.colorTransform = gameCT;
TITLE.scaleX = (TITLE.scaleX / 1.07);
TITLE.scaleY = (TITLE.scaleY / 1.07);
if (TITLE.scaleX <= 1){
TITLE.scaleX = 1;
TITLE.scaleY = 1;
_local2 = 0;
while (_local2 < 10) {
if (savedata.data.Name != undefined){
if (savedata.data.Name[_local2] > 1){
TITLE[("l" + (_local2 + 1))].gotoAndStop((savedata.data.Name[_local2] + 1));
} else {
TITLE[("l" + (_local2 + 1))].gotoAndStop(2);
};
};
_local2++;
};
if (((!((savedata.data.HS == undefined))) && (!((savedata.data.HS == 0))))){
_local3 = String(savedata.data.HS);
_local4 = (12 - _local3.length);
_local5 = (_local4 + 1);
while (_local5 < 13) {
_local6 = Number(_local3.charAt(((_local5 - _local4) - 1)));
TITLE[("num" + _local5)].gotoAndStop((_local6 + 2));
_local5++;
};
} else {
_local7 = 1;
while (_local7 < 13) {
TITLE[("num" + _local7)].gotoAndStop(1);
_local7++;
};
};
gameState = transTo;
transSwitch = false;
TITLE.titl.rotation = 0;
TITLE.option1.rotation = 0;
TITLE.option2.rotation = 0;
TITLE.option3.rotation = 0;
TITLE.option4.rotation = 0;
TITLE.option5.rotation = 0;
TITLE.option6.rotation = 0;
turn1 = 25;
turn2 = 25;
turn3 = 25;
};
};
} else {
if (transTo == "game"){
if (transFrom == "title"){
TITLE.transform.colorTransform = gameCT;
TITLE.scaleX = (TITLE.scaleX * 1.08);
TITLE.scaleY = (TITLE.scaleY * 1.08);
if (TITLE.scaleX >= 6){
game.removeChild(TITLE);
gameState = transTo;
initGame();
};
};
} else {
if (transTo == "options"){
if (transSwitch == false){
TITLE.transform.colorTransform = gameCT;
TITLE.scaleX = (TITLE.scaleX * 1.08);
TITLE.scaleY = (TITLE.scaleY * 1.08);
if (TITLE.scaleX >= 6){
game.removeChild(TITLE);
game.addChild(OPTIONS);
OPTIONS.x = (stageW / 2);
OPTIONS.y = ((stageH + 30) / 2);
OPTIONS.scaleX = 4;
OPTIONS.scaleY = 4;
transSwitch = true;
};
} else {
OPTIONS.transform.colorTransform = gameCT;
OPTIONS.scaleX = (OPTIONS.scaleX / 1.07);
OPTIONS.scaleY = (OPTIONS.scaleY / 1.07);
if (OPTIONS.scaleX <= 1){
OPTIONS.scaleX = 1;
OPTIONS.scaleY = 1;
gameState = transTo;
transSwitch = false;
turn1 = 25;
turn2 = 25;
turn3 = 25;
OPTIONS.titl.rotation = 0;
OPTIONS.option1.rotation = 0;
OPTIONS.option2.rotation = 0;
OPTIONS.option3.rotation = 0;
OPTIONS.option4.rotation = 0;
OPTIONS.option5.rotation = 0;
};
};
} else {
if (transTo == "gameOver"){
if (transSwitch == false){
game.addChild(GO);
GO.x = (stageW / 2);
GO.y = ((stageH + 30) / 2);
GO.scaleX = 4;
GO.scaleY = 4;
transSwitch = true;
} else {
GO.transform.colorTransform = gameCT;
GO.scaleX = (GO.scaleX / 1.07);
GO.scaleY = (GO.scaleY / 1.07);
if (GO.scaleX <= 1){
GO.scaleX = 1;
GO.scaleY = 1;
gameState = transTo;
transSwitch = false;
turn1 = 25;
turn2 = 25;
turn3 = 25;
GO.titl.rotation = 0;
GO.option1.rotation = 0;
GO.option2.rotation = 0;
GO.option3.rotation = 0;
GO.score.rotation = 0;
};
};
} else {
if (transTo == "gameComplete"){
if (transSwitch == false){
game.addChild(GC);
GC.x = (stageW / 2);
GC.y = ((stageH + 30) / 2);
GC.scaleX = 4;
GC.scaleY = 4;
transSwitch = true;
} else {
GC.transform.colorTransform = gameCT;
GC.scaleX = (GC.scaleX / 1.07);
GC.scaleY = (GC.scaleY / 1.07);
if (GC.scaleX <= 1){
GC.scaleX = 1;
GC.scaleY = 1;
gameState = transTo;
transSwitch = false;
turn1 = 25;
turn2 = 25;
turn3 = 25;
GC.titl.rotation = 0;
GC.option1.rotation = 0;
GC.option2.rotation = 0;
GC.score.rotation = 0;
};
};
} else {
if (transTo == "tutorial"){
if (transFrom == "title"){
TITLE.transform.colorTransform = gameCT;
TITLE.scaleX = (TITLE.scaleX * 1.08);
TITLE.scaleY = (TITLE.scaleY * 1.08);
if (TITLE.scaleX >= 6){
game.removeChild(TITLE);
gameState = transTo;
};
};
} else {
if (transTo == "hscores"){
if (transSwitch == false){
if (transFrom == "title"){
TITLE.transform.colorTransform = gameCT;
TITLE.scaleX = (TITLE.scaleX * 1.08);
TITLE.scaleY = (TITLE.scaleY * 1.08);
if (TITLE.scaleX >= 6){
game.removeChild(TITLE);
game.addChild(scores);
scores.x = (stageW / 2);
scores.y = ((stageH + 30) / 2);
scores.scaleX = 4;
scores.scaleY = 4;
transSwitch = true;
MochiScores.showLeaderboard({boardID:"eb0585275b7f5383"});
};
} else {
if (transFrom == "gameOver"){
GO.transform.colorTransform = gameCT;
GO.scaleX = (GO.scaleX * 1.08);
GO.scaleY = (GO.scaleY * 1.08);
if (GO.scaleX >= 6){
game.removeChild(GO);
game.addChild(scores);
scores.x = (stageW / 2);
scores.y = ((stageH + 30) / 2);
scores.scaleX = 4;
scores.scaleY = 4;
transSwitch = true;
_local8 = new String();
_local9 = 0;
while (_local9 < savedata.data.Name.length) {
_local8 = (_local8 + letters[(savedata.data.Name[_local9] + 1)]);
_local9++;
};
MochiScores.showLeaderboard({boardID:"eb0585275b7f5383", score:score, name:_local8});
};
} else {
if (transFrom == "gameComplete"){
GC.transform.colorTransform = gameCT;
GC.scaleX = (GC.scaleX * 1.08);
GC.scaleY = (GC.scaleY * 1.08);
if (GC.scaleX >= 6){
game.removeChild(GC);
game.addChild(scores);
scores.x = (stageW / 2);
scores.y = ((stageH + 30) / 2);
scores.scaleX = 4;
scores.scaleY = 4;
transSwitch = true;
_local10 = "*";
_local11 = 0;
while (_local11 < savedata.data.Name.length) {
_local10 = (_local10 + letters[(savedata.data.Name[_local11] + 1)]);
_local11++;
};
MochiScores.showLeaderboard({boardID:"eb0585275b7f5383", score:score, name:_local10});
};
};
};
};
} else {
scores.transform.colorTransform = gameCT;
scores.scaleX = (scores.scaleX / 1.07);
scores.scaleY = (scores.scaleY / 1.07);
if (scores.scaleX <= 1){
scores.scaleX = 1;
scores.scaleY = 1;
gameState = transTo;
transSwitch = false;
turn1 = 25;
turn2 = 25;
turn3 = 25;
};
};
};
};
};
};
};
};
};
};
}
public function playerExplode():void{
var _local1:int;
var _local2:Number;
var _local3:squarepart;
_local1 = 0;
while (_local1 < 6) {
_local2 = ((Math.random() * 360) * (Math.PI / 180));
_local3 = new squarepart();
_local3.x = ship.x;
_local3.y = ship.y;
_local3.xv = (Math.cos(_local2) * 5);
_local3.yv = (Math.sin(_local2) * 5);
_local3.shrink = 0.01;
_local3.dupe = true;
_local3.fade = true;
_local3.dupeTime = 3;
_local3.rotation = (Math.random() * 360);
_local3.transform.colorTransform = gameCT;
particles.push(_local3);
game.addChild(_local3);
_local1++;
};
}
public function gun1(_arg1:int, _arg2:int):void{
var _local3:bullet;
var _local4:int;
var _local5:int;
var _local6:Number;
_local3 = new bullet();
_local3.x = _arg1;
_local3.y = _arg2;
game.addChild(_local3);
_local4 = (game.mouseX - _arg1);
_local5 = (game.mouseY - _arg2);
_local6 = Math.atan2(_local5, _local4);
_local3.xv = (Math.cos(_local6) * 8);
_local3.yv = (Math.sin(_local6) * 8);
_local3.damage = 1;
bullets.push(_local3);
}
public function gun3(_arg1:int, _arg2:int):void{
var _local3:bullet;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:bullet;
_local3 = new bullet();
_local3.x = _arg1;
_local3.y = _arg2;
game.addChild(_local3);
_local4 = (game.mouseX - _arg1);
_local5 = (game.mouseY - _arg2);
_local6 = Math.atan2(_local5, _local4);
_local7 = (_local6 + (90 * (Math.PI / 180)));
_local3.xv = (Math.cos(_local6) * 8);
_local3.yv = (Math.sin(_local6) * 8);
_local3.x = (_local3.x + (Math.cos(_local7) * 4));
_local3.y = (_local3.y + (Math.sin(_local7) * 4));
_local3.damage = 1;
bullets.push(_local3);
_local8 = new bullet();
_local8.x = _arg1;
_local8.y = _arg2;
game.addChild(_local8);
_local8.xv = _local3.xv;
_local8.yv = _local3.yv;
_local8.x = (_local8.x - (Math.cos(_local7) * 4));
_local8.y = (_local8.y - (Math.sin(_local7) * 4));
_local8.damage = 1;
bullets.push(_local8);
}
public function newSpiker():void{
var _local1:spiker;
var _local2:Number;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Number;
_local1 = new spiker();
_local1.rotation = (Math.random() * 360);
game.addChild(_local1);
spikers.push(_local1);
_local2 = ((Math.random() * 360) * (Math.PI / 180));
_local1.x = ((stageW / 2) + (Math.cos(_local2) * stageW));
_local1.y = ((stageH / 2) + (Math.sin(_local2) * stageH));
_local3 = ((Math.random() * (stageW - 50)) + 25);
_local4 = ((Math.random() * (stageH - 50)) + 25);
_local5 = (_local3 - _local1.x);
_local6 = (_local4 - _local1.y);
_local7 = Math.atan2(_local6, _local5);
_local1.xv = (Math.cos(_local7) * 2);
_local1.yv = (Math.sin(_local7) * 2);
_local1.x = (_local1.x + (_local1.xv * 3));
_local1.y = (_local1.y + (_local1.yv * 3));
_local1.score = 68359;
_local1.hit = false;
_local1.hitTime = 5;
_local1.health = 35;
_local1.spikeTime = 80;
_local1.spikeRad = 0;
_local1.out = true;
}
public function updateBomb(_arg1:bomb):void{
_arg1.y = (_arg1.y + 3);
_arg1.transform.colorTransform = gameCT;
if (checkHitPlayer(_arg1.x, _arg1.y, 3) == true){
_arg1.dead = true;
playerDie();
};
if (_arg1.y > stageH){
_arg1.dead = true;
};
}
public function checkCollision(_arg1:int, _arg2:int, _arg3:int):int{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
_local7 = (_arg3 * _arg3);
_local8 = 0;
_local9 = 0;
while (_local9 < bullets.length) {
_local4 = (bullets[_local9].x - _arg1);
_local5 = (bullets[_local9].y - _arg2);
_local6 = ((_local4 * _local4) + (_local5 * _local5));
if (_local6 < _local7){
game.removeChild(bullets[_local9]);
_local8 = bullets[_local9].damage;
bullets.splice(_local9, 1);
break;
};
_local9++;
};
_local10 = 0;
while (_local10 < homings.length) {
_local4 = (homings[_local10].x - _arg1);
_local5 = (homings[_local10].y - _arg2);
_local6 = ((_local4 * _local4) + (_local5 * _local5));
if (_local6 < _local7){
_local8 = 2;
game.removeChild(homings[_local10]);
homings.splice(_local10, 1);
break;
};
_local10++;
};
return (_local8);
}
public function fireSpinner(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:Number;
var _local5:int;
var _local6:spinnerbullet;
_local4 = (_arg3 * (Math.PI / 180));
_local5 = 0;
while (_local5 < 4) {
_local6 = new spinnerbullet();
_local6.x = (_arg1 + (Math.cos(_local4) * 20));
_local6.y = (_arg2 + (Math.sin(_local4) * 20));
_local6.rotation = (_local4 * (180 / Math.PI));
_local6.xv = (Math.cos(_local4) * 4);
_local6.yv = (Math.sin(_local4) * 4);
_local6.t = "spin";
_local6.dead = false;
game.addChild(_local6);
badbullets.push(_local6);
_local4 = (_local4 + (Math.PI / 2));
_local5++;
};
}
public function gun2(_arg1:int, _arg2:int):void{
var _local3:bullet;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:int;
_local3 = new bullet();
_local3.x = _arg1;
_local3.y = _arg2;
game.addChild(_local3);
_local4 = (game.mouseX - _arg1);
_local5 = (game.mouseY - _arg2);
_local6 = Math.atan2(_local5, _local4);
_local7 = ((Math.random() * 30) - (Math.random() * 30));
_local6 = (_local6 + (_local7 * (Math.PI / 180)));
_local3.xv = (Math.cos(_local6) * 8);
_local3.yv = (Math.sin(_local6) * 8);
_local3.damage = 1;
bullets.push(_local3);
}
public function radialBlast():void{
var _local1:int;
var _local2:shrapnal;
var _local3:*;
_local1 = 0;
while (_local1 < 36) {
_local2 = new shrapnal();
_local2.x = ship.x;
_local2.y = ship.y;
_local3 = ((_local1 * 10) * (Math.PI / 180));
_local2.xv = (Math.cos(_local3) * 10);
_local2.yv = (Math.sin(_local3) * 10);
_local2.rotation = (Math.random() * 360);
_local2.damage = 5;
bullets.push(_local2);
game.addChild(_local2);
_local1++;
};
}
public function newTitleStar():void{
var _local1:titlebit;
var _local2:int;
var _local3:int;
var _local4:*;
_local1 = new titlebit();
_local2 = (Math.random() * stageW);
_local3 = (Math.random() * stageH);
_local4 = ((Math.random() * 360) * (Math.PI / 180));
_local1.x = (_local2 + (Math.cos(_local4) * (stageW * 1.5)));
_local1.y = (_local3 + (Math.sin(_local4) * (stageH * 1.5)));
_local1.scaleX = (Math.random() * 1);
_local1.scaleY = _local1.scaleX;
_local1.timer = (300 + (Math.random() * 100));
_local1.xv = (Math.cos(_local4) * -5);
_local1.yv = (Math.sin(_local4) * -5);
_local1.out = true;
_local1.rotation = (Math.random() * 360);
addChild(_local1);
titleStars.push(_local1);
}
public function updateTitle():void{
TITLE.transform.colorTransform = gameCT;
turn1++;
turn2++;
turn3++;
if (turn1 > 0){
TITLE.titl.rotation = (TITLE.titl.rotation + 0.2);
} else {
TITLE.titl.rotation = (TITLE.titl.rotation - 0.2);
};
if (turn1 >= 50){
turn1 = -50;
};
if (turn2 > 0){
TITLE.option1.rotation = (TITLE.option1.rotation - 0.2);
TITLE.option3.rotation = (TITLE.option3.rotation - 0.2);
TITLE.option5.rotation = (TITLE.option5.rotation - 0.2);
} else {
TITLE.option1.rotation = (TITLE.option1.rotation + 0.2);
TITLE.option3.rotation = (TITLE.option3.rotation + 0.2);
TITLE.option5.rotation = (TITLE.option5.rotation + 0.2);
};
if (turn2 >= 50){
turn2 = -50;
};
if (turn3 > 0){
TITLE.option2.rotation = (TITLE.option2.rotation + 0.2);
TITLE.option4.rotation = (TITLE.option4.rotation + 0.2);
TITLE.option6.rotation = (TITLE.option6.rotation + 0.2);
} else {
TITLE.option2.rotation = (TITLE.option2.rotation - 0.2);
TITLE.option4.rotation = (TITLE.option4.rotation - 0.2);
TITLE.option6.rotation = (TITLE.option6.rotation - 0.2);
};
if (turn3 >= 50){
turn3 = -50;
};
if (titleSelect > 0){
TITLE.selector.rotation = TITLE[("option" + titleSelect)].rotation;
TITLE.selector.y = TITLE[("option" + titleSelect)].y;
};
if (game.mouseY > 150){
if (game.mouseY < 200){
titleSelect = 1;
TITLE.selector.gotoAndStop(1);
} else {
if (game.mouseY < 250){
titleSelect = 2;
TITLE.selector.gotoAndStop(2);
} else {
if (game.mouseY < 310){
titleSelect = 3;
TITLE.selector.gotoAndStop(3);
} else {
if (game.mouseY < 370){
titleSelect = 4;
TITLE.selector.gotoAndStop(4);
} else {
if (game.mouseY < 420){
titleSelect = 5;
TITLE.selector.gotoAndStop(5);
} else {
if (game.mouseY < 470){
titleSelect = 6;
TITLE.selector.gotoAndStop(6);
} else {
titleSelect = 0;
TITLE.selector.gotoAndStop(7);
};
};
};
};
};
};
} else {
titleSelect = 0;
TITLE.selector.gotoAndStop(7);
};
}
public function updateTutorial():void{
var _local1:Array;
var _local2:int;
writeSentance();
tutorialbox.tuttext.transform.colorTransform = gameCT;
_local1 = this[("wave" + level)];
if (nextPartTimer > 0){
nextPartTimer--;
} else {
levelPart++;
if (levelPart >= _local1.length){
if ((((((((((levelEnemies == 0)) && ((waitingLetters.length == 0)))) && ((powerups.length == 0)))) && ((deployables.length == 0)))) && ((gui.deploy.currentFrame == 1)))){
waiting = true;
tutorialbox.tuttext.pressspace.y = 60;
};
nextPartTimer = 10;
} else {
_local2 = 0;
while (_local2 < (_local1[levelPart].length - 1)) {
newEnemy(_local1[levelPart][_local2]);
_local2++;
};
nextPartTimer = _local1[levelPart][(_local1[levelPart].length - 1)];
};
};
}
public function updateScore(_arg1:int):void{
var _local2:String;
var _local3:*;
var _local4:int;
var _local5:int;
score = (score + _arg1);
_local2 = String(score);
_local3 = (12 - _local2.length);
_local4 = (_local3 + 1);
while (_local4 < 13) {
_local5 = Number(_local2.charAt(((_local4 - _local3) - 1)));
gui.score[("num" + _local4)].gotoAndStop((_local5 + 2));
_local4++;
};
}
public function endGame():void{
var _local1:int;
fadeSound = true;
soundSwitch = 1;
_local1 = 0;
_local1 = 0;
while (_local1 < bullets.length) {
game.removeChild(bullets[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < badbullets.length) {
game.removeChild(badbullets[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < homings.length) {
game.removeChild(homings[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < hmissiles.length) {
game.removeChild(hmissiles[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < explosions.length) {
game.removeChild(explosions[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < multipliers.length) {
game.removeChild(multipliers[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < powerups.length) {
game.removeChild(powerups[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < deployables.length) {
removeChild(deployables[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < turrets.length) {
game.removeChild(turrets[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < asteroids.length) {
game.removeChild(asteroids[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < invaders.length) {
game.removeChild(invaders[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < invaders2.length) {
game.removeChild(invaders2[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < hunters.length) {
game.removeChild(hunters[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < launchers.length) {
game.removeChild(launchers[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < spinners.length) {
game.removeChild(spinners[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < spikers.length) {
game.removeChild(spikers[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < particles.length) {
game.removeChild(particles[_local1]);
_local1++;
};
_local1 = 0;
while (_local1 < spinnerexplodes.length) {
game.removeChild(spinnerexplodes[_local1]);
_local1++;
};
bullets = new Array();
badbullets = new Array();
homings = new Array();
hmissiles = new Array();
explosions = new Array();
multipliers = new Array();
powerups = new Array();
deployables = new Array();
turrets = new Array();
asteroids = new Array();
invaders = new Array();
invaders2 = new Array();
hunters = new Array();
launchers = new Array();
spinners = new Array();
spikers = new Array();
particles = new Array();
spinnerexplodes = new Array();
game.removeChild(ship);
removeChild(gui);
}
public function updateGO():void{
GO.transform.colorTransform = gameCT;
turn1++;
turn2++;
turn3++;
if (turn1 > 0){
GO.titl.rotation = (GO.titl.rotation + 0.2);
GO.option1.rotation = (GO.option1.rotation + 0.2);
GO.option3.rotation = (GO.option3.rotation + 0.2);
} else {
GO.titl.rotation = (GO.titl.rotation - 0.2);
GO.option1.rotation = (GO.option1.rotation - 0.2);
GO.option3.rotation = (GO.option3.rotation - 0.2);
};
if (turn1 >= 50){
turn1 = -50;
};
if (turn2 > 0){
GO.option2.rotation = (GO.option2.rotation - 0.2);
GO.score.rotation = (GO.score.rotation - 0.2);
} else {
GO.option2.rotation = (GO.option2.rotation + 0.2);
GO.score.rotation = (GO.score.rotation + 0.2);
};
if (turn2 >= 50){
turn2 = -50;
};
if (turn3 > 0){
};
if (turn3 >= 50){
turn3 = -50;
};
if (titleSelect > 0){
GO.selector.rotation = GO[("option" + titleSelect)].rotation;
GO.selector.y = GO[("option" + titleSelect)].y;
};
if (game.mouseY > 320){
if (game.mouseY < 380){
titleSelect = 1;
GO.selector.gotoAndStop(1);
} else {
if (game.mouseY < 440){
titleSelect = 2;
GO.selector.gotoAndStop(2);
} else {
if (game.mouseY < 500){
titleSelect = 3;
GO.selector.gotoAndStop(3);
} else {
titleSelect = 0;
GO.selector.gotoAndStop(4);
};
};
};
} else {
titleSelect = 0;
GO.selector.gotoAndStop(4);
};
}
public function newMultiplier(_arg1:int, _arg2:int):void{
var _local3:multiplier;
var _local4:String;
_local3 = new multiplier();
_local3.x = _arg1;
_local3.y = _arg2;
_local3.scaleX = 2;
_local3.scaleY = 2;
_local3.transform.colorTransform = gameCT;
if (combo < 10){
_local3.num1.gotoAndStop(2);
_local3.num2.gotoAndStop((combo + 2));
} else {
_local4 = String(combo);
_local3.num1.gotoAndStop((Number(_local4.charAt(0)) + 2));
_local3.num2.gotoAndStop((Number(_local4.charAt(1)) + 2));
};
game.addChild(_local3);
multipliers.push(_local3);
}
public function updateGC():void{
GC.transform.colorTransform = gameCT;
turn1++;
turn2++;
turn3++;
if (turn1 > 0){
GC.titl.rotation = (GC.titl.rotation + 0.2);
GC.option1.rotation = (GC.option1.rotation + 0.2);
} else {
GC.titl.rotation = (GC.titl.rotation - 0.2);
GC.option1.rotation = (GC.option1.rotation - 0.2);
};
if (turn1 >= 50){
turn1 = -50;
};
if (turn2 > 0){
GC.option2.rotation = (GC.option2.rotation + 0.2);
GC.score.rotation = (GC.score.rotation - 0.2);
} else {
GC.option2.rotation = (GC.option2.rotation - 0.2);
GC.score.rotation = (GC.score.rotation + 0.2);
};
if (turn2 >= 50){
turn2 = -50;
};
if (turn3 > 0){
};
if (turn3 >= 50){
turn3 = -50;
};
if (titleSelect > 0){
GC.selector.rotation = GC[("option" + titleSelect)].rotation;
GC.selector.y = GC[("option" + titleSelect)].y;
};
if (game.mouseY > 350){
if (game.mouseY < 420){
titleSelect = 1;
GC.selector.gotoAndStop(1);
} else {
if (game.mouseY < 500){
titleSelect = 2;
GC.selector.gotoAndStop(2);
} else {
titleSelect = 0;
GC.selector.gotoAndStop(4);
};
};
} else {
titleSelect = 0;
GC.selector.gotoAndStop(4);
};
}
public function rocketTrail(_arg1:int, _arg2:int):void{
var _local3:tinypart;
_local3 = new tinypart();
_local3.rotation = (Math.random() * 360);
_local3.x = (_arg1 + ((Math.random() * 5) - (Math.random() * 5)));
_local3.y = (_arg2 + ((Math.random() * 5) - (Math.random() * 5)));
_local3.xv = 0;
_local3.yv = 0;
_local3.shrink = 0.03;
_local3.dupe = false;
_local3.fade = false;
_local3.transform.colorTransform = gameCT;
game.addChild(_local3);
particles.push(_local3);
}
public function newHoming():void{
var _local1:homing;
var _local2:int;
var _local3:int;
var _local4:Number;
_local1 = new homing();
_local1.x = ship.x;
_local1.y = ship.y;
_local2 = (game.mouseX - ship.x);
_local3 = (game.mouseY - ship.y);
_local4 = Math.atan2(_local3, _local2);
_local1.rotation = (_local4 * (180 / Math.PI));
_local1.xv = (Math.cos(_local4) * 7);
_local1.yv = (Math.sin(_local4) * 7);
homings.push(_local1);
game.addChild(_local1);
}
public function keysUp(_arg1:KeyboardEvent):void{
downKeys[("key" + _arg1.keyCode)] = false;
}
public function updateGUI():void{
var _local1:int;
_local1 = 1;
while (_local1 < 13) {
gui.score[("num" + _local1)].transform.colorTransform = gameCT;
_local1++;
};
gui.lives.transform.colorTransform = gameCT;
gui.deploy.transform.colorTransform = gameCT;
if (gui.deploy.scaleX < 1){
gui.deploy.scaleX = (gui.deploy.scaleX + 0.05);
gui.deploy.scaleY = (gui.deploy.scaleY + 0.05);
};
if (comboTimer > 0){
comboTimer--;
if (comboTimer == 0){
combo = 1;
};
};
}
public function runLevel():void{
var _local1:Array;
var _local2:int;
_local1 = this[("wave" + level)];
if (nextPartTimer > 0){
nextPartTimer--;
} else {
levelPart++;
if (levelPart >= _local1.length){
if (levelEnemies == 0){
level++;
levelPart = -1;
if (level == 61){
gameState = "endGame2";
return;
};
};
nextPartTimer = 10;
} else {
_local2 = 0;
while (_local2 < (_local1[levelPart].length - 1)) {
newEnemy(_local1[levelPart][_local2]);
_local2++;
};
nextPartTimer = _local1[levelPart][(_local1[levelPart].length - 1)];
};
};
}
public function chooseNextColors():void{
var _local1:int;
_local1 = 320;
redCol = (Math.random() * 0xFF);
_local1 = (_local1 - redCol);
if (_local1 >= 0xFF){
greenCol = (Math.random() * 0xFF);
} else {
greenCol = (Math.random() * _local1);
};
_local1 = (_local1 - greenCol);
blueCol = _local1;
}
public function updateSpikers():void{
var _local1:int;
var _local2:spiker;
var _local3:int;
var _local4:int;
var _local5:Number;
_local1 = 0;
while (_local1 < spikers.length) {
_local2 = spikers[_local1];
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
_local2.rotation++;
if (_local2.out == true){
if ((((((((_local2.x > 25)) && ((_local2.x < (stageW - 25))))) && ((_local2.y > 25)))) && ((_local2.y < (stageH - 25))))){
_local2.out = false;
};
} else {
if ((((_local2.x < 25)) || ((_local2.x > (stageW - 25))))){
_local2.xv = (_local2.xv * -1);
_local2.x = (_local2.x + _local2.xv);
};
if ((((_local2.y < 25)) || ((_local2.y > (stageH - 25))))){
_local2.yv = (_local2.yv * -1);
_local2.y = (_local2.y + _local2.yv);
};
};
_local2.spikeTime--;
if (_local2.spikeTime <= -180){
_local2.spikeTime = 200;
} else {
if (_local2.spikeTime <= -100){
_local2.spikeRad = (_local2.spikeRad - 2);
} else {
if (_local2.spikeTime <= 0){
} else {
if (_local2.spikeTime <= 80){
_local2.spikeRad = (_local2.spikeRad + 2);
};
};
};
};
_local2.graphics.clear();
_local2.graphics.lineStyle(0.5, 0, 1);
_local3 = 0;
while (_local3 < 8) {
_local5 = ((_local3 * 45) * (Math.PI / 180));
_local2.graphics.moveTo((Math.cos(_local5) * 25), (Math.sin(_local5) * 25));
_local2.graphics.lineTo((Math.cos(_local5) * (25 + _local2.spikeRad)), (Math.sin(_local5) * (25 + _local2.spikeRad)));
_local2[("spike" + _local3)].x = (Math.cos(_local5) * (30 + _local2.spikeRad));
_local2[("spike" + _local3)].y = (Math.sin(_local5) * (30 + _local2.spikeRad));
_local3++;
};
if (checkHitPlayer(_local2.x, _local2.y, (25 + _local2.spikeRad)) == true){
if (checkHitSpiker(_local2.x, _local2.y, _local2.spikeRad, _local2.rotation) == true){
playerDie();
};
};
_local4 = checkCollision(_local2.x, _local2.y, 25);
if (_local4 > 0){
_local2.health = (_local2.health - _local4);
_local2.hit = true;
if (_local2.health <= 0){
levelEnemies--;
sexplode.play();
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion7(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 1000;
updateScore((_local2.score * combo));
game.removeChild(_local2);
spikers.splice(_local1, 1);
};
};
_local1++;
};
}
public function mouserelease(_arg1:MouseEvent):void{
var _local2:String;
var _local3:int;
var _local4:ScoreSubmitter;
var _local5:String;
var _local6:int;
var _local7:ScoreSubmitter;
if ((((gameState == "logo")) || ((((gameState == "trans")) && ((transFrom == "logo")))))){
goToUrl("http://www.alillm.com");
} else {
if (gameState == "title"){
if (titleSelect == 4){
ScoreSubmitter.loadHighScorePage();
} else {
if (titleSelect == 5){
goToUrl("http://www.crazymonkeygames.com/41streality/");
} else {
if (titleSelect == 6){
goToUrl("http://www.crazymonkeygames.com");
};
};
};
} else {
if (gameState == "gameOver"){
if (titleSelect == 1){
_local2 = new String();
_local3 = 0;
while (_local3 < savedata.data.Name.length) {
_local2 = (_local2 + letters[(savedata.data.Name[_local3] + 1)]);
_local3++;
};
_local4 = new ScoreSubmitter();
_local4.addEventListener(ScoreSubmitter.SCORE_RESPONSE, onScoreResponse);
_local4.submitScore(_local2, score);
gameState = "trans";
transTo = "title";
transFrom = "gameOver";
} else {
if (titleSelect == 3){
goToUrl("http://www.crazymonkeygames.com");
};
};
} else {
if (gameState == "gameComplete"){
if (titleSelect == 1){
_local5 = "**";
_local6 = 0;
while (_local6 < savedata.data.Name.length) {
_local5 = (_local5 + letters[(savedata.data.Name[_local6] + 1)]);
_local6++;
};
_local7 = new ScoreSubmitter();
_local7.addEventListener(ScoreSubmitter.SCORE_RESPONSE, onScoreResponse);
_local7.submitScore(_local5, score);
gameState = "trans";
transTo = "title";
transFrom = "gameComplete";
};
};
};
};
};
}
public function updateParticles():void{
var _local1:int;
var _local2:*;
var _local3:squarepart;
_local1 = 0;
while (_local1 < particles.length) {
_local2 = particles[_local1];
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local2.scaleX = (_local2.scaleX - _local2.shrink);
_local2.scaleY = (_local2.scaleY - _local2.shrink);
if (_local2.dupe == true){
_local2.dupeTime--;
if (_local2.dupeTime <= 0){
_local2.dupeTime = 3;
_local3 = new squarepart();
_local3.x = _local2.x;
_local3.y = _local2.y;
_local3.xv = 0;
_local3.yv = 0;
_local3.shrink = 0.03;
_local3.alpha = _local2.alpha;
_local3.fade = true;
_local3.dupe = false;
_local3.rotation = (Math.random() * 360);
_local3.transform.colorTransform = gameCT;
particles.push(_local3);
game.addChild(_local3);
};
};
if (_local2.fade == true){
_local2.alpha = (_local2.alpha - 0.01);
};
if ((((_local2.scaleX <= 0)) || ((_local2.alpha <= 0)))){
game.removeChild(_local2);
particles.splice(_local1, 1);
_local1--;
};
_local1++;
};
}
public function updateHunters():void{
var _local1:int;
var _local2:*;
var _local3:int;
var _local4:int;
var _local5:Number;
var _local6:int;
_local1 = 0;
while (_local1 < hunters.length) {
_local2 = hunters[_local1];
if (_local2.hit){
_local2.hitTime--;
if (_local2.hitTime == 0){
_local2.hitTime = 5;
_local2.hit = false;
};
_local2.transform.colorTransform = whiteCT;
} else {
_local2.transform.colorTransform = gameCT;
};
_local2.rotation = (_local2.rotation + 4);
_local2.x = (_local2.x + _local2.xv);
_local2.y = (_local2.y + _local2.yv);
_local3 = (ship.x - _local2.x);
_local4 = (ship.y - _local2.y);
_local5 = Math.atan2(_local4, _local3);
_local2.xv = (Math.cos(_local5) * 3);
_local2.yv = (Math.sin(_local5) * 3);
if (checkHitPlayer(_local2.x, _local2.y, 15) == true){
playerDie();
};
_local6 = checkCollision(_local2.x, _local2.y, 15);
if (_local6 > 0){
_local2.health = (_local2.health - _local6);
_local2.hit = true;
if (_local2.health < 0){
levelEnemies--;
hexplode.play();
newPowerup(_local2.x, _local2.y, (_local2.score * combo));
newExplosion2(_local2.x, _local2.y);
checkCombo(_local2.x, _local2.y);
comboTimer = 40;
updateScore((_local2.score * combo));
game.removeChild(_local2);
hunters.splice(_local1, 1);
};
};
_local1++;
};
}
}
}//package 41reality_fla
Section 13 (291 B)
//musictogle_102 (41reality_fla.musictogle_102)
package 41reality_fla {
import flash.display.*;
public dynamic class musictogle_102 extends MovieClip {
public function musictogle_102(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 14 (271 B)
//number_27 (41reality_fla.number_27)
package 41reality_fla {
import flash.display.*;
public dynamic class number_27 extends MovieClip {
public function number_27(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 15 (311 B)
//optionsselector_101 (41reality_fla.optionsselector_101)
package 41reality_fla {
import flash.display.*;
public dynamic class optionsselector_101 extends MovieClip {
public function optionsselector_101(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 16 (607 B)
//Preloader_5 (41reality_fla.Preloader_5)
package 41reality_fla {
import flash.display.*;
import flash.events.*;
public dynamic class Preloader_5 extends MovieClip {
public var CMG_LoadingBar:MovieClip;
public var play_btn:SimpleButton;
public function Preloader_5(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
play_btn.addEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler_CMGPlayBtn);
}
public function onMouseUpHandler_CMGPlayBtn(_arg1:MouseEvent):void{
MovieClip(parent).gotoAndStop(82);
}
}
}//package 41reality_fla
Section 17 (518 B)
//score_75 (41reality_fla.score_75)
package 41reality_fla {
import flash.display.*;
public dynamic class score_75 extends MovieClip {
public var num10:MovieClip;
public var num11:MovieClip;
public var num12:MovieClip;
public var num1:MovieClip;
public var num3:MovieClip;
public var num6:MovieClip;
public var num7:MovieClip;
public var num4:MovieClip;
public var num5:MovieClip;
public var num2:MovieClip;
public var num8:MovieClip;
public var num9:MovieClip;
}
}//package 41reality_fla
Section 18 (279 B)
//selector_50 (41reality_fla.selector_50)
package 41reality_fla {
import flash.display.*;
public dynamic class selector_50 extends MovieClip {
public function selector_50(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package 41reality_fla
Section 19 (258 B)
//tuttext_33 (41reality_fla.tuttext_33)
package 41reality_fla {
import flash.display.*;
import flash.text.*;
public dynamic class tuttext_33 extends MovieClip {
public var txt:TextField;
public var pressspace:MovieClip;
}
}//package 41reality_fla
Section 20 (16.33 KiB) ● ● ●
//MD5 (CMG_AS3.MD5)
package CMG_AS3 {
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 CMG_AS3
Section 21 (3.42 KiB) ●
//ScoreSubmitter (CMG_AS3.ScoreSubmitter)
package CMG_AS3 {
import flash.events.*;
import flash.net.*;
public class ScoreSubmitter extends EventDispatcher {
private var m_UrlLoader:URLLoader;// = null
public static const RETURNCODE_SUCCESS = 1;
public static const RETURNCODE_REJECTED = 2;
public static const RETURNCODE_INTERNALERROR = 5;
public static const URL_SUBMITSCORE = "http://scores.crazymonkeygames.com/hs/regscores2.php";
public static const URL_UPDATEGAME = "http://scores.crazymonkeygames.com/hs/pleaseupdate.php";
public static const SCORE_RESPONSE:String = "score_response";
public static const RETURNCODE_WORKING = 0;
public static const RETURNCODE_WRONGVERSION = 3;
public static const URL_VIEWSCORES = "http://scores.crazymonkeygames.com/hs/listscores.php";
public static const RETURNCODE_NETWORKERROR = 4;
public static var gameVersion:String = "";
public static var gameValidationCode:String = "";
public static var gameId:uint = 0;
public function ScoreSubmitter(){
m_UrlLoader = null;
super();
}
private function onIoError(_arg1:Event){
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_NETWORKERROR));
}
public function submitScore(_arg1:String, _arg2, _arg3:String=null):void{
var _local4:*;
var _local5:URLRequest;
_arg1 = Utilities.trim(_arg1);
gameVersion = Utilities.trim(gameVersion);
if (_arg3 == null){
_arg3 = "";
} else {
_arg3 = Utilities.trim(_arg3);
};
gameValidationCode = Utilities.trim(gameValidationCode);
if ((((((gameId < 1)) || ((gameVersion == "")))) || ((gameValidationCode == "")))){
trace("ERROR: CMG_AS3.ScoreSubmitter.submitScore: gameId, gameVersion, or gameValidationCode member variables were not set before calling this function!");
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_REJECTED));
return;
};
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_WORKING));
_local4 = new URLVariables();
_local4.name = _arg1;
_local4.score = _arg2;
_local4.gameId = gameId;
_local4.gameVersion = gameVersion;
_local4.special = _arg3;
_local4.key = MD5.encrypt(((((((((_arg1 + "|") + _arg2) + "|") + gameId) + "|") + _arg3) + "|") + gameValidationCode));
_local5 = new URLRequest(URL_SUBMITSCORE);
_local5.method = URLRequestMethod.POST;
_local5.data = _local4;
m_UrlLoader = new URLLoader();
m_UrlLoader.addEventListener("complete", onComplete);
m_UrlLoader.addEventListener("ioError", onIoError);
m_UrlLoader.load(_local5);
}
private function onComplete(_arg1:Event):void{
var _local2:URLVariables;
var _local3:*;
_local2 = new URLVariables(m_UrlLoader.data.replace("&", ""));
_local3 = Utilities.trim(_local2.ok);
if (_local3 == 1){
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_SUCCESS));
} else {
if (_local3 == 0){
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_REJECTED));
} else {
if (_local3 == 2){
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_WRONGVERSION));
} else {
dispatchEvent(new ServerResponseEvent(SCORE_RESPONSE, RETURNCODE_INTERNALERROR));
};
};
};
}
public static function loadHighScorePage():void{
Utilities.goToUrl(((URL_VIEWSCORES + "?id=") + gameId));
}
public static function loadUpdatePage(){
Utilities.goToUrl(((URL_VIEWSCORES + "?id=") + gameId));
}
}
}//package CMG_AS3
Section 22 (322 B)
//ServerResponseEvent (CMG_AS3.ServerResponseEvent)
package CMG_AS3 {
import flash.events.*;
public class ServerResponseEvent extends Event {
public var returnCode:uint;
public function ServerResponseEvent(_arg1:String, _arg2:uint){
super(_arg1, false, false);
returnCode = _arg2;
}
}
}//package CMG_AS3
Section 23 (967 B)
//Utilities (CMG_AS3.Utilities)
package CMG_AS3 {
import flash.net.*;
import flash.system.*;
import flash.external.*;
public class Utilities {
public static function trim(_arg1:String):String{
var _local2:*;
var _local3:*;
_local2 = 0;
while (_arg1.charCodeAt(_local2) < 33) {
_local2++;
};
_local3 = (_arg1.length - 1);
while (_arg1.charCodeAt(_local3) < 33) {
_local3--;
};
return (_arg1.substring(_local2, (_local3 + 1)));
}
public static function goToUrl(_arg1:String):void{
var success:Boolean;
var url = _arg1;
success = false;
if (((ExternalInterface.available) && (!((Capabilities.playerType == "External"))))){
try {
ExternalInterface.call("window.open", url, "win", "");
success = true;
} catch(error:Error) {
} catch(error:SecurityError) {
};
};
if (success != true){
navigateToURL(new URLRequest(url), "_BLANK");
};
}
}
}//package CMG_AS3
Section 24 (4.39 KiB) ●
//MochiScores (mochi.MochiScores)
package mochi {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.gameState = "trans";
MochiServices.clip.transTo = "title";
MochiServices.clip.transFrom = "hscores";
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi
Section 25 (11.39 KiB) ● ●
//MochiServices (mochi.MochiServices)
package mochi {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _sendChannel:LocalConnection;
private static var _rcvChannelName:String;
private static var _gatewayURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _startTime:Number;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__mochiservices";
private static var _rcvChannel:LocalConnection;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
public static function get id():String{
return (_id);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function getVersion():String{
return ("1.31");
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
_rcvChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
Security.allowDomain("*");
Security.allowInsecureDomain("*");
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
return (_local2);
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion()});
_rcvChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
_rcvChannel.connect(_rcvChannelName);
trace("connected!");
_connecting = false;
_connected = true;
_listenChannel.close();
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
_rcvChannelName = _arg1;
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
MochiServices.allowDomains(_gatewayURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
_timer = new Timer(1000, 0);
_startTime = getTimer();
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_gatewayURL);
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_rcvChannel = new LocalConnection();
_rcvChannel.allowDomain("*", "localhost");
_rcvChannel.allowInsecureDomain("*", "localhost");
_rcvChannel.client = _clip;
_clip._nextcallbackID = 0;
_clip._callbacks = {};
listen();
return (_clip);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if ((getTimer() - _startTime) > 10000){
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_timer.stop();
};
}
}
}//package mochi
Section 26 (239 B)
//alillmlink (alillmlink)
package {
import flash.display.*;
public dynamic class alillmlink extends MovieClip {
public function alillmlink(){
addFrameScript(180, frame181);
}
function frame181(){
stop();
}
}
}//package
Section 27 (124 B)
//asteroid (asteroid)
package {
import flash.display.*;
public dynamic class asteroid extends MovieClip {
}
}//package
Section 28 (139 B)
//asteroidExplode (asteroidExplode)
package {
import flash.media.*;
public dynamic class asteroidExplode extends Sound {
}
}//package
Section 29 (112 B)
//bomb (bomb)
package {
import flash.display.*;
public dynamic class bomb extends MovieClip {
}
}//package
Section 30 (118 B)
//bullet (bullet)
package {
import flash.display.*;
public dynamic class bullet extends MovieClip {
}
}//package
Section 31 (139 B)
//circleexplode (circleexplode)
package {
import flash.display.*;
public dynamic class circleexplode extends MovieClip {
}
}//package
Section 32 (351 B)
//enterName (enterName)
package {
import flash.display.*;
public dynamic class enterName extends MovieClip {
public var pod:MovieClip;
public var txt:MovieClip;
public var donebtn:MovieClip;
public var selector:MovieClip;
public function enterName(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 33 (124 B)
//explode1 (explode1)
package {
import flash.display.*;
public dynamic class explode1 extends MovieClip {
}
}//package
Section 34 (237 B)
//fireexplode (fireexplode)
package {
import flash.display.*;
public dynamic class fireexplode extends MovieClip {
public function fireexplode(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 35 (773 B)
//FPS (FPS)
package {
import flash.text.*;
import flash.utils.*;
public class FPS extends TextField {
private var startTime:Number;
private var numFrames:int;
private var interval:int;
public function FPS(_arg1:int){
background = true;
autoSize = "left";
selectable = false;
startTime = getTimer();
numFrames = 0;
interval = _arg1;
}
public function calculate():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:String;
if (++numFrames == interval){
_local1 = getTimer();
_local2 = ((_local1 - startTime) / 1000);
_local3 = (numFrames / _local2);
_local4 = _local3.toFixed(2);
text = ("fps: " + _local4);
startTime = _local1;
numFrames = 0;
};
}
}
}//package
Section 36 (293 B)
//gamecomplete (gamecomplete)
package {
import flash.display.*;
public dynamic class gamecomplete extends MovieClip {
public var option2:MovieClip;
public var option1:MovieClip;
public var score:MovieClip;
public var titl:MovieClip;
public var selector:MovieClip;
}
}//package
Section 37 (313 B)
//gameover (gameover)
package {
import flash.display.*;
public dynamic class gameover extends MovieClip {
public var option2:MovieClip;
public var option1:MovieClip;
public var option3:MovieClip;
public var score:MovieClip;
public var titl:MovieClip;
public var selector:MovieClip;
}
}//package
Section 38 (201 B)
//GUI (GUI)
package {
import flash.display.*;
public dynamic class GUI extends MovieClip {
public var lives:MovieClip;
public var score:MovieClip;
public var deploy:MovieClip;
}
}//package
Section 39 (124 B)
//hmissile (hmissile)
package {
import flash.display.*;
public dynamic class hmissile extends MovieClip {
}
}//package
Section 40 (118 B)
//homing (homing)
package {
import flash.display.*;
public dynamic class homing extends MovieClip {
}
}//package
Section 41 (118 B)
//hunter (hunter)
package {
import flash.display.*;
public dynamic class hunter extends MovieClip {
}
}//package
Section 42 (133 B)
//hunterExplode (hunterExplode)
package {
import flash.media.*;
public dynamic class hunterExplode extends Sound {
}
}//package
Section 43 (221 B)
//invader (invader)
package {
import flash.display.*;
public dynamic class invader extends MovieClip {
public function invader(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 44 (124 B)
//invader2 (invader2)
package {
import flash.display.*;
public dynamic class invader2 extends MovieClip {
}
}//package
Section 45 (136 B)
//invaderExplode (invaderExplode)
package {
import flash.media.*;
public dynamic class invaderExplode extends Sound {
}
}//package
Section 46 (328 B)
//launcher (launcher)
package {
import flash.display.*;
public dynamic class launcher extends MovieClip {
public function launcher(){
addFrameScript(30, frame31, 31, frame32, 32, frame33);
}
function frame31(){
stop();
}
function frame33(){
stop();
}
function frame32(){
stop();
}
}
}//package
Section 47 (139 B)
//launcherExplode (launcherExplode)
package {
import flash.media.*;
public dynamic class launcherExplode extends Sound {
}
}//package
Section 48 (133 B)
//launchRockets (launchRockets)
package {
import flash.media.*;
public dynamic class launchRockets extends Sound {
}
}//package
Section 49 (115 B)
//lazer (lazer)
package {
import flash.display.*;
public dynamic class lazer extends MovieClip {
}
}//package
Section 50 (217 B)
//mousep (mousep)
package {
import flash.display.*;
public dynamic class mousep extends MovieClip {
public function mousep(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 51 (189 B)
//multiplier (multiplier)
package {
import flash.display.*;
public dynamic class multiplier extends MovieClip {
public var num1:MovieClip;
public var num2:MovieClip;
}
}//package
Section 52 (121 B)
//musicgame (musicgame)
package {
import flash.media.*;
public dynamic class musicgame extends Sound {
}
}//package
Section 53 (124 B)
//musicmenus (musicmenus)
package {
import flash.media.*;
public dynamic class musicmenus extends Sound {
}
}//package
Section 54 (344 B)
//options (options)
package {
import flash.display.*;
public dynamic class options extends MovieClip {
public var option2:MovieClip;
public var option4:MovieClip;
public var option1:MovieClip;
public var option3:MovieClip;
public var option5:MovieClip;
public var titl:MovieClip;
public var selector:MovieClip;
}
}//package
Section 55 (124 B)
//pausedbg (pausedbg)
package {
import flash.display.*;
public dynamic class pausedbg extends MovieClip {
}
}//package
Section 56 (127 B)
//pausedtxt (pausedtxt)
package {
import flash.display.*;
public dynamic class pausedtxt extends MovieClip {
}
}//package
Section 57 (133 B)
//pickupPowerup (pickupPowerup)
package {
import flash.media.*;
public dynamic class pickupPowerup extends Sound {
}
}//package
Section 58 (127 B)
//pixelpart (pixelpart)
package {
import flash.display.*;
public dynamic class pixelpart extends MovieClip {
}
}//package
Section 59 (339 B)
//player (player)
package {
import flash.display.*;
public dynamic class player extends MovieClip {
public function player(){
addFrameScript(129, frame130, 144, frame145, 159, frame160);
}
function frame160(){
gotoAndStop(130);
}
function frame130(){
stop();
}
function frame145(){
stop();
}
}
}//package
Section 60 (124 B)
//playerDie2 (playerDie2)
package {
import flash.media.*;
public dynamic class playerDie2 extends Sound {
}
}//package
Section 61 (121 B)
//powerup (powerup)
package {
import flash.display.*;
public dynamic class powerup extends MovieClip {
}
}//package
Section 62 (121 B)
//rocketDie (rocketDie)
package {
import flash.media.*;
public dynamic class rocketDie extends Sound {
}
}//package
Section 63 (118 B)
//SCORES (SCORES)
package {
import flash.display.*;
public dynamic class SCORES extends MovieClip {
}
}//package
Section 64 (124 B)
//shrapnal (shrapnal)
package {
import flash.display.*;
public dynamic class shrapnal extends MovieClip {
}
}//package
Section 65 (115 B)
//spike (spike)
package {
import flash.display.*;
public dynamic class spike extends MovieClip {
}
}//package
Section 66 (335 B)
//spiker (spiker)
package {
import flash.display.*;
public dynamic class spiker extends MovieClip {
public var spike7:spike;
public var spike2:spike;
public var spike1:spike;
public var spike3:spike;
public var spike4:spike;
public var spike5:spike;
public var spike0:spike;
public var spike6:spike;
}
}//package
Section 67 (133 B)
//spikerExplode (spikerExplode)
package {
import flash.media.*;
public dynamic class spikerExplode extends Sound {
}
}//package
Section 68 (121 B)
//spinner (spinner)
package {
import flash.display.*;
public dynamic class spinner extends MovieClip {
}
}//package
Section 69 (139 B)
//spinnerbullet (spinnerbullet)
package {
import flash.display.*;
public dynamic class spinnerbullet extends MovieClip {
}
}//package
Section 70 (142 B)
//spinnerexplode (spinnerexplode)
package {
import flash.display.*;
public dynamic class spinnerexplode extends MovieClip {
}
}//package
Section 71 (139 B)
//spinnerExplode2 (spinnerExplode2)
package {
import flash.media.*;
public dynamic class spinnerExplode2 extends Sound {
}
}//package
Section 72 (130 B)
//squarepart (squarepart)
package {
import flash.display.*;
public dynamic class squarepart extends MovieClip {
}
}//package
Section 73 (124 B)
//starpart (starpart)
package {
import flash.display.*;
public dynamic class starpart extends MovieClip {
}
}//package
Section 74 (124 B)
//tinypart (tinypart)
package {
import flash.display.*;
public dynamic class tinypart extends MovieClip {
}
}//package
Section 75 (124 B)
//titlebit (titlebit)
package {
import flash.display.*;
public dynamic class titlebit extends MovieClip {
}
}//package
Section 76 (995 B)
//titles (titles)
package {
import flash.display.*;
public dynamic class titles extends MovieClip {
public var num10:MovieClip;
public var num11:MovieClip;
public var num12:MovieClip;
public var l1:MovieClip;
public var l4:MovieClip;
public var l5:MovieClip;
public var l8:MovieClip;
public var l3:MovieClip;
public var option1:MovieClip;
public var option4:MovieClip;
public var num1:MovieClip;
public var num3:MovieClip;
public var option6:MovieClip;
public var num7:MovieClip;
public var num4:MovieClip;
public var num5:MovieClip;
public var num6:MovieClip;
public var num2:MovieClip;
public var l2:MovieClip;
public var l7:MovieClip;
public var option3:MovieClip;
public var option5:MovieClip;
public var num8:MovieClip;
public var l9:MovieClip;
public var num9:MovieClip;
public var l10:MovieClip;
public var option2:MovieClip;
public var l6:MovieClip;
public var titl:MovieClip;
public var selector:MovieClip;
}
}//package
Section 77 (147 B)
//turret (turret)
package {
import flash.display.*;
public dynamic class turret extends MovieClip {
public var gun:MovieClip;
}
}//package
Section 78 (157 B)
//tutorial (tutorial)
package {
import flash.display.*;
public dynamic class tutorial extends MovieClip {
public var tuttext:MovieClip;
}
}//package
Section 79 (123 B)
//usePowerup (usePowerup)
package {
import flash.media.*;
public dynamic class usePowerup extends Sound {
}
}//package