Frame 2
function initializeGame() {
_root.cleanUp();
if (cont) {
_root.stageID = _root.maxStage;
var _local2 = _root.stageID;
while (_local2 > 10) {
_local2 = _local2 - 10;
}
_root.stageStyle = _local2;
} else {
_root.stageID = 1;
_root.stageStyle = 1;
}
_root.pRandSeed = 19571118 /* 0x12AA1AE */;
_root.titleMC.killMovieClip();
_root.bossCredit = false;
_root.lives = 5;
_root.gameStarted = true;
_root.gameOver = false;
_root.gamePaused = false;
_root.stageClear = false;
_root.playerDead = false;
}
function initializeStage() {
_root.cleanUp();
keyListener.onKeyDown = function () {
if (Key.getCode() == pauseKey) {
if (_root.gamePaused) {
_root.gamePaused = false;
} else {
spawnMessage("PAUSED", Stage.width / 2, Stage.height / 2, 0, "delete");
_root.gamePaused = true;
}
}
};
_root.pRand = new MersenneTwister(stageID + pRandSeed, [291, 564, 837, 1110]);
_root.pRandBG = new MersenneTwister(stageID + pRandSeed, [291, 564, 837, 1110]);
_root.stageMusic.attachSound(("stage" + _root.stageStyle) + "Music");
_root.playerDead = false;
_root.damage = 0;
_root.stageProgress = 0;
if (_root.bossCredit) {
_root.stageProgress = stageGoal - 300;
}
_root.gameTimer = 0;
var _local9 = _root.attachMovie("blankMovie", "messageLayer", 55);
var _local7 = _root.attachMovie("HUD", "HUDLayer", 40);
var _local10 = _root.attachMovie("blankMovie", "enemyShotLayer", 23);
var _local5 = _root.attachMovie("blankMovie", "explosionLayer", 22);
var _local3 = _root.attachMovie("blankMovie", "playerShipLayer", 21);
var _local8 = _root.attachMovie("blankMovie", "enemyShipLayer", 20);
var _local12 = _root.attachMovie("blankMovie", "playerShotLayer", 19);
var _local4 = _root.attachMovie("blankMovie", "BGLayer4", 17);
var _local6 = _root.attachMovie("blankMovie", "shadowLayer", 18);
var _local11 = _root.attachMovie("blankMovie", "BGLayer2", 17);
var _local13 = _root.attachMovie("blankMovie", "BGLayer1", 16);
spawnBGStrip(-64);
spawnBGStrip(Stage.height);
switch (stageStyle) {
case 1 :
var _local2 = 0;
while (_local2 < 8) {
spawnBGDetail("cloud1", pRandBG.randomReal32() * Stage.width, (pRandBG.randomReal32() * (Stage.height + 256)) - 256, pRandBG.randomReal32() * 360, pRandBG.randomReal32() + 0.3, "normal", 0.5, 0.5, 0.5, 1, 0, 32, 8, 0);
spawnBGDetail("mountian1", pRandBG.randomReal32() * Stage.width, (pRandBG.randomReal32() * (Stage.height + 256)) - 256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 0.3, "normal", 0.25, 0.25, 0.25, 1, 64, 64, 32, 0);
_local2++;
}
break;
case 2 :
_local2 = 0;
while (_local2 < 8) {
spawnBGDetail("mountian1", pRandBG.randomReal32() * Stage.width, (pRandBG.randomReal32() * (Stage.height + 256)) - 256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 0.3, "normal", 0.5, 0.5, 0.5, 0.5, 64, 64, 32, 0);
_local2++;
}
break;
default :
_local2 = 0;
for(;;){
if (_local2 >= 8) {
break;
}
_local2++;
};
}
spawnPlayer(256, 320);
fadeIn(5);
spawnMessage("STAGE" + stageID, Stage.width / 2, Stage.height / 2, 60, "screenOff");
}
function spawnBGStrip(yPos) {
if (stageStyle == 10) {
var _local7 = _root.BGLayer1.getNextHighestDepth();
var BGElement = _root.BGLayer1.attachMovie("blankMovie", "BGElement" + _local7, _local7);
var _local13 = BGElement.getNextHighestDepth();
var _local10 = BGElement.attachMovie("blankMovie", "BGElement" + _local13, _local13);
var _local4 = new flash.display.BitmapData(Stage.width / 2, Stage.height + 128, true, 13421772);
_local10.attachBitmap(_local4, _local10.getNextHighestDepth());
_local10._x = 0;
var _local12 = BGElement.getNextHighestDepth();
var _local8 = BGElement.attachMovie("blankMovie", "BGElement" + _local12, _local12);
_local8.attachBitmap(_local4, _local8.getNextHighestDepth());
_local8._x = Stage.width;
_local8._xscale = -100;
} else {
var _local7 = _root.BGLayer1.getNextHighestDepth();
var BGElement = _root.BGLayer1.attachMovie("blankMovie", "BGElement" + _local7, _local7);
var _local4 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
BGElement.attachBitmap(_local4, 0);
}
switch (stageStyle) {
case 1 :
_local4.noise(pRandBG.randomInt32(), 128, 255, 7, true);
var _local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 0.5, 0, 0, 0, 0), "difference");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.25, 0.25, 0.25, 1, 0, 32, 16, 0);
break;
case 2 :
_local4.noise(pRandBG.randomInt32(), 128, 255, 7, true);
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.5, 0.5, 0.5, 1, 64, 32, 0, 0);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(0.75, 0.75, 0.75, 0.25, 32, 32, 0, 0), "hardlight");
break;
case 3 :
_local4.perlinNoise(32, 32, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(0.75, 0.75, 0.75, 1, 32, 32, 0, 0), "hardlight");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.25, 0.25, 0.25, 1, 0, 32, 0, 0);
break;
case 4 :
_local4.perlinNoise(256, 64, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(128, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 0.25, 0, 0, 0, 0), "difference");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.5, 0.5, 0.75, 1, 0, 32, 64, 0);
break;
case 5 :
_local4.perlinNoise(128, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(256, 128, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 0.25, 0, 0, 0, 0), "add");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, 16, 32, 64, 0);
var _local11 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local11.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local4.draw(_local11, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 0.5, 0, 0, 0, 0), "screen");
break;
case 6 :
var BGElement = _root.BGLayer1.attachMovie("blankMovie", "BGElement" + _local7, _local7);
var _local3 = 0;
while (_local3 < 8) {
var _local5 = BGElement.attachMovie("starBand", "stars" + _local3, _local3);
_local5._y = (_local3 * 48) + 24;
_local5._x = pRandBG.randomReal32() * Stage.width;
_local3++;
}
break;
case 7 :
_local4.perlinNoise(32, 32, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 0.5, 0, 0, 0, 0), "difference");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.75, 0.75, 0.75, 1, 64, 64, 72, 0);
break;
case 8 :
_local4.perlinNoise(32, 32, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0), "difference");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.75, 0.75, 0.75, 1, 256, 128, 0, 0);
_local11 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local11.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local4.draw(_local11, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0), "difference");
break;
case 9 :
_local4.perlinNoise(256, 256, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local15.perlinNoise(32, 32, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 128, 100, 0, 0), "difference");
_local11 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
_local11.perlinNoise(64, 64, 4, pRandBG.randomInt32(), false, true, 1, true, null);
_local4.draw(_local11, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 0, 100, 128, 0), "difference");
_local11 = new flash.display.BitmapData(Stage.width, Stage.height + 128, true, 13421772);
bitmapData_4.perlinNoise(16, 16, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(bitmapData_4, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 128, 0, 200, 0), "difference");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.75, 0.75, 0.75, 1, 64, 64, 64, 0);
break;
case 10 :
var _local9 = new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 8, 0);
_local4.perlinNoise(64, 0, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local15 = new flash.display.BitmapData(Stage.width / 2, Stage.height + 128, true, 13421772);
_local15.perlinNoise(0, 64, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local4.draw(_local15, new flash.geom.Matrix(), _local9, "screen");
_local4.draw(_local4, new flash.geom.Matrix(), new flash.geom.ColorTransform(), "screen");
_local11 = new flash.display.BitmapData(Stage.width / 2, Stage.height + 128, true, 13421772);
_local11.perlinNoise(0, 128, 4, pRandBG.randomInt32(), false, false, 1, true, null);
var bitmapData_4 = (new flash.display.BitmapData(Stage.width / 2, Stage.height + 128, true, 13421772));
bitmapData_4.perlinNoise(128, 0, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local11.draw(bitmapData_4, new flash.geom.Matrix(), _local9, "screen");
bitmapData_4.draw(bitmapData_4, new flash.geom.Matrix(), new flash.geom.ColorTransform(), "screen");
_local4.draw(bitmapData_4, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 8, 0), "difference");
var _local14 = new flash.display.BitmapData(Stage.width / 2, Stage.height + 128, true, 13421772);
_local14.perlinNoise(0, 16, 4, pRandBG.randomInt32(), false, false, 1, true, null);
var _local6 = new flash.display.BitmapData(Stage.width / 2, Stage.height + 128, true, 13421772);
_local6.perlinNoise(16, 0, 4, pRandBG.randomInt32(), false, false, 1, true, null);
_local14.draw(_local6, new flash.geom.Matrix(), _local9, "screen");
_local6.draw(_local6, new flash.geom.Matrix(), new flash.geom.ColorTransform(), "screen");
_local4.draw(_local6, new flash.geom.Matrix(), new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 8, 0), "difference");
(new flash.geom.Transform(BGElement)).colorTransform = new flash.geom.ColorTransform(0.75, 0.75, 0.75, 1, 0, 0, 0, 0);
break;
default :
_local4.noise(pRandBG.randomInt32(), 128, 255, 7, false);
}
_local3 = 0;
while (_local3 < 64) {
_local4.colorTransform(new flash.geom.Rectangle(0, _local3, 512, 1), new flash.geom.ColorTransform(1, 1, 1, _local3 / 64, 0, 0, 0, 0));
_local3++;
}
BGElement._y = yPos - _root.BGLayer1._y;
BGElement.cacheAsBitmap = true;
BGElement.onEnterFrame = function () {
if (!gamePaused) {
if (BGElement._y >= (Stage.height - _root.BGLayer1._y)) {
this._y = this._y - ((Stage.height * 2) + 128);
this.swapDepths(0);
}
}
};
}
function spawnBGDetail(libraryObject, xPos, yPos, angle, scale, blendMode, r1, g1, b1, a1, r2, g2, b2, a2) {
var _local2 = _root.BGLayer2.getNextHighestDepth();
var BGDetail = _root.BGLayer2.attachMovie(libraryObject, "BGDetail" + _local2, _local2);
yPos = yPos - _root.BGLayer2._y;
BGDetail._x = xPos;
BGDetail._y = yPos;
BGDetail._width = BGDetail._width * scale;
BGDetail._height = BGDetail._height * scale;
BGDetail._rotation = angle;
BGDetail.blendMode = blendMode;
(new flash.geom.Transform(BGDetail)).colorTransform = new flash.geom.ColorTransform(r1, g1, b1, a1, r2, g2, b2, a2);
BGDetail.cacheAsBitmap = true;
BGDetail.onEnterFrame = function () {
if (!gamePaused) {
if (BGDetail._y > ((Stage.height + BGDetail._height) - _root.BGLayer2._y)) {
BGDetail.killMovieClip();
}
}
};
}
function spawnBGDetail4(libraryObject, xPos, yPos, angle, scale, blendMode, r1, g1, b1, a1, r2, g2, b2, a2) {
var _local2 = _root.BGLayer4.getNextHighestDepth();
var BGDetail = _root.BGLayer4.attachMovie(libraryObject, "BGDetail" + _local2, _local2);
yPos = yPos - _root.BGLayer2._y;
BGDetail._x = xPos;
BGDetail._y = yPos;
BGDetail._width = BGDetail._width * scale;
BGDetail._height = BGDetail._height * scale;
BGDetail._rotation = angle;
BGDetail.blendMode = blendMode;
(new flash.geom.Transform(BGDetail)).colorTransform = new flash.geom.ColorTransform(r1, g1, b1, a1, r2, g2, b2, a2);
BGDetail.cacheAsBitmap = true;
BGDetail.onEnterFrame = function () {
if (!gamePaused) {
if (BGDetail._y > ((Stage.height + BGDetail._height) - _root.BGLayer2._y)) {
BGDetail.killMovieClip();
}
}
};
}
function spawnEnemyWave(shipID, enemyShipCount) {
switch (shipID) {
case "Glider" :
switch (enemyShipCount) {
case 1 :
var _local1 = (Math.ceil(pRand.randomReal32() * 2) * 256) - 128;
var _local3 = -30;
spawnEnemy(shipID, _local1, _local3, 5, false, 0.5, 0.5, 0.5, 1, 92, 0, 0, 0);
spawnEnemy(shipID, _local1 - 32, _local3 - 32, 2, false, 0.5, 0.5, 0.5, 1, 96, 96, 96, 0);
spawnEnemy(shipID, _local1 + 32, _local3 - 32, 2, false, 0.5, 0.5, 0.5, 1, 96, 96, 96, 0);
spawnEnemy(shipID, _local1 - 64, _local3 - 64, 2, false, 0.5, 0.5, 0.5, 1, 96, 96, 96, 0);
spawnEnemy(shipID, _local1 + 64, _local3 - 64, 2, false, 0.5, 0.5, 0.5, 1, 96, 96, 96, 0);
break;
case 2 :
_local1 = (Math.ceil(pRand.randomReal32() * 4) * 128) - 64;
_local3 = -30;
spawnEnemy(shipID, _local1, _local3, 3, false, 0.5, 0.5, 0.5, 1, 96, 96, 0, 0);
spawnEnemy(shipID, _local1, _local3 - 32, 3, false, 0.5, 0.5, 0.5, 1, 96, 96, 0, 0);
spawnEnemy(shipID, _local1, _local3 - 64, 3, false, 0.5, 0.5, 0.5, 1, 96, 96, 0, 0);
break;
}
break;
case "Interceptor" :
var _local2 = 0;
while (_local2 < enemyShipCount) {
_local1 = (Math.ceil(pRand.randomReal32() * 8) * 32) - 32;
_local3 = -30 * _local2;
spawnEnemy(shipID, _local1, _local3, 5, false, 0.5, 0.5, 0.5, 1, 32, 64, 128, 0);
_local1 = _local1 * -1;
_local1 = _local1 + 512;
spawnEnemy(shipID, _local1, _local3, 5, false, 0.5, 0.5, 0.5, 1, 32, 64, 128, 0);
_local2++;
}
break;
}
}
function spawnEnemy(shipID, xPos, yPos, health, boss, r1, g1, b1, a1, r2, g2, b2, a2) {
var _local4 = _root.enemyShipLayer.getNextHighestDepth();
var enemyShip = _root.enemyShipLayer.attachMovie(shipID, "enemyShip" + _local4, _local4);
switch (shipID) {
case "Glider" :
enemyShip.ySpeed = 1;
enemyShip.xSpeed = 0;
enemyShip.attackTimer = 0;
enemyShip.clipSize = _root.stageStyle;
enemyShip.shotDelay = 20;
enemyShip.shotsUsed = 0;
enemyShip.reloadTime = 99999 /* 0x01869F */;
enemyShip.fireShot = function () {
if (enemyShip.flee) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
};
break;
case "Interceptor" :
enemyShip.ySpeed = 2;
enemyShip.xSpeed = 0;
enemyShip.attackTimer = 0;
enemyShip.shotDelay = 0;
enemyShip.clipSize = 1;
enemyShip.shotsUsed = 0;
enemyShip.reloadTime = 0;
enemyShip.fireShot = function () {
if ((gameTimer % 100) == 0) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
};
break;
case "Boss1" :
break;
case "Boss2" :
break;
case "Boss3" :
break;
case "Boss4" :
break;
case "Boss5" :
break;
case "Boss6" :
break;
case "Boss7" :
break;
case "Boss8" :
break;
case "Boss9" :
break;
case "Boss10" :
break;
}
enemyShip.attackUpdate = function () {
enemyShip.attackTimer++;
if (enemyShip.attackTimer > enemyShip.shotDelay) {
if (enemyShip.shotsUsed < enemyShip.clipSize) {
enemyShip.fireShot();
enemyShip.attackTimer = 0;
enemyShip.shotsUsed++;
} else if (enemyShip.attackTimer > enemyShip.reloadTime) {
enemyShip.shotsUsed = 0;
enemyShip.attackTimer = 0;
}
}
};
if (boss) {
enemyShip._width = enemyShip._width * 2;
enemyShip._height = enemyShip._height * 2;
enemyShip.bossPattern = -200;
enemyShip.xSpeed = 0;
enemyShip.ySpeed = 1;
enemyShip.specialAim = 0;
if (stageProgress >= stageGoal) {
_root.bossCredit = true;
_root.stageMusic.stop();
_root.bossMusic.start(0, 9999);
}
if (_root.stageID > 10) {
(new flash.geom.Transform(enemyShip.paintJob)).colorTransform = new flash.geom.ColorTransform(r1, g1, b1, a1, r2, g2, b2, a2);
}
} else {
(new flash.geom.Transform(enemyShip.paintJob)).colorTransform = new flash.geom.ColorTransform(r1, g1, b1, a1, r2, g2, b2, a2);
}
enemyShip.shipID = shipID;
enemyShip.cacheAsBitmap = true;
enemyShip.quality = "LOW";
enemyShip._x = xPos;
enemyShip._y = yPos;
enemyShip.boss = boss;
enemyShip.health = health;
enemyShip.damage = 0;
enemyShip.reload = 0;
enemyShip.onEnterFrame = function () {
if (!gamePaused) {
if (enemyShip.boss) {
if (enemyShip.hitTest(_root.playerShipLayer.playerShip._x, _root.playerShipLayer.playerShip._y, true)) {
spawnShot("aimedShot", _root.playerShipLayer.playerShip._x, _root.playerShipLayer.playerShip._y, 1, 1, 0, 0, true, 1, 1, 1, 1, 0, 0, 0, 0);
}
if ((_root.stageID > 10) && (_root.stageID <= 20)) {
if (((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 0)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
} else if (_root.stageID > 20) {
if (((enemyShip.bossPattern % (200 - _root.stageID)) == 0) && (enemyShip.bossPattern > 0)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 24, enemyShip._y + 36), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
}
switch (enemyShip.shipID) {
case "Glider" :
enemyShip.xSpeed = enemyShip.xSpeed * 1.01;
if ((enemyShip._y > 100) && (!enemyShip.flee)) {
enemyShip.flee = true;
if (enemyShip._x < (Stage.width / 2)) {
enemyShip.xSpeed = 1;
} else {
enemyShip.xSpeed = -1;
}
}
if (enemyShip.flee) {
enemyShip.attackUpdate();
}
break;
case "Interceptor" :
if (enemyShip._y > 300) {
enemyShip.ySpeed--;
enemyShip.flee = true;
if (enemyShip._x < 256) {
enemyShip.xSpeed = 1;
} else {
enemyShip.xSpeed = -1;
}
}
enemyShip.attackUpdate();
break;
case "Boss1" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 1;
enemyShip.ySpeed = -1;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y + 32, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y + 32, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 100, enemyShip._y + 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 100, enemyShip._y + 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
if ((((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 110, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 70, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x - 24, enemyShip._y + 36, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 24, enemyShip._y + 36), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x + 24, enemyShip._y + 36, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x + 24, enemyShip._y + 36), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
break;
case "Boss2" :
enemyShip.bossPattern++;
enemyShip.specialAim++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 0;
enemyShip.ySpeed = 0;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if ((((enemyShip.bossPattern % 50) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * enemyShip.specialAim, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 90), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim - 90), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 180), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 45), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim - 45), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 135), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 225), 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 10) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * enemyShip.specialAim, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 180), 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
if ((((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) + 10), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) - 10), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
break;
case "Boss3" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 1;
enemyShip.ySpeed = 0;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 200)) {
spawnShot("aimedShot", enemyShip._x - 70, enemyShip._y - 120, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 70, enemyShip._y - 120, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
if ((((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 200)) && (enemyShip.bossPattern < 600)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y + 16, 1, 1, degreesToRadians * 110, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y + 16, 1, 1, degreesToRadians * 100, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y + 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y + 16, 1, 1, degreesToRadians * 80, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y + 16, 1, 1, degreesToRadians * 70, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y + 36), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x - 70, enemyShip._y - 120, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 90, enemyShip._y - 120), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x + 70, enemyShip._y - 120, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x + 90, enemyShip._y - 120), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
break;
case "Boss4" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = -1;
enemyShip.ySpeed = -1;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x + 30, enemyShip._y, 1, 1, degreesToRadians * 70, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 30, enemyShip._y, 1, 1, degreesToRadians * 120, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 20, enemyShip._y - 40, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 20, enemyShip._y - 40, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y), 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
}
}
if ((((enemyShip.bossPattern % 60) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) + 10), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) - 10), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) + 30), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) - 30), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
break;
case "Boss5" :
enemyShip.bossPattern++;
if ((enemyShip._y > ((Stage.height / 2) - 100)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 1;
enemyShip.ySpeed = 1;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y + 32, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y + 32, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 100, enemyShip._y + 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 100, enemyShip._y + 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y + 32, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 50, enemyShip._y + 32), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y + 32, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x + 50, enemyShip._y + 32), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x - 100, enemyShip._y + 16, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 100, enemyShip._y + 16), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x + 100, enemyShip._y + 16, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x + 100, enemyShip._y + 16), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y + 32, 1, 1, degreesToRadians * 110, 4, true, 1, 1, 1, 1, 0, 128, 64, 0);
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y + 32, 1, 1, degreesToRadians * 80, 4, true, 1, 1, 1, 1, 0, 128, 64, 0);
spawnShot("aimedShot", enemyShip._x - 100, enemyShip._y + 16, 1, 1, degreesToRadians * 120, 4, true, 1, 1, 1, 1, 0, 128, 64, 0);
spawnShot("aimedShot", enemyShip._x + 100, enemyShip._y + 16, 1, 1, degreesToRadians * 70, 4, true, 1, 1, 1, 1, 0, 128, 64, 0);
}
break;
case "Boss6" :
enemyShip.bossPattern++;
enemyShip.specialAim++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 1;
enemyShip.ySpeed = 1;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if ((((enemyShip.bossPattern % 50) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 360, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 180, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * -90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if (((((enemyShip.bossPattern + 25) % 50) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 45, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * -45, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 135, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 225, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * enemyShip.specialAim, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 180), 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 90), 4, true, 1, 1, 1, 1, 255, 192, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim - 90), 4, true, 1, 1, 1, 1, 255, 192, 0, 0);
}
if ((((enemyShip.bossPattern % 50) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 800)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y + 80, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y + 100), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x - 80, enemyShip._y - 80, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 90, enemyShip._y - 100), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x + 80, enemyShip._y - 80, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x + 90, enemyShip._y - 100), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
if (((((enemyShip.bossPattern + 25) % 50) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 800)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 100, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y - 100), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x - 100, enemyShip._y + 100, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x - 90, enemyShip._y + 100), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x + 100, enemyShip._y + 100, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x + 90, enemyShip._y + 100), 4, true, 1, 1, 1, 1, 255, 0, 128, 0);
}
}
if ((((enemyShip.bossPattern % 10) == 0) && (enemyShip.bossPattern > 800)) && (enemyShip.bossPattern < 1000)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * -90, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 180, 4, true, 1, 1, 1, 1, 255, 64, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 0, 4, true, 1, 1, 1, 1, 255, 64, 0, 0);
}
break;
case "Boss7" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 0;
enemyShip.ySpeed = 0;
}
if (enemyShip.bossPattern > 500) {
enemyShip.bossPattern = 0;
}
enemyShip.specialAim++;
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 100)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 45, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * -45, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 135, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 225, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 100)) && (enemyShip.bossPattern < 200)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * -90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 180, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * 0, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 200)) && (enemyShip.bossPattern < 400)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * enemyShip.specialAim, 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 90), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim - 90), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 180), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 45), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim - 45), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 135), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + 225), 4, true, 1, 1, 1, 1, 0, 64, 128, 0);
}
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 400)) && (enemyShip.bossPattern < 600)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (90 + enemyShip.specialAim), 4, true, 1, 1, 1, 1, 255, 0, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (90 - enemyShip.specialAim), 4, true, 1, 1, 1, 1, 255, 0, 64, 0);
}
break;
case "Boss8" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 1;
enemyShip.ySpeed = 0;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
enemyShip.specialAim++;
if ((((enemyShip.bossPattern % 20) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (90 + enemyShip.specialAim), 4, true, 1, 1, 1, 1, 255, 0, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (90 - enemyShip.specialAim), 4, true, 1, 1, 1, 1, 255, 0, 64, 0);
}
if ((((enemyShip.bossPattern % 50) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 110, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 100, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 80, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 70, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 64, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y - 16, 1, 1, degreesToRadians * 120, 4, true, 1, 1, 1, 1, 0, 192, 64, 0);
}
if ((((enemyShip.bossPattern % 50) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y - 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y - 16, 1, 1, degreesToRadians * 64, 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
spawnShot("aimedShot", enemyShip._x - 50, enemyShip._y - 16, 1, 1, degreesToRadians * 120, 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
}
if (((((enemyShip.bossPattern + 25) % 50) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 1000)) {
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y - 16, 1, 1, degreesToRadians * 90, 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y - 16, 1, 1, degreesToRadians * 64, 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
spawnShot("aimedShot", enemyShip._x + 50, enemyShip._y - 16, 1, 1, degreesToRadians * 120, 4, true, 1, 1, 1, 1, 0, 64, 255, 0);
}
break;
case "Boss9" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 0.5;
enemyShip.ySpeed = 0;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
if (((enemyShip.bossPattern % 150) == 0) && (enemyShip.bossPattern > 0)) {
spawnEnemy("Glider", enemyShip._x - 50, enemyShip._y, 4, false, 0.5, 0.5, 0.5, 1, 92, 0, 0, 0);
}
if ((((enemyShip.bossPattern + 75) % 150) == 0) && (enemyShip.bossPattern > 0)) {
spawnEnemy("Glider", enemyShip._x + 50, enemyShip._y, 4, false, 0.5, 0.5, 0.5, 1, 92, 0, 0, 0);
}
break;
case "Boss10" :
enemyShip.bossPattern++;
if ((enemyShip._y > (Stage.height / 2)) && (enemyShip.ySpeed > 0)) {
enemyShip.ySpeed = enemyShip.ySpeed * -1;
}
enemyShip.bounceOnScreen();
if (enemyShip.bossPattern == -1) {
enemyShip.xSpeed = 0;
enemyShip.ySpeed = 0;
}
if (enemyShip.bossPattern > 1000) {
enemyShip.bossPattern = 0;
}
enemyShip.specialAim++;
if ((((enemyShip.bossPattern % 10) == 0) && (enemyShip.bossPattern > 0)) && (enemyShip.bossPattern < 300)) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (90 + enemyShip.specialAim), 4, true, 1, 1, 1, 1, 255, 0, 0, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (90 - enemyShip.specialAim), 4, true, 1, 1, 1, 1, 255, 0, 0, 0);
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 300)) && (enemyShip.bossPattern < 600)) {
if (!_root.playerDead) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * lookAtPlayer(enemyShip._x, enemyShip._y), 4, true, 1, 1, 1, 1, 192, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) + 10), 4, true, 1, 1, 1, 1, 192, 0, 128, 0);
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, _root.degreesToRadians * (lookAtPlayer(enemyShip._x, enemyShip._y) - 10), 4, true, 1, 1, 1, 1, 192, 0, 128, 0);
}
}
if ((((enemyShip.bossPattern % 30) == 0) && (enemyShip.bossPattern > 600)) && (enemyShip.bossPattern < 900)) {
spawnShot("aimedShot", enemyShip._x + 60, enemyShip._y - 40, 1, 1, degreesToRadians * 60, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 60, enemyShip._y - 40, 1, 1, degreesToRadians * 120, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 30, enemyShip._y, 1, 1, degreesToRadians * 80, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 30, enemyShip._y, 1, 1, degreesToRadians * 100, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x - 30, enemyShip._y, 1, 1, degreesToRadians * 80, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
spawnShot("aimedShot", enemyShip._x + 30, enemyShip._y, 1, 1, degreesToRadians * 100, 4, true, 1, 1, 1, 1, 255, 128, 0, 0);
}
if ((((enemyShip.bossPattern % 50) == 0) && (enemyShip.bossPattern > 900)) && (enemyShip.bossPattern < 1000)) {
var _local2 = 0;
while (_local2 < 18) {
spawnShot("aimedShot", enemyShip._x, enemyShip._y, 1, 1, degreesToRadians * (enemyShip.specialAim + (_local2 * 20)), 4, true, 1, 1, 1, 1, 255, 225, 0, 0);
_local2++;
}
}
break;
}
enemyShip._x = enemyShip._x + enemyShip.xSpeed;
enemyShip._y = enemyShip._y + enemyShip.ySpeed;
if (enemyShip.flee) {
enemyShip.killIfOffScreen();
}
if (enemyShip.flicker > 0) {
if (enemyShip.flicker == 1) {
(new flash.geom.Transform(enemyShip)).colorTransform = new flash.geom.ColorTransform(1, 1, 1, 1, (enemyShip.damage / bossHealth) * 255, (enemyShip.damage / bossHealth) * 128, 0, 0);
}
enemyShip.flicker--;
}
}
};
}
function spawnExplosion(explosionID, xPos, yPos, angle, speed, rotSpeed, health, scale, blendMode, r1, g1, b1, a1, r2, g2, b2, a2) {
var _local2 = _root.explosionLayer.getNextHighestDepth();
var explosion = _root.explosionLayer.attachMovie(explosionID, "explosion" + _local2, _local2);
explosion._width = explosion._width * scale;
explosion._height = explosion._height * scale;
explosion._rotation = angle;
explosion._x = xPos;
explosion._y = yPos;
explosion.rotSpeed = rotSpeed;
explosion.health = health;
explosion.blendMode = blendMode;
(new flash.geom.Transform(explosion)).colorTransform = new flash.geom.ColorTransform(r1, g1, b1, a1, r2, g2, b2, a2);
explosion.cacheAsBitmap = true;
explosion.onEnterFrame = function () {
if (!gamePaused) {
switch (explosionID) {
case "explosion1" :
if (explosion.health > 15) {
explosion._width = explosion._width * 1.1;
explosion._height = explosion._height * 1.1;
} else {
explosion._width = explosion._width * 0.9;
explosion._height = explosion._height * 0.9;
explosion.speed--;
explosion._alpha = explosion._alpha * 0.9;
}
break;
case "roundBurst" :
explosion._width = explosion._width * 1.1;
explosion._height = explosion._height * 1.1;
explosion._alpha = explosion._alpha * 0.8;
explosion.health--;
break;
case "cloud1" :
if (explosion._y > Stage.height) {
explosion.health++;
}
break;
}
explosion.killIfOffScreen();
explosion.xSpeed = speed * Math.cos(angle);
explosion.ySpeed = speed * Math.sin(angle);
explosion._x = explosion._x + explosion.xSpeed;
explosion._y = explosion._y + explosion.ySpeed;
explosion._rotation = explosion._rotation + explosion.rotSpeed;
explosion.health--;
if (explosion.health < 0) {
explosion.killMovieClip();
}
}
};
}
function spawnShot(shotID, xPos, yPos, xScale, yScale, angle, speed, enemyShot, r1, g1, b1, a1, r2, g2, b2, a2) {
if (enemyShot) {
var _local2 = _root.enemyShotLayer.getNextHighestDepth();
var shot = _root.enemyShotLayer.attachMovie(shotID, "enemyShot" + _local2, _local2);
} else {
var _local2 = _root.playerShotLayer.getNextHighestDepth();
var shot = _root.playerShotLayer.attachMovie(shotID, "playerShot" + _local2, _local2);
}
shot._x = xPos;
shot._y = yPos;
shot._width = shot._width * xScale;
shot._height = shot._height * yScale;
shot._rotation = (radiansToDegrees * angle) + 90;
shot.trajectory = angle;
shot.speed = speed;
(new flash.geom.Transform(shot)).colorTransform = new flash.geom.ColorTransform(r1, g1, b1, a1, r2, g2, b2, a2);
shot._x = xPos;
shot._y = yPos;
shot.cacheAsBitmap = true;
if (enemyShot) {
spawnExplosion("roundBurst", shot._x, shot._y, 0, 0, 0, 20, 0.5, "normal", 0.5, 0.5, 0.5, a1, r2, g2, b2, a2);
shot.onEnterFrame = function () {
if (!gamePaused) {
shot.xSpeed = speed * Math.cos(angle);
shot.ySpeed = speed * Math.sin(angle);
shot._x = shot._x + shot.xSpeed;
shot._y = shot._y + shot.ySpeed;
shot.killIfOffScreen();
if (_root.playerShipLayer.playerShip.hitTest(shot._x, shot._y, true)) {
shot.killMovieClip();
_root.boom.start();
_root.damage++;
(new flash.geom.Transform(_root.playerShipLayer.playerShip)).colorTransform = new flash.geom.ColorTransform(0, 1, 1, 1, 255, 255, 255, 0);
_root.playerShipLayer.playerShip.flicker = 2;
spawnExplosion("roundBurst", _root.playerShipLayer.playerShip._x, _root.playerShipLayer.playerShip._y, 0, 0, 0, 20, 1, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
if (_root.damage >= _root.health) {
var _local2 = 0;
while (_local2 < 5) {
spawnExplosion("explosion1", _root.playerShipLayer.playerShip._x, _root.playerShipLayer.playerShip._y, Math.random() * 6.28, Math.random() * 5, (Math.random() * 10) - 5, 20, (Math.random() * 1) + 1, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
_local2++;
}
spawnExplosion("roundBurst", _root.playerShipLayer.playerShip._x, _root.playerShipLayer.playerShip._y, 0, 0, 0, 20, 5, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
_root.playerShipLayer.playerShip.killMovieClip();
_root.playerDead = true;
if (_root.lives <= 0) {
_root.gameOver = true;
spawnMessage("GAME OVER", Stage.width / 2, Stage.height / 2, 120, "swoop");
}
fadeOut(2, 120);
}
}
}
};
} else {
shot.onEnterFrame = function () {
if (!gamePaused) {
shot.xSpeed = speed * Math.cos(angle);
shot.ySpeed = speed * Math.sin(angle);
shot._x = shot._x + shot.xSpeed;
shot._y = shot._y + shot.ySpeed;
shot.killIfOffScreen();
for (i in _root.enemyShipLayer) {
enemyShip = _root.enemyShipLayer[i];
if ((shot._x == undefined) && (shot._y == undefined)) {
} else if ((enemyShip.hitTest(shot._x, shot._y, true) && (enemyShip.boss)) || (enemyShip.hitTest(shot) && (!enemyShip.boss))) {
shot.killMovieClip();
enemyShip.damage++;
if (enemyShip.health < enemyShip.damage) {
if (enemyShip.boss && (stageProgress >= stageGoal)) {
enemyShip.onEnterFrame = function () {
enemyShip.damage++;
if ((gameTimer % 3) == 0) {
spawnExplosion("explosion1", (enemyShip._x - (enemyShip._width / 2)) + (Math.random() * enemyShip._width), (enemyShip._y - (enemyShip._height / 2)) + (Math.random() * enemyShip._height), Math.random() * 6.28, Math.random() * 5, (Math.random() * 10) - 5, 20, (Math.random() * 1) + 1, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
}
if ((gameTimer % 8) == 0) {
_root.boom.start();
}
if (enemyShip.damage > (enemyShip.health + 100)) {
var _local2 = 0;
while (_local2 < 9) {
spawnExplosion("explosion1", enemyShip._x, enemyShip._y, degreesToRadians * (_local2 * 40), 20, (Math.random() * 10) - 5, 20, 3, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
_local2++;
}
spawnExplosion("roundBurst", enemyShip._x, enemyShip._y, 0, 0, 0, 20, 10, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
_root.boom.start();
enemyShip.killMovieClip();
_root.stageClear = true;
fadeOut(5, 60);
}
};
} else {
var i = 0;
while (i < 3) {
spawnExplosion("explosion1", enemyShip._x, enemyShip._y, Math.random() * 6.28, Math.random() * 5, (Math.random() * 10) - 5, 20, (Math.random() * 1) + 1, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
i++;
}
spawnExplosion("roundBurst", enemyShip._x, enemyShip._y, 0, 0, 0, 20, 1.5, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
enemyShip.killMovieClip();
_root.boom.start();
}
} else {
(new flash.geom.Transform(enemyShip)).colorTransform = new flash.geom.ColorTransform(0, 1, 1, 1, 255, 255, 255, 0);
enemyShip.flicker = 2;
}
}
}
}
};
}
}
function spawnPlayer(x, y) {
var playerShip = _root.playerShipLayer.attachMovie("PlayerShip", "playerShip", 0);
_root.playerShipLayer.playerShip._x = x;
_root.playerShipLayer.playerShip._y = y;
playerShip.cacheAsBitmap = true;
playerShip.onEnterFrame = function () {
if (!gamePaused) {
if (playerShip.flicker > 0) {
if (playerShip.flicker == 1) {
(new flash.geom.Transform(playerShip)).colorTransform = new flash.geom.ColorTransform();
}
playerShip.flicker--;
}
var playerShip = _root.playerShipLayer.playerShip;
playerShip._x = playerShip._x + _root.xSpeed;
playerShip._y = playerShip._y + _root.ySpeed;
playerShip.keepOnScreen();
if (_root.shooting) {
if ((gameTimer % 5) == 0) {
spawnShot("aimedShot", playerShip._x, playerShip._y - 10, 1, 1, _root.degreesToRadians * -90, 10, false, 0.75, 0.75, 0.75, 1, 6, 255, 128, 0);
shot.start();
}
}
}
};
}
function getKeyboard() {
if (Key.isDown(shootKey)) {
_root.shooting = true;
} else {
_root.shooting = false;
}
if (Key.isDown(downKey)) {
_root.ySpeed = _root.ySpeed + acceleration;
}
if (Key.isDown(upKey)) {
_root.ySpeed = _root.ySpeed - acceleration;
}
if ((!Key.isDown(upKey)) and (!Key.isDown(downKey))) {
if (_root.ySpeed > 0) {
_root.ySpeed = _root.ySpeed - acceleration;
} else if (_root.ySpeed < 0) {
_root.ySpeed = _root.ySpeed + acceleration;
}
}
if (Key.isDown(rightKey)) {
_root.xSpeed = _root.xSpeed + acceleration;
}
if (Key.isDown(leftKey)) {
_root.xSpeed = _root.xSpeed - acceleration;
}
if ((!Key.isDown(leftKey)) && (!Key.isDown(rightKey))) {
if (_root.xSpeed > 0) {
_root.xSpeed = _root.xSpeed - acceleration;
} else if (_root.xSpeed < 0) {
_root.xSpeed = _root.xSpeed + acceleration;
}
}
if (_root.ySpeed > _root.maxSpeed) {
_root.ySpeed = _root.maxSpeed;
}
if (_root.ySpeed < (-_root.maxSpeed)) {
_root.ySpeed = -_root.maxSpeed;
}
if (_root.xSpeed > _root.maxSpeed) {
_root.xSpeed = _root.maxSpeed;
}
if (_root.xSpeed < (-_root.maxSpeed)) {
_root.xSpeed = -_root.maxSpeed;
}
}
function getCircleDistance(circle1, circle2) {
var _local2 = circle1._x - circle2._x;
var _local1 = circle1._y - circle2._y;
var _local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
return(_local3);
}
function lookAtPlayer(x, y) {
xdiff = _root.playerShipLayer.playerShip._x - x;
ydiff = _root.playerShipLayer.playerShip._y - y;
angle = Math.atan2(ydiff, xdiff);
angle = angle * _root.radiansToDegrees;
return(angle);
}
function fadeIn(fadeSpeed) {
var _local2 = _root.attachMovie("blackScreen", "fadeLayer", 50);
_root.fading = true;
_root.fadeLayer._alpha = 100;
_root.fadeLayer.onEnterFrame = function () {
if (!gamePaused) {
_root.fadeLayer._alpha = _root.fadeLayer._alpha - fadeSpeed;
if (_root.fadeLayer._alpha <= 1) {
if (_root.stageID >= _root.maxStage) {
_root.maxStage = _root.stageID;
_root.saveStage();
}
_root.stageMusic.start(0, 9999);
_root.fadeLayer.removeMovieClip();
_root.fadeLayer._alpha = null;
_root.fading = false;
}
}
};
}
function nextStage() {
_root.stageID++;
_root.stageStyle++;
_root.stageClear = false;
_root.bossCredit = false;
if (_root.stageStyle > 10) {
_root.stageStyle = 1;
}
if (_root.stageID > 100) {
initializeGame();
}
initializeStage();
}
function spawnMessage(textString, xPos, yPos, delay, fadeStyle) {
var _local4 = _root.messageLayer.getNextHighestDepth();
var _local3 = _root.messageLayer.attachMovie("textObject", "textMC" + _local4, _local4);
_local3._y = yPos;
_local3._x = xPos;
_local3.ySpeed = 10;
_local3.timer = 0;
_local3.delay = delay;
_local3.textCore.text = textString;
_local3.cacheAsBitmap = true;
_local3.onEnterFrame = function () {
if (!gamePaused) {
this.timer++;
if (this.timer > this.delay) {
switch (fadeStyle) {
case "swoop" :
this.ySpeed--;
this._y = this._y + this.ySpeed;
if (this._y < 0) {
this.killMovieClip();
}
break;
case "screenOff" :
this.ySpeed--;
this._width = this._width + (this.ySpeed * 3);
this._height = this._height - this.ySpeed;
if (this.ySpeed < -20) {
this.killMovieClip();
}
break;
case "delete" :
this.killMovieClip();
}
}
}
};
}
function titleScreen() {
var _local2 = _root.attachMovie("titleScreen", "titleMC", 100);
keyListener.onKeyUp = function () {
if ((Key.getCode() == shootKey) && (!gameStarted)) {
if (_root.titleMC.mainMenu._alpha == 0) {
_root.titleMC.mainMenu._alpha = 100;
menuChoice = 2;
} else {
if (menuChoice == 1) {
_root.cont = false;
initializeGame();
initializeStage();
}
if (menuChoice == 2) {
_root.cont = true;
initializeGame();
initializeStage();
}
if (menuChoice == 3) {
_root.maxStage = 1;
_root.stageID = 1;
savefile.data.maxStage = _root.maxStage;
savefile.flush();
boom.start();
}
if (menuChoice == 4) {
switch (_root._quality) {
case "LOW" :
_root._quality = "MEDIUM";
break;
case "MEDIUM" :
_root._quality = "HIGH";
break;
case "HIGH" :
_root._quality = "LOW";
}
}
if (menuChoice == 5) {
getURL ("http://www.crazymonkeygames.com", "_blank");
}
}
}
if (((Key.getCode() == upKey) && (_root.titleMC.mainMenu._alpha == 100)) && (!gameStarted)) {
menuChoice--;
_root.titleMC.mainMenu.menuArrow._y = _root.titleMC.mainMenu.menuArrow._y - 22;
if (menuChoice < 1) {
menuChoice = 5;
_root.titleMC.mainMenu.menuArrow._y = _root.titleMC.mainMenu.menuArrow._y + 110;
}
}
if (((Key.getCode() == downKey) && (_root.titleMC.mainMenu._alpha == 100)) && (!gameStarted)) {
menuChoice++;
_root.titleMC.mainMenu.menuArrow._y = _root.titleMC.mainMenu.menuArrow._y + 22;
if (menuChoice > 5) {
menuChoice = 1;
_root.titleMC.mainMenu.menuArrow._y = _root.titleMC.mainMenu.menuArrow._y - 110;
}
}
};
}
function fadeOut(fadeSpeed, delay) {
var _local2 = _root.attachMovie("blackScreen", "fadeLayer", 50);
_root.fadeLayer._alpha = 0;
_root.fadeLayer.onEnterFrame = function () {
if (!gamePaused) {
delay--;
if (delay < 0) {
_root.fadeLayer._alpha = _root.fadeLayer._alpha + fadeSpeed;
if (_root.fadeLayer._alpha >= 99) {
_root.cleanUp();
_root.fadeLayer.removeMovieClip();
if (_root.stageClear) {
_root.nextStage();
}
if (_root.playerDead) {
_root.cleanUp();
if (_root.gameOver) {
_root.gameStarted = false;
titleScreen();
} else {
_root.lives--;
_root.initializeStage();
}
}
}
}
}
};
}
function cleanUp() {
for (i in _root) {
if (_root[i] instanceof MovieClip) {
_root[i].removeMovieClip();
}
if (_root[i] instanceof Sound) {
_root[i].stop();
}
}
}
function saveStage() {
savefile.data.maxStage = _root.maxStage;
savefile.flush();
}
function CMG() {
var black = _root.attachMovie("blackScreen", "black1", 501);
var logo = _root.attachMovie("CMG", "logo1", 500);
logo._x = Stage.width / 2;
logo._y = Stage.height / 2;
delay = 0;
logo.onEnterFrame = function () {
if ((black._alpha > 1) && (delay == 0)) {
black._alpha = black._alpha - 5;
} else {
delay++;
}
if (delay >= 200) {
black._alpha = black._alpha + 5;
if (black._alpha >= 99) {
logo.killMovieClip();
black.killMovieClip();
titleScreen();
}
}
};
}
stop();
var maxStage = 1;
var savefile = SharedObject.getLocal("maxStage");
if (savefile.data.maxStage == undefined) {
_root.maxStage = 1;
savefile.data.maxStage = new Number();
savefile.flush();
} else {
_root.maxStage = savefile.data.maxStage;
}
var boom = new Sound();
boom.attachSound("seige");
var hit = new Sound();
hit.attachSound("hit");
var shot = new Sound();
shot.attachSound("laserRapid");
var bossMusic = new Sound();
bossMusic.attachSound("bossMusic");
var stageMusic = new Sound();
_root.degreesToRadians = (Math.PI/180);
_root.radiansToDegrees = 57.2957795130823;
_root.radiansInCricle = 6.28;
var cont = true;
var gameStarted = false;
var gameOver = false;
var gamePaused = false;
var stageClear = false;
var playerDead = false;
var bossCredit = false;
var stageProgress = 0;
var stageGoal = 5000;
var bossHealth = 1000;
var stageID = 1;
var stageStyle = 1;
var gameTimer = 0;
var upKey = 38;
var leftKey = 37;
var downKey = 40;
var rightKey = 39;
var shootKey = 32;
var pauseKey = 80;
var keyListener = new Object();
Key.addListener(keyListener);
var CMGMouse = new Object();
Mouse.addListener(CMGMouse);
var acceleration = 0.5;
var maxSpeed = 5;
var xSpeed = 0;
var ySpeed = 0;
var lives = 5;
var health = 10;
var damage = 0;
var shooting = false;
var BGScrollSpeed = 3;
CMG();
_root.onEnterFrame = function () {
if (gameStarted && (!gamePaused)) {
getKeyboard();
updatePlayer();
gameTimer++;
stageProgress++;
if (stageProgress < (stageGoal - 300)) {
if ((stageProgress % 150) == 0) {
var _local2 = Math.ceil(pRand.randomReal32() * 3);
switch (_local2) {
case 1 :
spawnEnemyWave("Glider", 1);
break;
case 2 :
spawnEnemyWave("Interceptor", 1);
break;
case 3 :
spawnEnemyWave("Glider", 2);
break;
}
}
}
if (stageProgress == stageGoal) {
spawnEnemy("Boss" + stageStyle, Stage.width / 2, -64, _root.bossHealth, true, 0.5, 0.5, 0.5, 1, pRand.randomReal32() * 128, pRand.randomReal32() * 128, pRand.randomReal32() * 128, 0);
}
_root.BGLayer1._y = _root.BGLayer1._y + BGScrollSpeed;
_root.BGLayer2._y = _root.BGLayer2._y + BGScrollSpeed;
switch (stageStyle) {
case 1 :
if ((_root.BGLayer2._y % (Stage.height / 4)) == 0) {
spawnBGDetail("cloud1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, pRandBG.randomReal32() + 0.3, "normal", 0.5, 0.5, 0.5, 1, 0, 32, 8, 0);
}
if ((_root.BGLayer2._y % (Stage.height / 3)) == 0) {
spawnBGDetail("mountian1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 0.3, "normal", 0.25, 0.25, 0.25, 1, 64, 64, 32, 0);
}
if (((_root.BGLayer2._y % Stage.height) == 0) && (Math.ceil(pRand.randomReal32() * 2) - 1)) {
spawnExplosion("cloud1", (Math.ceil(pRand.randomReal32() * 2) - 1) * Stage.width, -256, _root.degreesToRadians * 90, 6, 0, 99999, (pRandBG.randomReal32() * 3) + 0.5, "normal", 1, 1, 1, 0.4, 64, 64, 64, 0);
}
break;
case 2 :
if ((_root.BGLayer2._y % (Stage.height / 3)) == 0) {
spawnBGDetail("mountian1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 1, "normal", 0.5, 0.5, 0.5, 0.5, 64, 64, 32, 0);
}
break;
case 3 :
if (((_root.BGLayer2._y % Stage.height) == 0) && (Math.ceil(pRand.randomReal32() * 2) - 1)) {
spawnExplosion("cloud1", (Math.ceil(pRand.randomReal32() * 2) - 1) * Stage.width, -256, _root.degreesToRadians * 90, 6, 0, 99999, (pRandBG.randomReal32() * 3) + 1, "normal", 1, 1, 1, 0.4, 64, 64, 64, 0);
}
break;
case 4 :
if (((_root.BGLayer2._y % Stage.height) == 0) && (Math.ceil(pRand.randomReal32() * 2) - 1)) {
spawnExplosion("mountian1", (Math.ceil(pRand.randomReal32() * 2) - 1) * Stage.width, -256, _root.degreesToRadians * 90, 6, 0, 99999, (pRandBG.randomReal32() * 3) + 1, "normal", 1, 1, 1, 0.4, 64, 64, 64, 0);
spawnBGDetail("mountian1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 1, "normal", 0.5, 0.5, 0.5, 1, pRandBG.randomReal32() * 64, 64, 32, 0);
}
break;
case 5 :
if ((_root.BGLayer2._y % Stage.height) == 0) {
spawnExplosion("cloud1", (Math.ceil(pRand.randomReal32() * 2) - 1) * Stage.width, -256, _root.degreesToRadians * 90, 6, 0, 99999, (pRandBG.randomReal32() * 3) + 1, "normal", 1, 1, 1, 0.4, 64, 64, 64, 0);
}
break;
case 6 :
if ((_root.BGLayer2._y % Stage.height) == 0) {
spawnBGDetail("starBand", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, pRandBG.randomReal32() + 0.5, "normal", 0.5, 0.5, 0.5, 1, pRandBG.randomReal32() * 255, 0, pRandBG.randomReal32() * 255, 0);
}
break;
case 7 :
if ((_root.BGLayer2._y % Stage.height) == 0) {
spawnBGDetail("mountian1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 1, "normal", 1, 1, 1, 0.5, 128, 128, 128, 0);
spawnBGDetail("mountian1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 1, "normal", 0.25, 0.25, 0.25, 0.25, 0, 0, 0, 0);
}
break;
case 8 :
if ((_root.BGLayer2._y % (Stage.height / 4)) == 0) {
spawnBGDetail("explosion1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 1, "normal", 0, 0, 0, 1, 0, 0, 0, 0);
spawnBGDetail("explosion1", Math.ceil(pRandBG.randomReal32() * Stage.width), -256, pRandBG.randomReal32() * 360, (pRandBG.randomReal32() * 2) + 1, "normal", 1, 1, 1, 1, 0, 0, 0, 0);
}
break;
case 9 :
if ((_root.BGLayer2._y % Stage.height) == 0) {
}
break;
case 10 :
if ((_root.BGLayer2._y % Stage.height) != 0) {
break;
}
}
}
};
MovieClip.prototype.killMovieClip = function () {
this.swapDepths(1048000);
this.removeMovieClip();
};
MovieClip.prototype.keepOnScreen = function () {
if (this._x < (this._width / 2)) {
this._x = this._width / 2;
} else if (this._x > (Stage.width - (this._width / 2))) {
this._x = Stage.width - (this._width / 2);
}
if (this._y < (this._height / 2)) {
this._y = this._height / 2;
} else if (this._y > (Stage.height - (this._height / 2))) {
this._y = Stage.height - (this._height / 2);
}
};
MovieClip.prototype.killIfOffScreen = function () {
if (this._x < (-this._width)) {
this.killMovieClip();
} else if (this._x > (Stage.width + this._width)) {
this.killMovieClip();
}
if (this._y < (-this._height)) {
this.killMovieClip();
} else if (this._y > (Stage.height + this._height)) {
this.killMovieClip();
}
};
MovieClip.prototype.bounceOnScreen = function () {
if ((this._x < 0) && (this.xSpeed < 0)) {
this.xSpeed = this.xSpeed * -1;
} else if ((this._x > Stage.width) && (this.xSpeed > 0)) {
this.xSpeed = this.xSpeed * -1;
}
if ((this._y < 0) && (this.ySpeed < 0)) {
this.ySpeed = this.ySpeed * -1;
} else if ((this._y > Stage.height) && (this.ySpeed > 0)) {
this.ySpeed = this.ySpeed * -1;
}
};
MovieClip.prototype.hoverOnScreen = function (maxSpeed) {
if (this._x < (this._width / 2)) {
this.xSpeed = this.xSpeed + 0.1;
} else if (this._x > (Stage.width - (this._width / 2))) {
this.xSpeed = this.xSpeed - 0.1;
}
if (this._y < (this._height / 2)) {
this.ySpeed = this.ySpeed + 0.1;
} else if (this._y > (Stage.height - (this._height / 2))) {
this.ySpeed = this.ySpeed - 0.1;
}
if (this.xSpeed > maxSpeed) {
this.xSpeed = maxSpeed;
}
if (this.xSpeed < (-maxSpeed)) {
this.xSpeed = -maxSpeed;
}
if (this.ySpeed > maxSpeed) {
this.ySpeed = maxSpeed;
}
if (this.ySpeed < (-maxSpeed)) {
this.ySpeed = -maxSpeed;
}
};
Symbol 52 MovieClip [HUD] Frame 1
stop();
Instance of Symbol 49 MovieClip [lifeBar] "lifeBar" in Symbol 52 MovieClip [HUD] Frame 1
onClipEvent (load) {
this._width = 0;
stop();
}
onClipEvent (enterFrame) {
if (this._width < ((_root.health - _root.damage) * 10)) {
this._width++;
}
if (this._width > ((_root.health - _root.damage) * 10)) {
this._width--;
}
}
Symbol 53 MovieClip [blankMovie] Frame 1
stop();
Instance of Symbol 84 MovieClip [pressSpace] "pressSpace" in Symbol 101 MovieClip [titleScreen] Frame 1
onClipEvent (load) {
this.wait = 0;
}
onClipEvent (enterFrame) {
this.wait++;
if (this.wait > 10) {
this._alpha = 0;
this.wait = -10;
}
if (this.wait == 0) {
this._alpha = 100;
}
}
Symbol 112 Button
on (release) {
getURL ("http://www.crazymonkeygames.com", "_blank");
}
Symbol 114 MovieClip [__Packages.MersenneTwister] Frame 0
class MersenneTwister
{
var mti;
function MersenneTwister (seed, seedArray) {
var _local3 = NaN;
if (arguments.length > 1) {
initByArray(seedArray, seed);
} else if (arguments.length > 0) {
init(seed);
} else {
init();
}
}
function doubleMult(m, n) {
var _local7 = 4294901760;
var _local1 = 65535;
var _local8 = 4294967296;
var _local6 = m & _local1;
var _local10 = (m & _local7) >>> 16;
var _local5 = n & _local1;
var _local9 = (n & _local7) >>> 16;
var _local3;
var _local2;
var _local4;
_local3 = _local6 * _local5;
_local2 = _local3 >>> 16;
_local3 = _local3 & _local1;
_local2 = _local2 + (_local6 * _local9);
_local2 = _local2 & _local1;
_local2 = _local2 + (_local10 * _local5);
_local2 = _local2 & _local1;
_local4 = (_local2 << 16) | _local3;
return(((_local4 < 0) ? (_local4 + _local8) : (_local4)));
}
function init0(seed) {
var _local3 = (((arguments.length > 0) && (isFinite(seed))) ? (seed & mask) : 4357);
var _local4;
(mt = [_local3]);
(mti = N);
_local4 = 1;
while (_local4 < N) {
_local3 = (69069 * _local3) & mask;
mt[_local4++] = _local3;
}
}
function init(seed) {
var _local3 = (((arguments.length > 0) && (isFinite(seed))) ? (seed & mask) : 5489);
var _local4;
(mt = [_local3]);
(mti = N);
_local4 = 1;
while (_local4 < N) {
_local3 = doubleMult(_local3 ^ (_local3 >>> 30), 1812433253) + (_local4++);
mt[_local4] = _local3;
}
}
function initByArray(seedArray, seed) {
var _local6 = N - 1;
var _local8 = seedArray.length;
var _local4;
var _local3;
var _local7;
var _local5;
init((((arguments.length > 1) && (isFinite(seed))) ? (seed) : 19650218));
_local4 = mt[0];
_local3 = 1;
_local7 = 0;
_local5 = Math.max(N, _local8);
while (_local5) {
_local4 = (((mt[_local3++] ^ doubleMult(_local4 ^ (_local4 >>> 30), 1664525)) + seedArray[_local7]) + (_local7++)) & mask;
mt[_local3] = _local4;
if (_local3 > _local6) {
_local4 = mt[_local6];
mt[0] = _local4;
_local3 = 1;
}
_local7 = _local7 % _local8;
_local5--;
}
_local5 = N - 1;
while (_local5) {
_local4 = ((mt[_local3] ^ doubleMult(_local4 ^ (_local4 >>> 30), 1566083941)) - (_local3++)) & mask;
mt[_local3] = _local4;
if (_local3 > _local6) {
_local4 = mt[_local6];
mt[0] = _local4;
_local3 = 1;
}
_local5--;
}
mt[0] = 2147483648;
}
function randomInt32() {
var _local3;
var _local2;
while ((mti >= N) || (mti < 0)) {
mti = Math.max(0, mti - N);
_local2 = 0;
while (_local2 < NM) {
_local3 = (mt[_local2] & U) | (mt[_local2 + 1] & L);
(mt[_local2] = (mt[_local2 + M] ^ (_local3 >>> 1)) ^ m01[_local3 & 1]);
_local2++;
}
while (_local2 < N1) {
_local3 = (mt[_local2] & U) | (mt[_local2 + 1] & L);
(mt[_local2] = (mt[_local2 + MN] ^ (_local3 >>> 1)) ^ m01[_local3 & 1]);
_local2++;
}
_local3 = (mt[N1] & U) | (mt[0] & L);
(mt[N1] = (mt[M - 1] ^ (_local3 >>> 1)) ^ m01[_local3 & 1]);
}
_local3 = mt[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(((_local3 < 0) ? (_local3 + R) : (_local3)));
}
function randomReal32() {
var _local2 = R;
return(randomInt32() / _local2);
}
function randomInt53() {
var _local2 = 67108864 /* 0x4000000 */;
return(((randomInt32() >>> 5) * _local2) + (randomInt32() >>> 6));
}
function randomReal53() {
var _local2 = 9.00719925474099E15;
return(randomInt53() * (1 / _local2));
}
function randomString(len) {
var _local3;
var _local2;
var _local4 = "";
var _local5 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
_local3 = 0;
while (_local3 < len) {
_local4 = _local4 + _local5.charAt(((((_local3++) % 5) > 0) ? (_local2) : (_local2 = randomInt32())) & 63);
_local2 = _local2 >>> 6;
}
return(_local4);
}
var N = 624;
var M = 397;
var N1 = MersenneTwister.prototype.N - 1;
var NM = MersenneTwister.prototype.N - MersenneTwister.prototype.M;
var MN = MersenneTwister.prototype.M - MersenneTwister.prototype.N;
var mask = 4294967295;
var mt = [];
var m01 = [0, 2567483615];
var U = 2147483648;
var L = 2147483647;
var R = 4294967296;
}