Frame 1
stop();
_global.myMusicPlayer = new Music();
_global.SoundManager = new SoundPlayer();
_global.musicOn = true;
_global.soundOn = true;
Instance of Symbol 53 MovieClip "loadBubble" in Frame 1
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 9;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 29)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
Instance of Symbol 56 MovieClip in Frame 1
onClipEvent (load) {
myFlag = 0;
Counter = -1;
totalFileSize = _root.getBytesTotal();
startBytes = _root.getBytesLoaded();
_root.continueButton._visible = false;
}
onClipEvent (enterFrame) {
if (Counter == -1) {
bytesLoaded = _root.getBytesLoaded();
amountLoaded = bytesLoaded / totalFileSize;
myPercentLoaded = int(100 * amountLoaded);
_root.loadBubble.loadClip.load_txt.text = myPercentLoaded + "%";
if ((amountLoaded >= 1) && (myFlag == 0)) {
myFlag = 1;
Counter = 30;
}
} else if (Counter == 0) {
okToPlay = true;
siteURL = "http://www.herointeractive.com";
siteURL2 = "http://herointeractive.com";
if ((_url.substr(0, siteURL.length) == siteURL) || (_url.substr(0, siteURL2.length) == siteURL2)) {
okToPlay = true;
}
if (okToPlay) {
_root.gotoAndPlay("buffer_sound");
}
} else {
Counter--;
}
}
Frame 2
stop();
Instance of Symbol 56 MovieClip in Frame 2
onClipEvent (load) {
if (_global.musicOn == true) {
_global.myMusicPlayer.SetTrack("title");
_global.myMusicPlayer.SetMaxVolume(100);
_global.myMusicPlayer.PlayWithCrossFade(3);
}
}
onClipEvent (enterFrame) {
_global.myMusicPlayer.RunPlayer();
}
Frame 5
function StartGame() {
gotoAndStop (15);
}
stop();
Frame 15
function GameSetup() {
game.StartGame();
}
function Mediator() {
if (gameCreated) {
game.RunGame();
} else if (game.IsWorldCreated() == true) {
gameCreated = true;
trace("game world constructed");
trace(game.GetUnitsCreated() + " Enemies Created!");
_root.openMask.gotoAndPlay(2);
_root.openMask.enemies_txt.text = game.GetUnitsCreated() + " Enemies Created!";
} else if (framesNum == 0) {
game.CreateWorldRow();
_root.openMask.created_txt.text = game.PercentBuilt() + "%";
framesNum = framesToCatchUp;
} else {
framesNum--;
}
}
function DropBubbles(numBubbles, origin, givenPower) {
game.DropPickupBubbles(numBubbles, origin, givenPower);
}
function EnemyShoot(startPos, startAngle, mySpeed, mySize, myDamage) {
game.EnemyFire(startPos, startAngle, mySpeed, mySize, myDamage);
}
function ReportDeath(name) {
game.EnemyDead(name);
}
function SpawnUnit(enemyType, startPosition, OriginUnit) {
return(game.CreateNewUnit(enemyType, startPosition, OriginUnit));
}
function ReportAvatarDamage(numDamage) {
game.AvatarHit(numDamage);
}
function DeleteOpenMask() {
_root.removeMovieClip("openMask");
}
stop();
var game = new BubbleTanksGame();
var gameCreated = false;
var framesToCatchUp = 1;
var framesNum = 0;
Instance of Symbol 56 MovieClip in Frame 15
onClipEvent (load) {
_root.GameSetup();
if (_global.musicOn == true) {
_global.myMusicPlayer.SetTrack("in_game");
_global.myMusicPlayer.PlayWithCrossFade(3);
}
}
onClipEvent (enterFrame) {
_root.Mediator();
_global.myMusicPlayer.RunPlayer();
}
Frame 16
gotoAndPlay (30);
Frame 30
gotoAndPlay ("intro");
Symbol 2 MovieClip [bullet] Frame 1
#initclip 43
Object.registerClass("bullet", Bullet);
#endinitclip
Symbol 4 MovieClip Frame 1
var r = Math.round(Math.random() * 10);
gotoAndPlay(r);
Symbol 5 MovieClip [Enemy_1] Frame 1
#initclip 26
Object.registerClass("Enemy_1", Enemy_1);
#endinitclip
stop();
Symbol 5 MovieClip [Enemy_1] Frame 2
stop();
Symbol 7 MovieClip [pickup_bubble] Frame 1
#initclip 27
Object.registerClass("pickup_bubble", PickupBubble);
#endinitclip
var r = Math.round(Math.random() * 10);
gotoAndPlay(r);
Symbol 13 MovieClip Frame 1
var r = Math.round(Math.random() * 10);
gotoAndPlay(r);
Symbol 17 MovieClip [Enemy_2] Frame 1
#initclip 28
Object.registerClass("Enemy_2", Enemy_2);
#endinitclip
stop();
Symbol 18 MovieClip [Enemy_4] Frame 1
#initclip 29
Object.registerClass("Enemy_4", Enemy_4);
#endinitclip
Symbol 20 MovieClip [Enemy_3] Frame 1
#initclip 30
Object.registerClass("Enemy_3", Enemy_3);
#endinitclip
stop();
Symbol 21 MovieClip [Enemy_5] Frame 1
#initclip 31
Object.registerClass("Enemy_5", Enemy_5);
#endinitclip
stop();
Symbol 21 MovieClip [Enemy_5] Frame 10
stop();
Symbol 23 MovieClip Frame 1
var r = Math.round(Math.random() * 10);
gotoAndPlay(r);
Symbol 24 MovieClip [Enemy_6] Frame 1
#initclip 32
Object.registerClass("Enemy_6", Enemy_6);
#endinitclip
stop();
Symbol 25 MovieClip [Enemy_7] Frame 1
#initclip 33
Object.registerClass("Enemy_7", Enemy_7);
#endinitclip
stop();
Symbol 25 MovieClip [Enemy_7] Frame 15
stop();
Symbol 25 MovieClip [Enemy_7] Frame 20
stop();
Symbol 26 MovieClip [Enemy_8] Frame 1
#initclip 34
Object.registerClass("Enemy_8", Enemy_8);
#endinitclip
stop();
Symbol 29 MovieClip [component_bubble_red] Frame 1
#initclip 35
Object.registerClass("component_bubble_red", Bullet);
#endinitclip
var r = Math.round(Math.random() * 10);
gotoAndPlay(r);
Symbol 29 MovieClip [component_bubble_red] Frame 40
gotoAndPlay (1);
Symbol 29 MovieClip [component_bubble_red] Frame 41
this._rotation = Math.round(Math.random() * 360) - 180;
Symbol 29 MovieClip [component_bubble_red] Frame 46
stop();
Symbol 31 MovieClip [Enemy_Seeker] Frame 1
#initclip 36
Object.registerClass("Enemy_Seeker", Enemy_Seeker);
#endinitclip
stop();
Symbol 31 MovieClip [Enemy_Seeker] Frame 10
this.KillMe();
Symbol 33 MovieClip [Enemy_9] Frame 1
#initclip 37
Object.registerClass("Enemy_9", Enemy_9);
#endinitclip
stop();
Symbol 33 MovieClip [Enemy_9] Frame 40
stop();
Symbol 34 MovieClip [Enemy_10] Frame 1
#initclip 38
Object.registerClass("Enemy_10", Enemy_10);
#endinitclip
Symbol 35 MovieClip [Enemy_11] Frame 1
#initclip 39
Object.registerClass("Enemy_11", Enemy_11);
#endinitclip
stop();
Symbol 35 MovieClip [Enemy_11] Frame 125
stop();
Symbol 38 MovieClip [Enemy_12] Frame 1
#initclip 40
Object.registerClass("Enemy_12", Enemy_12);
#endinitclip
stop();
Symbol 38 MovieClip [Enemy_12] Frame 120
stop();
Symbol 40 MovieClip Frame 1
var r = Math.round(Math.random() * 10);
gotoAndPlay(r);
Symbol 41 MovieClip [Enemy_13] Frame 1
#initclip 41
Object.registerClass("Enemy_13", Enemy_13);
#endinitclip
stop();
Symbol 41 MovieClip [Enemy_13] Frame 40
stop();
Symbol 42 MovieClip [Enemy_14] Frame 1
#initclip 42
Object.registerClass("Enemy_14", Enemy_14);
#endinitclip
stop();
Symbol 42 MovieClip [Enemy_14] Frame 400
stop();
Symbol 53 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 53 MovieClip Frame 1
/* no clip actions */
Symbol 53 MovieClip Frame 7
stop();
Symbol 154 MovieClip [__Packages.SoundPlayer] Frame 0
class SoundPlayer
{
var channelsAvailable, channel1, channel2, channel3, channel4, externalSoundVolume;
function SoundPlayer () {
channelsAvailable = new Array(true, true, true, true);
channel1 = new Sound();
channel2 = new Sound();
channel3 = new Sound();
channel4 = new Sound();
externalSoundVolume = 100;
}
function CleanSounds(intIndex) {
channelsAvailable[intIndex] = true;
}
function PlaySound(linkIdentifier) {
if (_global.soundOn == true) {
var thisRef = this;
if (channelsAvailable[0] == true) {
channelsAvailable[0] = false;
delete channel1;
channel1 = new Sound();
channel1.attachSound(linkIdentifier);
channel1.setVolume(100);
channel1.start(0, 0);
channel1.onSoundComplete = function () {
thisRef.CleanSounds(0);
};
} else if (channelsAvailable[1] == true) {
channelsAvailable[1] = false;
delete channel2;
channel2 = new Sound();
channel2.attachSound(linkIdentifier);
channel2.setVolume(100);
channel2.start(0, 0);
channel2.onSoundComplete = function () {
thisRef.CleanSounds(1);
};
} else if (channelsAvailable[2] == true) {
channelsAvailable[2] = false;
delete channel3;
channel3 = new Sound();
channel3.attachSound(linkIdentifier);
channel3.setVolume(100);
channel3.start(0, 0);
channel3.onSoundComplete = function () {
thisRef.CleanSounds(2);
};
} else if (channelsAvailable[3] == true) {
channelsAvailable[3] = false;
delete channel1;
channel4 = new Sound();
channel4.attachSound(linkIdentifier);
channel4.setVolume(100);
channel4.start(0, 0);
channel4.onSoundComplete = function () {
thisRef.CleanSounds(3);
};
} else {
channelsAvailable[0] = false;
delete channel1;
channel1 = new Sound();
channel1.attachSound(linkIdentifier);
channel1.setVolume(100);
channel1.start(0, 0);
channel1.onSoundComplete = function () {
thisRef.CleanSounds(0);
};
}
}
}
function PlayExternalSound(urlPath) {
var thisRef = this;
if (channelsAvailable[0] == true) {
channelsAvailable[0] = false;
delete channel1;
channel1 = new Sound();
channel1.loadSound(urlPath, false);
channel1.setVolume(externalSoundVolume);
channel1.onLoad = function (loadedOK) {
if (loadedOK) {
this.start();
}
};
channel1.onSoundComplete = function () {
thisRef.CleanSounds(0);
};
} else if (channelsAvailable[1] == true) {
channelsAvailable[1] = false;
delete channel2;
channel2 = new Sound();
channel2.loadSound(urlPath, false);
channel2.setVolume(externalSoundVolume);
channel2.onLoad = function (loadedOK) {
if (loadedOK) {
this.start();
}
};
channel2.onSoundComplete = function () {
thisRef.CleanSounds(1);
};
} else if (channelsAvailable[2] == true) {
channelsAvailable[2] = false;
delete channel3;
channel3 = new Sound();
channel3.loadSound(urlPath, false);
channel3.setVolume(externalSoundVolume);
channel3.onLoad = function (loadedOK) {
if (loadedOK) {
this.start();
}
};
channel3.onSoundComplete = function () {
thisRef.CleanSounds(2);
};
} else if (channelsAvailable[3] == true) {
channelsAvailable[3] = false;
delete channel4;
channel4 = new Sound();
channel4.loadSound(urlPath, false);
channel4.setVolume(externalSoundVolume);
channel4.onLoad = function (loadedOK) {
if (loadedOK) {
this.start();
}
};
channel4.onSoundComplete = function () {
thisRef.CleanSounds(3);
};
} else {
channelsAvailable[0] = false;
delete channel1;
channel1 = new Sound();
channel1.loadSound(urlPath, false);
channel1.setVolume(externalSoundVolume);
channel1.onLoad = function (loadedOK) {
if (loadedOK) {
this.start();
}
};
channel1.onSoundComplete = function () {
thisRef.CleanSounds(0);
};
}
}
}
Symbol 155 MovieClip [__Packages.Music] Frame 0
class Music
{
var mySound, volume, currentTrack, inCrossfade, state, changeSongs, maxVolume, targetVolume, volumeSpeed;
function Music () {
mySound = new Sound();
volume = 100;
currentTrack = "";
inCrossfade = false;
state = false;
changeSongs = true;
maxVolume = 100;
}
function SetMaxVolume(vol) {
maxVolume = vol;
}
function SetTrack(setMusic) {
if (setMusic == currentTrack) {
changeSongs = false;
} else {
changeSongs = true;
currentTrack = setMusic;
}
}
function Play() {
mySound.stop();
mySound.attachSound(currentTrack);
volume = maxVolume;
mySound.setVolume(volume);
mySound.start(0, 2000);
state = true;
}
function Stop() {
mySound.stop();
state = false;
}
function PlayWithCrossFade(secondDuration) {
if (changeSongs == true) {
if (state == true) {
inCrossfade = true;
targetVolume = 0;
var _local2 = secondDuration * 30;
volumeSpeed = (targetVolume - volume) / (_local2 / 2);
} else {
mySound.stop();
mySound.attachSound(currentTrack);
mySound.start(0, 2000);
state = true;
inCrossfade = false;
targetVolume = maxVolume;
volume = 0;
mySound.setVolume(0);
var _local2 = secondDuration * 30;
volumeSpeed = (targetVolume - volume) / _local2;
}
}
}
function RunPlayer() {
if (targetVolume != volume) {
var _local2;
_local2 = volume + volumeSpeed;
if ((volumeSpeed < 0) && (_local2 < 0)) {
_local2 = 0;
} else if ((volumeSpeed > 0) && (_local2 > targetVolume)) {
_local2 = targetVolume;
}
volume = _local2;
mySound.setVolume(_local2);
}
if (inCrossfade == true) {
if (volume <= 0) {
volumeSpeed = volumeSpeed * -1;
inCrossfade = false;
targetVolume = maxVolume;
mySound.stop();
mySound.attachSound(currentTrack);
mySound.setVolume(0);
mySound.start(0, 2000);
state = true;
}
}
}
}
Symbol 156 MovieClip [__Packages.Enemy_1] Frame 0
class Enemy_1 extends MovieClip
{
var haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip;
function Enemy_1 () {
super();
haltMovie = false;
safetyTurn = false;
numLife = 2;
gotoAndPlay(2);
numSpeed = 2;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(2, _local3, 8);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
gotoAndPlay(numLife);
_root.DropBubbles(1, _local3, 1);
}
return(_local4);
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * 100) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * 100) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 157 MovieClip [__Packages.Vector] Frame 0
class Vector
{
var _x, _y;
function Vector () {
_x = 0;
_y = 0;
}
}
Symbol 158 MovieClip [__Packages.PickupBubble] Frame 0
class PickupBubble extends MovieClip
{
var moveX, moveY, _x, _y, removeMovieClip;
function PickupBubble () {
super();
moveX = 0;
moveY = 0;
}
function SetMovement(myX, myY) {
moveX = myX;
moveY = myY;
}
function onEnterFrame() {
if ((moveX != 0) || (moveY != 0)) {
_x = _x + moveX;
_y = _y + moveY;
moveX = 0.9 * moveX;
moveY = 0.9 * moveY;
if (Math.abs(moveX) < 0.3) {
moveX = 0;
}
if (Math.abs(moveY) < 0.3) {
moveY = 0;
}
if (GetDistance() > (_root.bg.inside._width / 2)) {
removeMovieClip();
}
}
}
function DetermineRandomMovement(myPower) {
var _local4 = Math.round((Math.random() * myPower) * 2) - myPower;
var _local3 = Math.round((Math.random() * myPower) * 2) - myPower;
moveX = _local4;
moveY = _local3;
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
}
Symbol 159 MovieClip [__Packages.Enemy_2] Frame 0
class Enemy_2 extends MovieClip
{
var guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip, gotoAndStop, _width;
function Enemy_2 () {
super();
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 5;
gotoAndPlay(numLife);
numSpeed = 3;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:80, fireTimerMin:40, counter:60, speed:6, size:100, damage:1});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(2, _local3, 8);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
trace(numLife);
gotoAndStop(numLife);
_root.DropBubbles(1, _local3, 1);
}
return(_local4);
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + 50)) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + 50)) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 160 MovieClip [__Packages.Enemy_4] Frame 0
class Enemy_4 extends MovieClip
{
var haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip;
function Enemy_4 () {
super();
haltMovie = false;
safetyTurn = false;
numLife = 1;
gotoAndPlay(2);
numSpeed = 0.5;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(1, _local3, 3);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
gotoAndPlay(numLife);
_root.DropBubbles(1, _local3, 1);
}
return(_local4);
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * 100) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * 100) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 161 MovieClip [__Packages.Enemy_3] Frame 0
class Enemy_3 extends MovieClip
{
var guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip, gotoAndStop, _width;
function Enemy_3 () {
super();
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 20;
gotoAndPlay(numLife);
numSpeed = 1;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:120, fireTimerMin:80, counter:100, speed:3, size:300, damage:4});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(2, _local3, 8);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
trace(numLife);
gotoAndStop(numLife);
_root.DropBubbles(1, _local3, 1);
}
return(_local4);
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + 50)) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + 50)) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 162 MovieClip [__Packages.Enemy_5] Frame 0
class Enemy_5 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip, gotoAndStop, _width;
function Enemy_5 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 10;
gotoAndPlay(numLife);
numSpeed = 3;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:60, fireTimerMin:40, counter:60, speed:7, size:100, damage:1});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(6, _local3, 12);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
if (numLife < 4) {
if (gunFlagOne == true) {
numSpeed = 5;
RemoveGun("gun_1");
gunFlagOne = false;
}
}
trace(numLife);
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 163 MovieClip [__Packages.Enemy_6] Frame 0
class Enemy_6 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip, gotoAndStop, _width;
function Enemy_6 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 25;
gotoAndPlay(numLife);
numSpeed = 1;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:60, fireTimerMin:40, counter:60, speed:5, size:120, damage:1});
guns.push({name:"gun_2", type:1, fireTimerMax:60, fireTimerMin:40, counter:60, speed:5, size:120, damage:1});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(8, _local3, 16);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
if (numLife < 7) {
if (gunFlagOne == true) {
RemoveGun("gun_1");
gunFlagOne = false;
}
}
trace(numLife);
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 164 MovieClip [__Packages.Enemy_7] Frame 0
class Enemy_7 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _x, _y, removeMovieClip, gotoAndStop, _width;
function Enemy_7 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 20;
gotoAndPlay(numLife);
numSpeed = 3;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:60, fireTimerMin:40, counter:60, speed:5, size:100, damage:2});
guns.push({name:"gun_2", type:1, fireTimerMax:60, fireTimerMin:40, counter:80, speed:5, size:100, damage:2});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local5 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local4 = new Vector();
_local4._x = _x;
_local4._y = _y;
_root.DropBubbles(3, _local4, 6);
_local5 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
if (numLife < 20) {
if (gunFlagOne == true) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
RemoveGun("gun_2");
_root.SpawnUnit("Enemy_8", _local3, _name);
gunFlagOne = false;
}
}
gotoAndStop(numLife);
}
return(_local5);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 165 MovieClip [__Packages.Enemy_8] Frame 0
class Enemy_8 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip, gotoAndStop, _width;
function Enemy_8 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 19;
gotoAndPlay(numLife);
numSpeed = 3;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:60, fireTimerMin:40, counter:60, speed:5, size:100, damage:2});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(3, _local3, 6);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 166 MovieClip [__Packages.Bullet] Frame 0
class Bullet extends MovieClip
{
var moveX, moveY, _damage, _holdMovement, _x, _y, removeCallback, _name, removeMovieClip;
function Bullet () {
super();
moveX = 0;
moveY = 0;
_damage = 1;
_holdMovement = false;
}
function SetMovement(myX, myY) {
moveX = myX;
moveY = myY;
}
function onEnterFrame() {
if (_holdMovement == false) {
_x = _x + moveX;
_y = _y + moveY;
if (GetDistance() > (_root.bg.inside._width / 2)) {
removeCallback(_name);
removeMovieClip();
}
}
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
}
Symbol 167 MovieClip [__Packages.Enemy_Seeker] Frame 0
class Enemy_Seeker extends MovieClip
{
var gunFlagOne, flagExplode, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _x, _y, _name, removeMovieClip, gotoAndStop, _width;
function Enemy_Seeker () {
super();
gunFlagOne = true;
flagExplode = false;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 1;
gotoAndPlay(numLife);
numSpeed = 2.5;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
}
function onEnterFrame() {
if (flagExplode == false) {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local5 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local5 == true) && (safetyTurn == false))) {
if (_local5 == true) {
var _local4 = GetAnglePos();
if (_local4 < 0) {
if (_local4 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local4 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else {
var _local3 = new Vector();
_local3._x = _root.avatar._x - _x;
_local3._y = _root.avatar._y - _y;
var _local6 = Math.atan2(_local3._y, _local3._x);
var _local7 = (360 * _local6) / (Math.PI*2);
_rotation = _local7;
}
if (GetDistance2Avatar() <= 35) {
gotoAndPlay(2);
flagExplode = true;
}
}
}
function KillMe() {
_root.ReportAvatarDamage(8);
_root.ReportDeath(_name);
removeMovieClip();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local3 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
_local3 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
gotoAndStop(numLife);
}
return(_local3);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function GetDistance2Avatar() {
var _local4 = _x - _root.avatar._x;
var _local3 = _y - _root.avatar._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 168 MovieClip [__Packages.Enemy_9] Frame 0
class Enemy_9 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _x, _y, removeMovieClip, gotoAndStop, _width;
function Enemy_9 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 40;
gotoAndPlay(numLife);
numSpeed = 2;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:2, fireTimerMax:140, fireTimerMin:100, counter:100, speed:5, size:100, damage:1});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(2, _local3, 6);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(1, _local3, 4);
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 169 MovieClip [__Packages.Enemy_10] Frame 0
class Enemy_10 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _x, _y, removeMovieClip, gotoAndStop, _width;
function Enemy_10 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 1;
gotoAndPlay(numLife);
numSpeed = 0.5;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local5 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local4 = new Vector();
_local4._x = _x;
_local4._y = _y;
var _local3 = 0;
while (_local3 < 10) {
_root.SpawnUnit("Enemy_1", _local4, _name);
_local3++;
}
_local5 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
var _local4 = new Vector();
_local4._x = _x;
_local4._y = _y;
_root.DropBubbles(1, _local4, 4);
gotoAndStop(numLife);
}
return(_local5);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 170 MovieClip [__Packages.Enemy_11] Frame 0
class Enemy_11 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _x, _y, removeMovieClip, gotoAndStop, _width;
function Enemy_11 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 125;
gotoAndPlay(numLife);
numSpeed = 1.5;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:60, fireTimerMin:40, counter:50, speed:6, size:100, damage:3});
guns.push({name:"gun_2", type:1, fireTimerMax:140, fireTimerMin:100, counter:120, speed:3, size:300, damage:7});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(14, _local3, 16);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
if (numLife < 70) {
if (gunFlagOne == true) {
numSpeed = 0.5;
RemoveGun("gun_1");
gunFlagOne = false;
}
}
trace(numLife);
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 171 MovieClip [__Packages.Enemy_12] Frame 0
class Enemy_12 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _x, _y, removeMovieClip, gotoAndStop, _width;
function Enemy_12 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 120;
gotoAndPlay(numLife);
numSpeed = 0.25;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:3, fireTimerMax:400, fireTimerMin:600, counter:60, speed:6, size:100, damage:1});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 0.25);
numAmountToTurn = 0.25 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 0.25);
numAmountToTurn = 0.25 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 3) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_2", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(4, _local3, 8);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 172 MovieClip [__Packages.Enemy_13] Frame 0
class Enemy_13 extends MovieClip
{
var gunFlagOne, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _x, _y, removeMovieClip, gotoAndStop, _width;
function Enemy_13 () {
super();
gunFlagOne = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 40;
gotoAndPlay(numLife);
numSpeed = 3;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:80, fireTimerMin:40, counter:60, speed:6, size:100, damage:4});
guns.push({name:"gun_2", type:4, fireTimerMax:140, fireTimerMin:100, counter:120, speed:3, size:45, damage:6});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 2);
numAmountToTurn = 2 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 2);
numAmountToTurn = 2 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
ObjRef.localToGlobal(point);
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 3) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_2", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 4) {
if (GetDistance2Avatar() <= guns[i].size) {
_global.SoundManager.PlaySound("enemy_contact");
_root.ReportAvatarDamage(1);
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(4, _local3, 8);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function GetDistance2Avatar() {
var _local4 = _x - _root.avatar._x;
var _local3 = _y - _root.avatar._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 173 MovieClip [__Packages.Enemy_14] Frame 0
class Enemy_14 extends MovieClip
{
var gunFlagOne, gunFlagTwo, guns, haltMovie, safetyTurn, numLife, gotoAndPlay, numSpeed, numFramesToTurn, numAmountToTurn, minFramesToHoldTurning, numLastAngle, _rotation, _name, _y, _x, removeMovieClip, gotoAndStop, _width;
function Enemy_14 () {
super();
gunFlagOne = true;
gunFlagTwo = true;
guns = new Array();
haltMovie = false;
safetyTurn = false;
numLife = 400;
gotoAndPlay(numLife);
numSpeed = 0.25;
numFramesToTurn = 0;
numAmountToTurn = 0;
minFramesToHoldTurning = 0;
guns.push({name:"gun_1", type:1, fireTimerMax:80, fireTimerMin:40, counter:60, speed:6, size:100, damage:4});
guns.push({name:"gun_2", type:1, fireTimerMax:80, fireTimerMin:40, counter:60, speed:6, size:100, damage:4});
guns.push({name:"gun_3", type:2, fireTimerMax:140, fireTimerMin:80, counter:120, speed:3, size:45, damage:4});
guns.push({name:"gun_4", type:2, fireTimerMax:140, fireTimerMin:80, counter:100, speed:3, size:45, damage:4});
guns.push({name:"gun_5", type:1, fireTimerMax:120, fireTimerMin:80, counter:50, speed:5, size:400, damage:8});
guns.push({name:"gun_6", type:3, fireTimerMax:300, fireTimerMin:200, counter:20, speed:3, size:45, damage:4});
}
function onEnterFrame() {
if (haltMovie == false) {
numLastAngle = GetAnglePos();
MoveMe();
var _local4 = AboutToExit();
if ((numFramesToTurn == 0) || ((_local4 == true) && (safetyTurn == false))) {
if (_local4 == true) {
var _local3 = GetAnglePos();
if (_local3 < 0) {
if (_local3 < numLastAngle) {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
} else {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
}
} else if (_local3 > numLastAngle) {
numAmountToTurn = Math.round(Math.random() * 90) + 90;
} else {
numAmountToTurn = Math.round(Math.random() * -90) - 90;
}
numFramesToTurn = Math.round(Math.abs(numAmountToTurn) / 0.25);
numAmountToTurn = 0.25 * (numAmountToTurn / Math.abs(numAmountToTurn));
minFramesToHoldTurning = 90;
safetyTurn = true;
}
} else {
numFramesToTurn--;
_rotation = _rotation + numAmountToTurn;
}
}
if (minFramesToHoldTurning > 0) {
minFramesToHoldTurning--;
} else if (numFramesToTurn == 0) {
var _local2 = Math.round(Math.random() * 1000);
if (_local2 < 20) {
_local2 = Math.round(Math.random() * 200) - 100;
numFramesToTurn = Math.round(Math.abs(_local2) / 0.25);
numAmountToTurn = 0.25 * (_local2 / Math.abs(_local2));
safetyTurn = false;
}
}
OperateWeapons();
}
function OperateWeapons() {
var i = 0;
while (i < guns.length) {
if (guns[i].type == 1) {
var ObjRef = eval ("this." + guns[i].name);
var point = {x:ObjRef._x, y:ObjRef._y};
_root[_name].localToGlobal(point);
var startPoint = {x:_x, y:_y};
startPoint.x = startPoint.x + ObjRef._x;
startPoint.y = startPoint.y + ObjRef._y;
var vecDirection = new Vector();
vecDirection._x = _root.avatar._x - point.x;
vecDirection._y = _root.avatar._y - point.y;
var myRadians = Math.atan2(vecDirection._y, vecDirection._x);
var myDegrees = ((360 * myRadians) / (Math.PI*2));
ObjRef._rotation = myDegrees - _rotation;
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.EnemyShoot(posVector, ObjRef._rotation + _rotation, guns[i].speed, guns[i].size, guns[i].damage);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 2) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_Seeker", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 3) {
if (guns[i].counter < 1) {
var posVector = new Vector();
var ObjRefTwo = eval (("this." + guns[i].name) + ".emitter");
var pointTwo = {x:ObjRefTwo._x, y:ObjRefTwo._y};
ObjRefTwo.localToGlobal(pointTwo);
posVector._x = pointTwo.x;
posVector._y = pointTwo.y;
_root.SpawnUnit("Enemy_2", posVector, _name);
guns[i].counter = Math.round(Math.random() * (guns[i].fireTimerMax - guns[i].fireTimerMin)) + guns[i].fireTimerMin;
} else {
guns[i].counter--;
}
} else if (guns[i].type == 4) {
if (GetDistance2Avatar() <= guns[i].size) {
_root.ReportAvatarDamage(1);
}
}
i++;
}
}
function ReceiveDamage(amountDamage) {
var _local4 = false;
numLife = numLife - amountDamage;
if (numLife < 1) {
var _local3 = new Vector();
_local3._x = _x;
_local3._y = _y;
_root.DropBubbles(50, _local3, 20);
_local4 = true;
_root.ReportDeath(_name);
removeMovieClip();
} else {
if (numLife < 86) {
if (gunFlagTwo == true) {
RemoveGun("gun_2");
gunFlagTwo = false;
}
} else if (numLife < 240) {
if (gunFlagOne == true) {
RemoveGun("gun_1");
gunFlagOne = false;
}
}
gotoAndStop(numLife);
}
return(_local4);
}
function RemoveGun(strName) {
var _local2 = 0;
while (_local2 < guns.length) {
if (strName == guns[_local2].name) {
guns.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveMe() {
var _local2 = new Vector();
_local2._x = (Math.cos((Math.PI * _rotation) / 180) * numSpeed) + _x;
_local2._y = (Math.sin((Math.PI * _rotation) / 180) * numSpeed) + _y;
_x = _local2._x;
_y = _local2._y;
}
function GetAnglePos() {
var _local3 = new Vector();
_local3._x = _x - _root.bg._x;
_local3._y = _y - _root.bg._y;
var _local4 = Math.atan2(_local3._y, _local3._x);
var _local5 = (360 * _local4) / (Math.PI*2);
return(_local5);
}
function GetDistance() {
var _local4 = _x - _root.bg._x;
var _local3 = _y - _root.bg._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function GetDistance2Avatar() {
var _local4 = _x - _root.avatar._x;
var _local3 = _y - _root.avatar._y;
return(Math.sqrt((_local4 * _local4) + (_local3 * _local3)));
}
function AboutToExit() {
var _local5 = false;
var _local6 = (Math.cos((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _x;
var _local7 = (Math.sin((Math.PI * _rotation) / 180) * (_width + (30 * numSpeed))) + _y;
var _local4 = _local6 - _root.bg._x;
var _local3 = _local7 - _root.bg._y;
if (Math.sqrt((_local4 * _local4) + (_local3 * _local3)) > (_root.bg.inside._width / 2)) {
_local5 = true;
}
return(_local5);
}
}
Symbol 174 MovieClip [__Packages.BubbleTanksGame] Frame 0
class BubbleTanksGame
{
var blnWorldCreated, worldCreateRow, worldCreateColumn, prevOutside, secondBulletCounter, numJumps, avatarLife, runOnce, transitionState, mouseListener, vecMomentum, numAvatarMaxVelocity, numSensitivity, numResistence, arrBullets, arrFloatingBubbles, arrDebris, arrCleanup, deltaList, numBulletDepth, enemyDepth, spawnedEnemyDepth, arrFloatingBubblesDepth, worldX, worldY, numRows, numColumns, backgroundDepth, arrBackgrounds, numEnemiesCreated, world, tempRow, intTotalFrames, easeFrames, dblDestX, dblDestY, deltaX, deltaY;
function BubbleTanksGame () {
blnWorldCreated = false;
worldCreateRow = 0;
worldCreateColumn = 0;
prevOutside = false;
secondBulletCounter = 0;
numJumps = 0;
avatarLife = 1;
_root.openMask.stop();
_root.openMask.swapDepths(1000001);
_root.overlay.swapDepths(1000000);
_root.avatar.swapDepths(510);
_root.bg.swapDepths(500);
_root.bubbleSplit.swapDepths(505);
_root.miniBubble.swapDepths(508);
_root.bubbleMask.swapDepths(509);
_root.miniBubble.setMask("bubbleMask");
runOnce = false;
transitionState = 0;
var thisRef = this;
mouseListener = new Object();
mouseListener.onMouseDown = function () {
thisRef.ShootGun();
};
Mouse.addListener(mouseListener);
vecMomentum = new Vector();
numAvatarMaxVelocity = 7;
numSensitivity = 0.4;
numResistence = 0.08;
arrBullets = new Array();
arrFloatingBubbles = new Array();
arrDebris = new Array();
arrCleanup = new Array();
deltaList = new Array();
numBulletDepth = 100000 /* 0x0186A0 */;
enemyDepth = 600;
spawnedEnemyDepth = 20001;
arrFloatingBubblesDepth = 200;
worldX = 45;
worldY = 45;
numRows = 91;
numColumns = 91;
CreateWorld();
backgroundDepth = 100;
arrBackgrounds = new Array();
arrBackgrounds.push("bg_bubbles_301");
numEnemiesCreated = 0;
}
function CreateWorld() {
world = new Array();
var _local4 = 0;
while (_local4 < numRows) {
tempRow = new Array(numColumns);
var _local3;
var _local2 = 0;
while (_local2 < numColumns) {
_local3 = new Bubblefield();
tempRow[_local2] = _local3;
_local2++;
}
world.push(tempRow);
_local4++;
}
}
function CreateWorldRow() {
if (worldCreateRow != numRows) {
var _local9 = 0;
while (_local9 < numColumns) {
if ((worldCreateRow != worldY) || (_local9 != worldX)) {
var _local2 = new Array();
var _local18 = _local9 - worldX;
var _local17 = worldCreateRow - worldY;
var _local4 = Math.round(Math.sqrt((_local18 * _local18) + (_local17 * _local17)));
if (_local4 < 2) {
var _local3;
_local3 = new WorldInstruction(100);
_local3.AddInstruction("Enemy_4", 2, 4);
_local3.AddInstruction("Enemy_1", 0, 1);
_local2.push(_local3);
} else if ((_local4 >= 2) && (_local4 < 4)) {
var _local3 = new WorldInstruction(50);
_local3.AddInstruction("Enemy_4", 2, 6);
_local3.AddInstruction("Enemy_1", 1, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(50);
_local3.AddInstruction("Enemy_4", 0, 2);
_local3.AddInstruction("Enemy_1", 1, 6);
_local2.push(_local3);
} else if ((_local4 >= 4) && (_local4 < 7)) {
var _local3 = new WorldInstruction(60);
_local3.AddInstruction("Enemy_2", 1, 3);
_local3.AddInstruction("Enemy_4", 0, 4);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 4);
_local3.AddInstruction("Enemy_1", 1, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_4", 3, 6);
_local3.AddInstruction("Enemy_1", 2, 3);
_local2.push(_local3);
} else if ((_local4 >= 7) && (_local4 < 9)) {
var _local3 = new WorldInstruction(60);
_local3.AddInstruction("Enemy_2", 1, 3);
_local3.AddInstruction("Enemy_4", 0, 2);
_local3.AddInstruction("Enemy_3", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_2", 1, 5);
_local3.AddInstruction("Enemy_4", 0, 2);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_4", 3, 6);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if ((_local4 >= 9) && (_local4 < 11)) {
var _local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_2", 0, 5);
_local3.AddInstruction("Enemy_1", 0, 1);
_local3.AddInstruction("Enemy_3", 1, 1);
_local2.push(_local3);
_local3 = new WorldInstruction(40);
_local3.AddInstruction("Enemy_5", 1, 5);
_local3.AddInstruction("Enemy_4", 0, 2);
_local3.AddInstruction("Enemy_3", 0, 1);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_2", 1, 2);
_local3.AddInstruction("Enemy_5", 0, 3);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_2", 0, 1);
_local3.AddInstruction("Enemy_4", 1, 6);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if ((_local4 >= 11) && (_local4 < 13)) {
var _local3 = new WorldInstruction(50);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_6", 1, 2);
_local3.AddInstruction("Enemy_3", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_6", 1, 2);
_local3.AddInstruction("Enemy_7", 0, 3);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_6", 1, 3);
_local3.AddInstruction("Enemy_4", 0, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 3, 6);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if ((_local4 >= 13) && (_local4 < 15)) {
var _local3 = new WorldInstruction(50);
_local3.AddInstruction("Enemy_7", 1, 4);
_local3.AddInstruction("Enemy_6", 0, 1);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_3", 1, 2);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_4", 0, 3);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_2", 1, 4);
_local3.AddInstruction("Enemy_5", 0, 3);
_local3.AddInstruction("Enemy_3", 0, 1);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_6", 1, 3);
_local3.AddInstruction("Enemy_2", 0, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_3", 0, 1);
_local3.AddInstruction("Enemy_4", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 1);
_local2.push(_local3);
} else if ((_local4 >= 15) && (_local4 < 17)) {
var _local3 = new WorldInstruction(25);
_local3.AddInstruction("Enemy_7", 0, 4);
_local3.AddInstruction("Enemy_9", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(25);
_local3.AddInstruction("Enemy_3", 1, 2);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_4", 0, 3);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_6", 1, 3);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_3", 0, 1);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_5", 1, 8);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_6", 1, 3);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_7", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if ((_local4 >= 17) && (_local4 < 19)) {
var _local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_11", 1, 2);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_11", 1, 4);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_7", 1, 3);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_5", 0, 3);
_local3.AddInstruction("Enemy_2", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 3, 6);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if ((_local4 >= 19) && (_local4 < 22)) {
var _local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_11", 1, 2);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_10", 1, 1);
_local3.AddInstruction("Enemy_17", 1, 4);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
_local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_2", 0, 3);
_local3.AddInstruction("Enemy_12", 1, 1);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_3", 0, 3);
_local3.AddInstruction("Enemy_12", 1, 1);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_5", 0, 2);
_local3.AddInstruction("Enemy_4", 1, 6);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if ((_local4 >= 22) && (_local4 < 25)) {
var _local3 = new WorldInstruction(30);
_local3.AddInstruction("Enemy_11", 1, 2);
_local3.AddInstruction("Enemy_9", 0, 3);
_local3.AddInstruction("Enemy_13", 0, 3);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_13", 2, 3);
_local3.AddInstruction("Enemy_12", 1, 1);
_local3.AddInstruction("Enemy_9", 0, 3);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_7", 1, 3);
_local3.AddInstruction("Enemy_13", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(20);
_local3.AddInstruction("Enemy_5", 0, 3);
_local3.AddInstruction("Enemy_3", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(10);
_local3.AddInstruction("Enemy_7", 0, 2);
_local3.AddInstruction("Enemy_4", 3, 6);
_local3.AddInstruction("Enemy_1", 0, 3);
_local2.push(_local3);
} else if (_local4 >= 25) {
var _local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_14", 1, 1);
_local3.AddInstruction("Enemy_7", 2, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_14", 2, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_5", 1, 4);
_local3.AddInstruction("Enemy_7", 0, 4);
_local3.AddInstruction("Enemy_1", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_12", 1, 1);
_local3.AddInstruction("Enemy_2", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(2);
_local3.AddInstruction("Enemy_1", 1, 4);
_local3.AddInstruction("Enemy_4", 0, 4);
_local2.push(_local3);
_local3 = new WorldInstruction(3);
_local3.AddInstruction("Enemy_4", 2, 8);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_3", 2, 3);
_local3.AddInstruction("Enemy_7", 1, 2);
_local3.AddInstruction("Enemy_9", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_11", 2, 2);
_local3.AddInstruction("Enemy_2", 2, 4);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_14", 0, 1);
_local3.AddInstruction("Enemy_10", 1, 1);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_4", 0, 2);
_local3.AddInstruction("Enemy_10", 1, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_13", 2, 4);
_local3.AddInstruction("Enemy_9", 1, 3);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_3", 1, 3);
_local3.AddInstruction("Enemy_9", 1, 3);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_6", 1, 4);
_local3.AddInstruction("Enemy_3", 0, 2);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_6", 1, 3);
_local3.AddInstruction("Enemy_9", 1, 3);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_12", 1, 1);
_local3.AddInstruction("Enemy_3", 1, 4);
_local3.AddInstruction("Enemy_1", 0, 2);
_local2.push(_local3);
_local3 = new WorldInstruction(5);
_local3.AddInstruction("Enemy_11", 1, 3);
_local3.AddInstruction("Enemy_9", 0, 4);
_local3.AddInstruction("Enemy_4", 0, 2);
_local2.push(_local3);
}
var _local10 = 0;
var _local11 = 0;
var _local16 = 0;
var _local14 = 0;
var _local6 = 0;
while (_local6 < _local2.length) {
_local16 = _local16 + _local2[_local6].chance;
_local6++;
}
_local14 = Math.round(Math.random() * _local16);
_local6 = 0;
while (_local6 < _local2.length) {
_local11 = _local10 + _local2[_local6].chance;
_local2[_local6].minChance = _local10;
_local2[_local6].maxChance = _local11;
_local10 = _local11;
_local6++;
}
var _local7 = -1;
_local6 = 0;
while (_local6 < _local2.length) {
if ((_local14 >= _local2[_local6].minChance) && (_local14 < _local2[_local6].maxChance)) {
_local7 = _local6;
break;
}
_local6++;
}
if (_local7 == -1) {
_local7 = _local2.length - 1;
}
_local2[_local7].Begin();
var _local13 = 0;
var _local15 = "";
var _local19 = _local2[_local7].GetNumInstructions();
var _local12 = 0;
while (_local12 < _local19) {
_local13 = _local2[_local7].enemyNum;
_local15 = _local2[_local7].enemyType;
var _local8 = 0;
while (_local8 < _local13) {
var _local5 = new Vector();
_local5._x = Math.round(Math.random() * 500) - 250;
_local5._y = Math.round(Math.random() * 400) - 200;
world[worldCreateRow][_local9].AddUnit("enemy_" + enemyDepth, _local15, _local5, enemyDepth);
enemyDepth++;
if (enemyDepth == 20000) {
enemyDepth = 600;
}
numEnemiesCreated++;
_local8++;
}
_local2[_local7].Next();
_local12++;
}
}
_local9++;
}
worldCreateRow++;
} else {
blnWorldCreated = true;
}
}
function CreateNewUnit(enemyType, startPos, CreatedFrom) {
trace(enemyType);
var _local3 = "enemy_" + spawnedEnemyDepth;
var _local6 = Math.round(Math.random() * 360) - 180;
world[worldY][worldX].AddUnit(_local3, enemyType, startPos, spawnedEnemyDepth);
_root.attachMovie(enemyType, _local3, spawnedEnemyDepth);
spawnedEnemyDepth++;
_root[_local3]._x = startPos._x;
_root[_local3]._y = startPos._y;
_root[_local3]._rotation = _local6;
return(_local3);
}
function IsWorldCreated() {
return(blnWorldCreated);
}
function PercentBuilt() {
var _local2 = numRows * numRows;
var _local3 = (worldCreateRow * numColumns) + worldCreateColumn;
return(Math.round((_local3 / _local2) * 100));
}
function GetUnitsCreated() {
return(numEnemiesCreated);
}
function OutputWorld() {
var _local4 = 0;
while (_local4 < numRows) {
var _local3 = "";
var _local2 = 0;
while (_local2 < numColumns) {
_local3 = (_local3 + world[_local4][_local2].GetNumUnits()) + " ";
_local2++;
}
trace(_local3);
_local4++;
}
}
function StartGame() {
}
function RunGame() {
_root.stop();
if (blnWorldCreated) {
var _local3;
if (transitionState == 0) {
_local3 = MoveAvatar();
} else if (deltaList.length != 0) {
_local3 = new Vector();
var _local5 = deltaList[0];
deltaList.shift();
_local3._x = _local5._x * -1;
_local3._y = _local5._y * -1;
if (transitionState == 1) {
world[worldY][worldX - 1].MoveAllBubblefieldUnits(_local3);
} else if (transitionState == 2) {
world[worldY - 1][worldX].MoveAllBubblefieldUnits(_local3);
} else if (transitionState == 3) {
world[worldY][worldX + 1].MoveAllBubblefieldUnits(_local3);
} else if (transitionState == 4) {
world[worldY + 1][worldX].MoveAllBubblefieldUnits(_local3);
}
} else {
var _local4 = new Vector();
if (transitionState == 1) {
world[worldY][worldX - 1].HideAllUnits();
_local4._x = 1147.6;
BackgroundShift(_local4);
CleanPickupBubbles();
numJumps++;
if (numJumps == 1) {
_root.bg.tutorial.gotoAndStop(2);
}
if (numJumps == 2) {
_root.bg.tutorial.gotoAndStop(3);
}
if (numJumps == 3) {
_root.bg.tutorial.gotoAndStop(4);
}
if (numJumps == 4) {
_root.bg.tutorial.gotoAndStop(5);
}
if ((((worldY < 0) || (worldY >= numRows)) || (worldX >= numColumns)) || (worldX < 0)) {
_root.bg.tutorial.gotoAndStop(6);
prevOutside = true;
} else if (prevOutside == true) {
_root.bg.tutorial.gotoAndStop(5);
prevOutside = false;
} else if (numJumps > 4) {
_root.bg.tutorial.gotoAndStop(7);
}
} else if (transitionState == 2) {
world[worldY - 1][worldX].HideAllUnits();
_local4._y = 1147.6;
BackgroundShift(_local4);
CleanPickupBubbles();
numJumps++;
if (numJumps == 1) {
_root.bg.tutorial.gotoAndStop(2);
}
if (numJumps == 2) {
_root.bg.tutorial.gotoAndStop(3);
}
if (numJumps == 3) {
_root.bg.tutorial.gotoAndStop(4);
}
if (numJumps == 4) {
_root.bg.tutorial.gotoAndStop(5);
}
if ((((worldY < 0) || (worldY >= numRows)) || (worldX >= numColumns)) || (worldX < 0)) {
_root.bg.tutorial.gotoAndStop(6);
prevOutside = true;
} else if (prevOutside == true) {
_root.bg.tutorial.gotoAndStop(5);
prevOutside = false;
} else if (numJumps > 4) {
_root.bg.tutorial.gotoAndStop(7);
}
} else if (transitionState == 3) {
world[worldY][worldX + 1].HideAllUnits();
_local4._x = -1147.6;
BackgroundShift(_local4);
CleanPickupBubbles();
numJumps++;
if (numJumps == 1) {
_root.bg.tutorial.gotoAndStop(2);
}
if (numJumps == 2) {
_root.bg.tutorial.gotoAndStop(3);
}
if (numJumps == 3) {
_root.bg.tutorial.gotoAndStop(4);
}
if (numJumps == 4) {
_root.bg.tutorial.gotoAndStop(5);
}
if ((((worldY < 0) || (worldY >= numRows)) || (worldX >= numColumns)) || (worldX < 0)) {
_root.bg.tutorial.gotoAndStop(6);
prevOutside = true;
} else if (prevOutside == true) {
_root.bg.tutorial.gotoAndStop(5);
prevOutside = false;
} else if (numJumps > 4) {
_root.bg.tutorial.gotoAndStop(7);
}
} else if (transitionState == 4) {
world[worldY + 1][worldX].HideAllUnits();
_local4._y = -1147.6;
BackgroundShift(_local4);
CleanPickupBubbles();
numJumps++;
if (numJumps == 1) {
_root.bg.tutorial.gotoAndStop(2);
}
if (numJumps == 2) {
_root.bg.tutorial.gotoAndStop(3);
}
if (numJumps == 3) {
_root.bg.tutorial.gotoAndStop(4);
}
if (numJumps == 4) {
_root.bg.tutorial.gotoAndStop(5);
}
if ((((worldY < 0) || (worldY >= numRows)) || (worldX >= numColumns)) || (worldX < 0)) {
_root.bg.tutorial.gotoAndStop(6);
prevOutside = true;
} else if (prevOutside == true) {
_root.bg.tutorial.gotoAndStop(5);
prevOutside = false;
} else if (numJumps > 4) {
_root.bg.tutorial.gotoAndStop(7);
}
}
transitionState = 0;
if (GetDistance() <= (_root.bg.inside._width / 2)) {
runOnce = false;
}
_local3 = MoveAvatar();
}
MoveWorld(_local3);
RotateGun();
CheckPickupBubbleCollection();
if (transitionState == 0) {
CheckBulletCollision();
CheckTankExit();
}
DoCleanup();
if (secondBulletCounter > 0) {
if (secondBulletCounter == 1) {
ShootGun();
}
secondBulletCounter--;
}
}
}
function RemoveBullet(strName) {
var _local2 = 0;
while (_local2 < arrBullets.length) {
if (strName == arrBullets[_local2]) {
arrBullets.splice(_local2, 1);
break;
}
_local2++;
}
}
function DropPickupBubbles(num2Drop, origin, myPower) {
var _local4 = 0;
while (_local4 < num2Drop) {
var _local3 = "pickup_bubbles_" + arrFloatingBubblesDepth;
arrFloatingBubbles.push(_local3);
_root.attachMovie("pickup_bubble", _local3, arrFloatingBubblesDepth);
_root[_local3]._x = origin._x;
_root[_local3]._y = origin._y;
_root[_local3].DetermineRandomMovement(myPower);
arrFloatingBubblesDepth++;
if (arrFloatingBubblesDepth == 499) {
arrFloatingBubblesDepth = 200;
}
_local4++;
}
}
function MovePickupBubbles(dirVector) {
var _local3 = 0;
while (_local3 < arrFloatingBubbles.length) {
_root[arrFloatingBubbles[_local3]]._x = _root[arrFloatingBubbles[_local3]]._x + dirVector._x;
_root[arrFloatingBubbles[_local3]]._y = _root[arrFloatingBubbles[_local3]]._y + dirVector._y;
_local3++;
}
}
function CleanPickupBubbles() {
var _local3 = 0;
while (_local3 < arrFloatingBubbles.length) {
_root[arrFloatingBubbles[_local3]].removeMovieClip();
_local3++;
}
delete arrFloatingBubbles;
arrFloatingBubbles = new Array();
}
function CheckPickupBubbleCollection() {
var _local5 = new Array();
var _local4 = 0;
while (_local4 < arrFloatingBubbles.length) {
if (_root.avatar.hitTest(_root[arrFloatingBubbles[_local4]]._x, _root[arrFloatingBubbles[_local4]]._y, true)) {
avatarLife++;
_root.avatar.gun.gotoAndStop(avatarLife);
_local5.push(arrFloatingBubbles[_local4]);
_global.SoundManager.PlaySound("collect_2");
}
_local4++;
}
_local4 = 0;
while (_local4 < _local5.length) {
RemovePickupBubble(_local5[_local4]);
_root[_local5[_local4]].removeMovieClip();
_local4++;
}
}
function RemovePickupBubble(strName) {
var _local2 = 0;
while (_local2 < arrFloatingBubbles.length) {
if (strName == arrFloatingBubbles[_local2]) {
arrFloatingBubbles.splice(_local2, 1);
break;
}
_local2++;
}
}
function AvatarHit(numDamage) {
avatarLife = avatarLife - (numDamage * 3);
if (avatarLife == 0) {
avatarLife = 1;
}
_root.avatar.gun.gotoAndStop(avatarLife);
}
function CheckBulletCollision() {
var _local4 = new Array();
var _local5 = 0;
while (_local5 < arrBullets.length) {
if (_root[arrBullets[_local5]]._enemy == false) {
if (world[worldY][worldX].CheckForHits(arrBullets[_local5])) {
_global.SoundManager.PlaySound("hit");
_local4.push(arrBullets[_local5]);
}
} else if (_root.avatar.hitTest(_root[arrBullets[_local5]]._x, _root[arrBullets[_local5]]._y, true)) {
avatarLife = avatarLife - _root[arrBullets[_local5]]._damage;
if (avatarLife <= 0) {
avatarLife = 1;
_global.SoundManager.PlaySound("dead");
EjectFromBubblefield();
_root.avatar.gun.gotoAndStop(avatarLife);
_local4.push(arrBullets[_local5]);
break;
}
_global.SoundManager.PlaySound("avatar_hit");
_root.avatar.gun.gotoAndStop(avatarLife);
_local4.push(arrBullets[_local5]);
}
_local5++;
}
_local5 = 0;
while (_local5 < _local4.length) {
_root[_local4[_local5]]._holdMovement = true;
_root[_local4[_local5]].gotoAndPlay("hit");
AddToCleanup(_local4[_local5]);
RemoveBullet(_local4[_local5]);
_local5++;
}
}
function EjectFromBubblefield() {
var _local3 = 4;
var _local4;
_local4 = world[worldY - 1][worldX].EstimateDifficulty();
if (world[worldY][worldX - 1].EstimateDifficulty() < _local4) {
_local4 = world[worldY][worldX - 1].EstimateDifficulty();
_local3 = 3;
}
if (world[worldY + 1][worldX].EstimateDifficulty() < _local4) {
_local4 = world[worldY + 1][worldX].EstimateDifficulty();
_local3 = 2;
}
if (world[worldY][worldX + 1].EstimateDifficulty() < _local4) {
_local4 = world[worldY][worldX + 1].EstimateDifficulty();
_local3 = 1;
}
var _local2 = new Vector();
if (_local3 == 4) {
trace("UP");
worldY = worldY - 1;
_local2._y = -1147.6;
world[worldY][worldX].ShowAllUnits(_local2);
MoveAvatarToBubble("destTop");
transitionState = 4;
} else if (_local3 == 3) {
trace("LEFT");
worldX = worldX - 1;
_local2._x = -1147.6;
world[worldY][worldX].ShowAllUnits(_local2);
MoveAvatarToBubble("destLeft");
transitionState = 3;
} else if (_local3 == 2) {
trace("DOWN");
worldY = worldY + 1;
_local2._y = 1147.6;
world[worldY][worldX].ShowAllUnits(_local2);
MoveAvatarToBubble("destBottom");
transitionState = 2;
} else if (_local3 == 1) {
trace("RIGHT");
worldX = worldX + 1;
_local2._x = 1147.6;
world[worldY][worldX].ShowAllUnits(_local2);
MoveAvatarToBubble("destRight");
transitionState = 1;
}
}
function AddToCleanup(myName) {
arrCleanup.push({name:myName, counter:6});
}
function DoCleanup() {
var _local4 = new Array();
var _local3 = 0;
while (_local3 < arrCleanup.length) {
arrCleanup[_local3].counter--;
if (arrCleanup[_local3].counter == 0) {
_local4.push(arrCleanup[_local3].name);
}
_local3++;
}
_local3 = 0;
while (_local3 < _local4.length) {
_root[_local4[_local3]].removeMovieClip();
RemoveCleanupItem(_local4[_local3]);
_local3++;
}
}
function RemoveCleanupItem(strName) {
var _local2 = 0;
while (_local2 < arrCleanup.length) {
if (strName == arrCleanup[_local2].name) {
arrCleanup.splice(_local2, 1);
break;
}
_local2++;
}
}
function MoveWorld(vecMove) {
vecMove._x = Math.round(vecMove._x);
vecMove._y = Math.round(vecMove._y);
_root.bg._x = _root.bg._x + vecMove._x;
_root.bg._y = _root.bg._y + vecMove._y;
_root.bubbleSplit._x = _root.bubbleSplit._x + vecMove._x;
_root.bubbleSplit._y = _root.bubbleSplit._y + vecMove._y;
_root.bubbleMask._x = _root.bubbleMask._x + vecMove._x;
_root.bubbleMask._y = _root.bubbleMask._y + vecMove._y;
_root.overlay._x = _root.overlay._x + vecMove._x;
_root.overlay._y = _root.overlay._y + vecMove._y;
world[worldY][worldX].MoveAllBubblefieldUnits(vecMove);
var _local3 = 0;
while (_local3 < arrBullets.length) {
_root[arrBullets[_local3]]._x = _root[arrBullets[_local3]]._x + vecMove._x;
_root[arrBullets[_local3]]._y = _root[arrBullets[_local3]]._y + vecMove._y;
_local3++;
}
MovePickupBubbles(vecMove);
}
function BackgroundShift(vecMove) {
vecMove._x = Math.round(vecMove._x);
vecMove._y = Math.round(vecMove._y);
_root.bg._x = _root.bg._x + vecMove._x;
_root.bg._y = _root.bg._y + vecMove._y;
_root.bubbleSplit._x = _root.bubbleSplit._x + vecMove._x;
_root.bubbleSplit._y = _root.bubbleSplit._y + vecMove._y;
_root.bubbleMask._x = _root.bubbleMask._x + vecMove._x;
_root.bubbleMask._y = _root.bubbleMask._y + vecMove._y;
_root.overlay._x = _root.overlay._x + vecMove._x;
_root.overlay._y = _root.overlay._y + vecMove._y;
}
function MoveAddAndCleanBackgroundBubbles(moveVector) {
var _local9 = new Array();
var _local3 = 0;
while (_local3 < arrBackgrounds.length) {
_root[arrBackgrounds[_local3]]._x = _root[arrBackgrounds[_local3]]._x + (0.2 * moveVector._x);
_root[arrBackgrounds[_local3]]._y = _root[arrBackgrounds[_local3]]._y + (0.2 * moveVector._y);
_local3++;
}
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width) < 0) {
_local9.push(arrBackgrounds[_local3]);
} else if (_root[arrBackgrounds[_local3]]._x > Stage.width) {
_local9.push(arrBackgrounds[_local3]);
} else if (_root[arrBackgrounds[_local3]]._y > Stage.height) {
_local9.push(arrBackgrounds[_local3]);
} else if ((_root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height) < 0) {
_local9.push(arrBackgrounds[_local3]);
}
_local3++;
}
_local3 = 0;
while (_local3 < _local9.length) {
RemoveBubbleBackground(_local9[_local3]);
_local3++;
}
if (moveVector._x < 0) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width) < Stage.width) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x > _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y == _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width;
_local5._y = _root[arrBackgrounds[_local3]]._y;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if ((moveVector._x < 0) && (moveVector._y < 0)) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if (((_root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width) < Stage.width) && ((_root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height) < Stage.height)) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x > _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y > _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width;
_local5._y = _root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if ((moveVector._x < 0) && (moveVector._y >= 0)) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if (((_root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width) < Stage.width) && (_root[arrBackgrounds[_local3]]._y > 0)) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x > _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y < _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width;
_local5._y = _root[arrBackgrounds[_local3]]._y - _root[arrBackgrounds[_local3]]._height;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x + _root[arrBackgrounds[_local3]]._width;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y - _root[arrBackgrounds[_local3]]._height;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if (moveVector._x > 0) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if (_root[arrBackgrounds[_local3]]._x > 0) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x < _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y == _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x - _root[arrBackgrounds[_local3]]._width;
_local5._y = _root[arrBackgrounds[_local3]]._y;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x - _root[arrBackgrounds[_local3]]._width;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if ((moveVector._x > 0) && (moveVector._y < 0)) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local3]]._x > 0) && ((_root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height) < Stage.height)) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x < _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y > _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x - _root[arrBackgrounds[_local3]]._width;
_local5._y = _root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x - _root[arrBackgrounds[_local3]]._width;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if ((moveVector._x > 0) && (moveVector._y >= 0)) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local3]]._x > 0) && (_root[arrBackgrounds[_local3]]._y > 0)) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x < _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y < _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x - _root[arrBackgrounds[_local3]]._width;
_local5._y = _root[arrBackgrounds[_local3]]._y - _root[arrBackgrounds[_local3]]._height;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x - _root[arrBackgrounds[_local3]]._width;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y - _root[arrBackgrounds[_local3]]._height;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if (moveVector._y > 0) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if (_root[arrBackgrounds[_local3]]._y > 0) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x == _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y < _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x;
_local5._y = _root[arrBackgrounds[_local3]]._y - _root[arrBackgrounds[_local3]]._height;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y - _root[arrBackgrounds[_local3]]._height;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
if (moveVector._y < 0) {
_local3 = 0;
while (_local3 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height) < Stage.height) {
var _local6 = false;
var _local4 = 0;
while (_local4 < arrBackgrounds.length) {
if ((_root[arrBackgrounds[_local4]]._x == _root[arrBackgrounds[_local3]]._x) && (_root[arrBackgrounds[_local4]]._y > _root[arrBackgrounds[_local3]]._y)) {
_local6 = true;
}
if (_local6 == false) {
var _local5 = new Vector();
var _local12 = new Vector();
_local5._x = _root[arrBackgrounds[_local3]]._x;
_local5._y = _root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height;
var _local8 = _local5._x - _root[arrBackgrounds[_local4]]._x;
var _local7 = _local5._y - _root[arrBackgrounds[_local4]]._y;
if (Math.sqrt((_local8 * _local8) + (_local7 * _local7)) < 5) {
_local6 = true;
}
}
_local4++;
}
if (_local6 == false) {
var _local10 = "bg_bubbles_" + Math.abs(backgroundDepth);
_root.bg_bubbles_301.duplicateMovieClip(_local10, backgroundDepth);
_root[_local10]._x = _root[arrBackgrounds[_local3]]._x;
_root[_local10]._y = _root[arrBackgrounds[_local3]]._y + _root[arrBackgrounds[_local3]]._height;
arrBackgrounds.push(_local10);
backgroundDepth++;
if (backgroundDepth == 200) {
backgroundDepth = 100;
}
}
}
_local3++;
}
}
}
function RemoveBubbleBackground(objName) {
var _local3 = 0;
while (_local3 < arrBackgrounds.length) {
if (arrBackgrounds[_local3] == objName) {
_root[arrBackgrounds[_local3]].removeMovieClip();
arrBackgrounds.splice(_local3, 1);
break;
}
_local3++;
}
}
function PrintVector(myName, vecMe) {
trace((((myName + " vector: ") + vecMe._x) + " , ") + vecMe._y);
}
function EnemyDead(myName) {
_global.SoundManager.PlaySound("small_death");
world[worldY][worldX].RemoveUnit(myName);
}
function CheckTankExit() {
var _local3 = 0;
if (GetDistance() > (_root.bg.inside._width / 2)) {
_local3 = GetAngle();
_root.bubbleSplit.gotoAndPlay("show");
_root.bubbleSplit._rotation = _local3;
var _local4 = new Vector();
if ((_local3 < -45) && (_local3 > -135)) {
trace("UP");
worldY = worldY - 1;
_local4._y = -1147.6;
world[worldY][worldX].ShowAllUnits(_local4);
MoveAvatarToBubble("destTop");
transitionState = 4;
} else if (((_local3 <= -135) && (_local3 >= -180)) || ((_local3 >= 135) && (_local3 <= 180))) {
trace("LEFT");
worldX = worldX - 1;
_local4._x = -1147.6;
world[worldY][worldX].ShowAllUnits(_local4);
MoveAvatarToBubble("destLeft");
transitionState = 3;
} else if ((_local3 < 135) && (_local3 > 45)) {
trace("DOWN");
worldY = worldY + 1;
_local4._y = 1147.6;
world[worldY][worldX].ShowAllUnits(_local4);
MoveAvatarToBubble("destBottom");
transitionState = 2;
} else {
trace("RIGHT");
worldX = worldX + 1;
_local4._x = 1147.6;
world[worldY][worldX].ShowAllUnits(_local4);
MoveAvatarToBubble("destRight");
transitionState = 1;
}
}
}
function GetDistance() {
var _local3 = _root.avatar._x - _root.bg._x;
var _local2 = _root.avatar._y - _root.bg._y;
return(Math.sqrt((_local3 * _local3) + (_local2 * _local2)));
}
function GetAngle() {
var _local2 = new Vector();
_local2._x = _root.avatar._x - _root.bg._x;
_local2._y = _root.avatar._y - _root.bg._y;
var _local3 = Math.atan2(_local2._y, _local2._x);
var _local4 = (360 * _local3) / (Math.PI*2);
return(_local4);
}
function MoveAvatarToBubble(bubbleDest) {
if (runOnce == false) {
intTotalFrames = 35;
easeFrames = 35;
var ref = eval ("_root.bg." + bubbleDest);
var myPoint = {x:ref._x, y:ref._y};
_root.bg.localToGlobal(myPoint);
dblDestX = myPoint.x;
dblDestY = myPoint.y;
BuildPointList();
vecMomentum._x = 0;
vecMomentum._y = 0;
runOnce = true;
}
}
function MoveAvatar() {
var _local2 = new Vector();
if (Key.isDown(68) && (!Key.isDown(65))) {
vecMomentum._x = vecMomentum._x + numSensitivity;
if (vecMomentum._x > numAvatarMaxVelocity) {
vecMomentum._x = numAvatarMaxVelocity;
}
}
if (Key.isDown(65) && (!Key.isDown(68))) {
vecMomentum._x = vecMomentum._x - numSensitivity;
if (vecMomentum._x < (numAvatarMaxVelocity * -1)) {
vecMomentum._x = numAvatarMaxVelocity * -1;
}
}
if (Key.isDown(83) && (!Key.isDown(87))) {
vecMomentum._y = vecMomentum._y + numSensitivity;
if (vecMomentum._y > numAvatarMaxVelocity) {
vecMomentum._y = numAvatarMaxVelocity;
}
}
if (Key.isDown(87) && (!Key.isDown(83))) {
vecMomentum._y = vecMomentum._y - numSensitivity;
if (vecMomentum._y < (numAvatarMaxVelocity * -1)) {
vecMomentum._y = numAvatarMaxVelocity * -1;
}
}
if ((!Key.isDown(65)) && (!Key.isDown(68))) {
if (vecMomentum._x > 0) {
vecMomentum._x = vecMomentum._x - numResistence;
}
if (vecMomentum._x < 0) {
vecMomentum._x = vecMomentum._x + numResistence;
}
if ((vecMomentum._x >= -0.3) && (vecMomentum._x <= 0.3)) {
vecMomentum._x = 0;
}
}
if ((!Key.isDown(87)) && (!Key.isDown(83))) {
if (vecMomentum._y > 0) {
vecMomentum._y = vecMomentum._y - numResistence;
}
if (vecMomentum._y < 0) {
vecMomentum._y = vecMomentum._y + numResistence;
}
if ((vecMomentum._y >= -0.3) && (vecMomentum._y <= 0.3)) {
vecMomentum._y = 0;
}
}
RotateTank();
_local2._x = vecMomentum._x * -1;
_local2._y = vecMomentum._y * -1;
return(_local2);
}
function RotateTank() {
if ((vecMomentum._x != 0) || (vecMomentum._y != 0)) {
var _local3 = Math.atan2(vecMomentum._y, vecMomentum._x);
var _local4 = (360 * _local3) / (Math.PI*2);
_root.avatar.bottom._rotation = _local4;
}
}
function RotateGun() {
var _local2 = new Vector();
_local2._x = _xmouse - _root.avatar._x;
_local2._y = _ymouse - _root.avatar._y;
var _local3 = Math.atan2(_local2._y, _local2._x);
var _local4 = (360 * _local3) / (Math.PI*2);
_root.avatar.gun._rotation = _local4;
}
function ShootGun() {
if (((avatarLife >= 76) && (avatarLife <= 200)) && (secondBulletCounter != 1)) {
secondBulletCounter = 3;
}
var thisRef = this;
var _local4 = "avatarBullet_" + numBulletDepth;
var _local6 = new Vector();
_local6._x = Math.cos((Math.PI * _root.avatar.gun._rotation) / 180) * 10;
_local6._y = Math.sin((Math.PI * _root.avatar.gun._rotation) / 180) * 10;
var _local5 = {x:_root.avatar.gun.emitter._x, y:_root.avatar.gun.emitter._y};
if (((avatarLife >= 201) && (avatarLife <= 370)) || (avatarLife >= 371)) {
_local5.x = _root.avatar.gun.emitter1._x;
_local5.y = _root.avatar.gun.emitter1._y;
}
_root.avatar.gun.localToGlobal(_local5);
_root.attachMovie("component_bubble_red", _local4, numBulletDepth);
_root[_local4]._x = _local5.x;
_root[_local4]._y = _local5.y;
_root[_local4].SetMovement(_local6._x, _local6._y);
_root[_local4]._enemy = false;
numBulletDepth++;
arrBullets.push(_local4);
_global.SoundManager.PlaySound("shoot");
_root[_local4].removeCallback = function (myName) {
thisRef.RemoveBullet(myName);
};
if ((avatarLife >= 201) && (avatarLife <= 370)) {
_local4 = "avatarBullet_" + numBulletDepth;
_local5.x = _root.avatar.gun.emitter2._x;
_local5.y = _root.avatar.gun.emitter2._y;
_root.avatar.gun.localToGlobal(_local5);
_root.attachMovie("component_bubble_red", _local4, numBulletDepth);
_root[_local4]._x = _local5.x;
_root[_local4]._y = _local5.y;
_root[_local4].SetMovement(_local6._x, _local6._y);
_root[_local4]._enemy = false;
numBulletDepth++;
arrBullets.push(_local4);
_root[_local4].removeCallback = function (myName) {
thisRef.RemoveBullet(myName);
};
_local4 = "avatarBullet_" + numBulletDepth;
_local5.x = _root.avatar.gun.emitter3._x;
_local5.y = _root.avatar.gun.emitter3._y;
_root.avatar.gun.localToGlobal(_local5);
_root.attachMovie("component_bubble_red", _local4, numBulletDepth);
_root[_local4]._x = _local5.x;
_root[_local4]._y = _local5.y;
_root[_local4].SetMovement(_local6._x, _local6._y);
_root[_local4]._enemy = false;
numBulletDepth++;
arrBullets.push(_local4);
_root[_local4].removeCallback = function (myName) {
thisRef.RemoveBullet(myName);
};
} else if (avatarLife >= 371) {
_local4 = "avatarBullet_" + numBulletDepth;
_local5.x = _root.avatar.gun.emitter2._x;
_local5.y = _root.avatar.gun.emitter2._y;
_root.avatar.gun.localToGlobal(_local5);
_root.attachMovie("component_bubble_red", _local4, numBulletDepth);
_root[_local4]._x = _local5.x;
_root[_local4]._y = _local5.y;
_root[_local4]._xscale = 300;
_root[_local4]._yscale = 300;
_root[_local4]._damage = 8;
_local6._x = _local6._x * 0.5;
_local6._y = _local6._y * 0.5;
_root[_local4].SetMovement(_local6._x, _local6._y);
_root[_local4]._enemy = false;
numBulletDepth++;
arrBullets.push(_local4);
_root[_local4].removeCallback = function (myName) {
thisRef.RemoveBullet(myName);
};
}
}
function EnemyFire(emitterPos, direction, speed, size, damage) {
damage = damage * 3;
var thisRef = this;
var _local3 = "enemyBullet_" + numBulletDepth;
var _local4 = new Vector();
_local4._x = Math.cos((Math.PI * direction) / 180) * speed;
_local4._y = Math.sin((Math.PI * direction) / 180) * speed;
_root.attachMovie("component_bubble_red", _local3, numBulletDepth);
_root[_local3]._x = emitterPos._x;
_root[_local3]._y = emitterPos._y;
_root[_local3]._xscale = size;
_root[_local3]._yscale = size;
_root[_local3]._damage = damage;
_root[_local3].SetMovement(_local4._x, _local4._y);
_root[_local3]._enemy = true;
numBulletDepth++;
arrBullets.push(_local3);
_root[_local3].removeCallback = function (myName) {
thisRef.RemoveBullet(myName);
};
}
function outputPoints() {
var _local4 = deltaList.length;
trace("--------");
var _local2 = 0;
while (_local2 < _local4) {
var _local3 = deltaList[_local2];
trace(_local3._x);
_local2++;
}
}
function BuildPointList() {
deltaX = dblDestX - _root.avatar._x;
deltaY = dblDestY - _root.avatar._y;
var _local12 = easeFrames * checkFactor(easeFrames);
var _local10 = deltaX / _local12;
var _local9 = deltaY / _local12;
if (easeFrames > 0) {
var _local8;
_local8 = EaseIn();
var _local11 = _local8.length;
var _local3 = 0;
while (_local3 < _local11) {
var _local4 = _local8[_local3];
var _local5 = _local10 * _local4;
var _local7 = _local9 * _local4;
var _local6 = new Point(_local5, _local7);
deltaList.push(_local6);
_local3++;
}
}
}
function EaseIn() {
var _local4 = new Array();
var _local5 = (Math.PI/2) / easeFrames;
var _local2 = 1;
while (_local2 <= easeFrames) {
var _local3 = _local2 * _local5;
_local4.push(Math.sin(_local3));
_local2++;
}
return(_local4);
}
function EaseOut() {
var _local4 = new Array();
var _local5 = (Math.PI/2) / easeFrames;
var _local2 = 1;
while (_local2 <= easeFrames) {
var _local3 = _local2 * _local5;
_local4.push(Math.sin(_local3 + (Math.PI/2)));
_local2++;
}
return(_local4);
}
function checkFactor(howMany) {
var _local4;
if (howMany == easeFrames) {
_local4 = EaseOut();
}
var _local5 = _local4.length;
var _local3 = 0;
var _local2 = 0;
while (_local2 < _local5) {
_local3 = _local3 + _local4[_local2];
_local2++;
}
return(_local3 / howMany);
}
}
Symbol 175 MovieClip [__Packages.Bubblefield] Frame 0
class Bubblefield
{
var arrUnits;
function Bubblefield () {
arrUnits = new Array();
}
function GetNumUnits() {
return(arrUnits.length);
}
function AddUnit(myName, myLinkage, myPosition, myDepth) {
var _local2 = new BubblefieldUnit(myName, myLinkage, myPosition, myDepth);
arrUnits.push(_local2);
}
function MoveAllBubblefieldUnits(moveVector) {
var _local3 = 0;
while (_local3 < arrUnits.length) {
_root[arrUnits[_local3]._name]._x = _root[arrUnits[_local3]._name]._x + moveVector._x;
_root[arrUnits[_local3]._name]._y = _root[arrUnits[_local3]._name]._y + moveVector._y;
_local3++;
}
}
function RemoveUnit(unitName) {
var _local2 = 0;
while (_local2 < arrUnits.length) {
if (unitName == arrUnits[_local2]._name) {
arrUnits.splice(_local2, 1);
break;
}
_local2++;
}
}
function HideAllUnits() {
var _local4 = new Array();
var _local3 = 0;
while (_local3 < arrUnits.length) {
if (arrUnits[_local3]._linkage == "Enemy_Seeker") {
_local4.push(arrUnits[_local3]._name);
} else {
arrUnits[_local3]._rotation = _root[arrUnits[_local3]._name]._rotation;
}
_root[arrUnits[_local3]._name].removeMovieClip();
_local3++;
}
_local3 = 0;
while (_local3 < _local4.length) {
RemoveUnit(_local4[_local3]);
_local3++;
}
}
function ShowAllUnits(offsetVector) {
var _local3 = 0;
while (_local3 < arrUnits.length) {
_root.attachMovie(arrUnits[_local3]._linkage, arrUnits[_local3]._name, arrUnits[_local3]._depth);
_root[arrUnits[_local3]._name]._x = (_root.bg._x + arrUnits[_local3]._position._x) + offsetVector._x;
_root[arrUnits[_local3]._name]._y = (_root.bg._y + arrUnits[_local3]._position._y) + offsetVector._y;
_root[arrUnits[_local3]._name]._rotation = arrUnits[_local3]._rotation;
_local3++;
}
}
function CheckForHits(bulletName) {
var _local8 = false;
var _local5;
var _local3 = 0;
while (_local3 < arrUnits.length) {
_local5 = false;
if (_root[arrUnits[_local3]._name].hitTest(_root[bulletName]._x, _root[bulletName]._y, true)) {
_local8 = true;
_local5 = true;
}
if (_local5 == false) {
var _local7 = _root[bulletName]._x - (_root[bulletName].moveX * 0.5);
var _local6 = _root[bulletName]._y - (_root[bulletName].moveY * 0.5);
if (_root[arrUnits[_local3]._name].hitTest(_local7, _local6, true)) {
_local8 = true;
_local5 = true;
}
}
if (_local5 == true) {
_root[arrUnits[_local3]._name].ReceiveDamage(_root[bulletName]._damage);
}
_local3++;
}
return(_local8);
}
function EstimateDifficulty() {
var _local3 = 0;
var _local2 = 0;
while (_local2 < arrUnits.length) {
if (arrUnits[_local2]._linkage == "Enemy_1") {
_local3 = _local3 + -0.1;
} else if (arrUnits[_local2]._linkage == "Enemy_2") {
_local3 = _local3 + 1;
} else if (arrUnits[_local2]._linkage == "Enemy_3") {
_local3 = _local3 + 1.5;
} else if (arrUnits[_local2]._linkage == "Enemy_4") {
_local3 = _local3 + -0.2;
} else if (arrUnits[_local2]._linkage == "Enemy_5") {
_local3 = _local3 + 2;
} else if (arrUnits[_local2]._linkage == "Enemy_6") {
_local3 = _local3 + 2;
} else if (arrUnits[_local2]._linkage == "Enemy_7") {
_local3 = _local3 + 3;
} else if (arrUnits[_local2]._linkage == "Enemy_9") {
_local3 = _local3 + 2;
} else if (arrUnits[_local2]._linkage == "Enemy_10") {
_local3 = _local3 + -2;
} else if (arrUnits[_local2]._linkage == "Enemy_11") {
_local3 = _local3 + 2;
} else if (arrUnits[_local2]._linkage == "Enemy_12") {
_local3 = _local3 + 3;
} else if (arrUnits[_local2]._linkage == "Enemy_13") {
_local3 = _local3 + 3;
} else if (arrUnits[_local2]._linkage == "Enemy_14") {
_local3 = _local3 + 7;
}
_local2++;
}
return(_local3);
}
}
Symbol 176 MovieClip [__Packages.BubblefieldUnit] Frame 0
class BubblefieldUnit
{
var _name, _linkage, _position, _difficulty, _depth, _rotation;
function BubblefieldUnit (givenName, givenLinkage, givenPos, givenDepth) {
_name = givenName;
_linkage = givenLinkage;
_position = givenPos;
_difficulty = 0;
_depth = givenDepth;
_rotation = 0;
}
}
Symbol 177 MovieClip [__Packages.WorldInstruction] Frame 0
class WorldInstruction
{
var minChance, maxChance, chance, iterator, subInstructions, enemyType, enemyNum, eof;
function WorldInstruction (myChance) {
minChance = 0;
maxChance = 0;
chance = myChance;
iterator = -1;
subInstructions = new Array();
enemyType = "";
enemyNum = 0;
eof = true;
}
function SetRange(loChance, hiChance) {
minChance = loChance;
maxChance = hiChance;
}
function GetNumInstructions() {
return(subInstructions.length);
}
function AddInstruction(enemyType, minNum, maxNum) {
var _local2 = Math.round(Math.random() * (maxNum - minNum)) + minNum;
subInstructions.push({linkage:enemyType, numAmount:_local2});
if (iterator == subInstructions.length) {
eof = true;
} else {
eof = false;
}
}
function Begin() {
iterator = 0;
if (iterator == subInstructions.length) {
eof = true;
}
enemyType = subInstructions[iterator].linkage;
enemyNum = subInstructions[iterator].numAmount;
}
function Next() {
iterator++;
if (iterator == subInstructions.length) {
iterator--;
eof = true;
}
enemyType = subInstructions[iterator].linkage;
enemyNum = subInstructions[iterator].numAmount;
}
}
Symbol 178 MovieClip [__Packages.Point] Frame 0
class Point
{
var _x, _y;
function Point (xPos, yPos) {
_x = xPos;
_y = yPos;
}
}
Symbol 60 Button
on (release) {
getURL ("http://www.armorgames.com", "blank");
}
Symbol 67 MovieClip Frame 140
stop();
Symbol 71 MovieClip Frame 329
_root.gotoAndPlay("main");
Symbol 76 MovieClip Frame 1
stop();
Symbol 76 MovieClip Frame 41
_root.StartGame();
stop();
Symbol 80 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 80 MovieClip Frame 1
/* no clip actions */
Symbol 80 MovieClip Frame 7
stop();
Symbol 80 MovieClip Frame 20
stop();
Symbol 80 MovieClip Frame 39
stop();
Symbol 83 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 83 MovieClip Frame 1
/* no clip actions */
Symbol 83 MovieClip Frame 7
stop();
Symbol 83 MovieClip Frame 20
stop();
Symbol 83 MovieClip Frame 39
stop();
Symbol 88 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 88 MovieClip Frame 1
/* no clip actions */
Symbol 88 MovieClip Frame 7
stop();
Symbol 88 MovieClip Frame 20
stop();
Symbol 88 MovieClip Frame 39
stop();
Symbol 91 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 91 MovieClip Frame 1
/* no clip actions */
Symbol 91 MovieClip Frame 7
stop();
Symbol 91 MovieClip Frame 20
stop();
Symbol 91 MovieClip Frame 39
stop();
Symbol 94 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 94 MovieClip Frame 1
/* no clip actions */
Symbol 94 MovieClip Frame 7
stop();
Symbol 94 MovieClip Frame 20
stop();
Symbol 94 MovieClip Frame 39
stop();
Instance of Symbol 49 MovieClip in Symbol 97 MovieClip Frame 1
/* no clip actions */
Instance of Symbol 94 MovieClip in Symbol 97 MovieClip Frame 1
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
this._parent._parent.play();
playForward = 0;
}
}
}
on (release) {
_global.SoundManager.PlaySound("button");
this.gotoAndPlay("flash");
playForward = 3;
}
Symbol 100 MovieClip Frame 1
stop();
Symbol 100 MovieClip Frame 2
stop();
Symbol 110 MovieClip Frame 1
stop();
Instance of Symbol 49 MovieClip in Symbol 110 MovieClip Frame 1
/* no clip actions */
Instance of Symbol 94 MovieClip in Symbol 110 MovieClip Frame 1
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
this._parent._parent.play();
playForward = 0;
}
}
}
on (release) {
_global.SoundManager.PlaySound("button");
this.gotoAndPlay("flash");
playForward = 3;
}
Instance of Symbol 100 MovieClip "low" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_quality == "LOW") {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_quality != "LOW") {
this.gotoAndStop("off");
}
}
on (release) {
_quality = "LOW";
this._parent.high.gotoAndStop("off");
this._parent.med.gotoAndStop("off");
}
Instance of Symbol 100 MovieClip "med" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_quality == "MEDIUM") {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_quality != "MEDIUM") {
this.gotoAndStop("off");
}
}
on (release) {
_quality = "MEDIUM";
this._parent.high.gotoAndStop("off");
this._parent.low.gotoAndStop("off");
}
Instance of Symbol 100 MovieClip "high" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_quality == "HIGH") {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_quality != "HIGH") {
this.gotoAndStop("off");
}
}
on (release) {
_quality = "HIGH";
this._parent.low.gotoAndStop("off");
this._parent.med.gotoAndStop("off");
}
Instance of Symbol 100 MovieClip "musicOn" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_global.musicOn == true) {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_global.musicOn != true) {
this.gotoAndStop("off");
}
}
on (release) {
_global.musicOn = true;
this._parent.musicOff.gotoAndStop("off");
_global.myMusicPlayer.SetTrack("titleMusic");
_global.myMusicPlayer.SetMaxVolume(100);
_global.myMusicPlayer.PlayWithCrossFade(3);
}
Instance of Symbol 100 MovieClip "musicOff" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_global.musicOn == false) {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_global.musicOn == true) {
this.gotoAndStop("off");
}
}
on (release) {
_global.musicOn = false;
this._parent.musicOn.gotoAndStop("off");
_global.myMusicPlayer.Stop();
}
Instance of Symbol 100 MovieClip "soundsOn" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_global.soundOn == true) {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_global.soundOn != true) {
this.gotoAndStop("off");
}
}
on (release) {
_global.soundOn = true;
this._parent.soundsOff.gotoAndStop("off");
}
Instance of Symbol 100 MovieClip "soundsOff" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
if (_global.soundOn == false) {
this.gotoAndStop("on");
}
}
on (rollOver) {
this.gotoAndStop("on");
}
on (rollOut) {
if (_global.soundOn == true) {
this.gotoAndStop("off");
}
}
on (release) {
_global.soundOn = false;
this._parent.soundsOn.gotoAndStop("off");
}
Symbol 111 MovieClip Frame 1
stop();
Symbol 111 MovieClip Frame 25
stop();
Symbol 111 MovieClip Frame 50
stop();
Symbol 111 MovieClip Frame 74
stop();
Symbol 111 MovieClip Frame 99
stop();
Instance of Symbol 83 MovieClip in Symbol 112 MovieClip Frame 1
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 9;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 29)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
Instance of Symbol 88 MovieClip in Symbol 112 MovieClip Frame 6
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
Instance of Symbol 80 MovieClip in Symbol 112 MovieClip Frame 9
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
_root.menuMask.gotoAndPlay(2);
playForward = 0;
}
}
}
Instance of Symbol 91 MovieClip in Symbol 112 MovieClip Frame 14
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
Instance of Symbol 4 MovieClip in Symbol 112 MovieClip Frame 30
on (release) {
getURL ("http://www.armorgames.com");
}
Instance of Symbol 88 MovieClip in Symbol 112 MovieClip Frame 75
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
on (release) {
_global.SoundManager.PlaySound("button");
this.gotoAndPlay("flash");
getURL ("http://www.armorgames.com", "_blank");
playForward = 3;
}
Instance of Symbol 91 MovieClip in Symbol 112 MovieClip Frame 75
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
on (release) {
_global.SoundManager.PlaySound("button");
this.gotoAndPlay("flash");
this._parent.otherScreen.gotoAndPlay("settings");
playForward = 3;
}
Instance of Symbol 80 MovieClip in Symbol 112 MovieClip Frame 75
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
playForward = 0;
}
}
}
on (release) {
_global.SoundManager.PlaySound("button");
this.gotoAndPlay("flash");
this._parent.otherScreen.gotoAndPlay("credits");
playForward = 3;
}
Instance of Symbol 83 MovieClip in Symbol 112 MovieClip Frame 75
on (rollOver) {
var playForward = 1;
frameCounter = 7;
var holdCounter = 18;
gotoAndStop(frameCounter);
}
on (rollOut) {
if (playForward != 3) {
playForward = 2;
}
}
onClipEvent (load) {
var frameCounter = 7;
gotoAndStop(frameCounter);
}
onClipEvent (enterFrame) {
if ((playForward == 1) && (frameCounter < 20)) {
this.nextFrame();
frameCounter++;
if (frameCounter == 7) {
playForward = 0;
}
} else if (playForward == 2) {
this.prevFrame();
frameCounter--;
if (frameCounter == 1) {
playForward = 1;
}
} else if (playForward == 3) {
holdCounter--;
if (holdCounter == 0) {
_root.menuMask.gotoAndPlay(2);
playForward = 0;
}
}
}
on (release) {
_global.SoundManager.PlaySound("button");
this.gotoAndPlay("flash");
playForward = 3;
}
Symbol 112 MovieClip Frame 175
gotoAndPlay ("repeatMe");
Symbol 125 MovieClip Frame 1
stop();
Symbol 128 MovieClip Frame 1
stop();
Symbol 128 MovieClip Frame 56
gotoAndPlay ("hide");
Symbol 134 MovieClip Frame 1
stop();
Symbol 143 MovieClip Frame 1
stop();
Symbol 143 MovieClip Frame 138
trace("finished animation");
stop();
_root.DeleteOpenMask();